From 1e3ce0d32dcb572566f7886e4a55838a05024d23 Mon Sep 17 00:00:00 2001 From: Simon Suo Date: Tue, 2 May 2023 15:33:26 -0400 Subject: [PATCH] Replace all gpt_index with llama_index (#1875) * use llama_index * replace in docs * replace all tests * replace other packages * replace more docs * more docs * update others * update setup * wip * wip --- .github/workflows/build_package.yml | 2 +- .github/workflows/dev_docs.yml | 2 +- CITATION.cff | 2 +- CONTRIBUTING.md | 44 +++++----- MANIFEST.in | 4 +- MANIFEST_llama.in | 3 - Makefile | 2 +- benchmarks/struct_indices/spider/evaluate.py | 4 +- .../struct_indices/spider/generate_sql.py | 2 +- .../struct_indices/spider/spider_utils.py | 2 +- docs/conf.py | 2 +- docs/getting_started/installation.md | 2 +- docs/getting_started/starter_example.md | 6 +- docs/guides/notebooks.rst | 2 +- docs/guides/tutorials/building_a_chatbot.md | 2 +- docs/guides/tutorials/sql_guide.md | 4 +- .../tutorials/terms_definitions_tutorial.md | 2 +- docs/guides/tutorials/unified_query.md | 14 ++-- docs/how_to/analysis/cost_analysis.md | 2 +- docs/how_to/customization/custom_llms.md | 2 +- docs/how_to/customization/custom_prompts.md | 2 +- docs/how_to/customization/embeddings.md | 2 +- docs/how_to/evaluation/evaluation.md | 16 ++-- docs/how_to/index_structs/composability.md | 2 +- docs/how_to/index_structs/update.md | 2 +- docs/how_to/integrations/chatgpt_plugins.md | 2 +- .../integrations/using_with_langchain.md | 6 +- docs/how_to/integrations/vector_stores.md | 36 ++++---- docs/how_to/query/node_postprocessor.md | 4 +- docs/reference/callbacks.rst | 2 +- docs/reference/composability.rst | 2 +- docs/reference/example_notebooks.rst | 2 +- docs/reference/indices.rst | 2 +- docs/reference/indices/empty.rst | 2 +- docs/reference/indices/kg.rst | 2 +- docs/reference/indices/list.rst | 2 +- docs/reference/indices/struct_store.rst | 2 +- docs/reference/indices/table.rst | 2 +- docs/reference/indices/tree.rst | 2 +- docs/reference/indices/vector_store.rst | 2 +- .../reference/langchain_integrations/base.rst | 4 +- docs/reference/node.rst | 2 +- docs/reference/node_parser.rst | 2 +- docs/reference/node_postprocessor.rst | 2 +- docs/reference/optimizers.rst | 2 +- docs/reference/playground.rst | 2 +- docs/reference/prompts.rst | 8 +- docs/reference/query/query_bundle.rst | 2 +- .../query_engines/graph_query_engine.rst | 2 +- .../query_engines/multistep_query_engine.rst | 2 +- .../query_engines/pandas_query_engine.rst | 2 +- .../query_engines/retriever_query_engine.rst | 2 +- .../query_engines/router_query_engine.rst | 2 +- .../query/query_engines/sql_query_engine.rst | 2 +- .../query_engines/transform_query_engine.rst | 2 +- docs/reference/query/query_transform.rst | 2 +- docs/reference/query/response_synthesizer.rst | 2 +- docs/reference/query/retrievers.rst | 2 +- docs/reference/query/retrievers/empty.rst | 2 +- docs/reference/query/retrievers/kg.rst | 2 +- docs/reference/query/retrievers/list.rst | 2 +- docs/reference/query/retrievers/table.rst | 2 +- docs/reference/query/retrievers/transform.rst | 2 +- docs/reference/query/retrievers/tree.rst | 6 +- .../query/retrievers/vector_store.rst | 2 +- docs/reference/readers.rst | 2 +- docs/reference/response.rst | 2 +- docs/reference/service_context.rst | 2 +- docs/reference/service_context/embeddings.rst | 4 +- .../service_context/llama_logger.rst | 2 +- .../service_context/llm_predictor.rst | 4 +- .../service_context/prompt_helper.rst | 2 +- docs/reference/storage.rst | 2 +- docs/reference/storage/docstore.rst | 2 +- docs/reference/storage/index_store.rst | 2 +- docs/reference/storage/indices_save_load.rst | 2 +- docs/reference/storage/kv_store.rst | 2 +- docs/reference/storage/vector_store.rst | 2 +- docs/reference/struct_store.rst | 6 +- docs/use_cases/queries.md | 2 +- experimental/classifier/utils.py | 6 +- experimental/cli/cli_add.py | 2 +- experimental/cli/configuration.py | 14 ++-- gpt_index/composability/__init__.py | 7 -- gpt_index/evaluation/__init__.py | 6 -- gpt_index/indices/__init__.py | 16 ---- gpt_index/indices/empty/__init__.py | 6 -- gpt_index/indices/knowledge_graph/__init__.py | 9 -- gpt_index/indices/query/__init__.py | 7 -- gpt_index/indices/tree/__init__.py | 18 ---- gpt_index/indices/vector_store/__init__.py | 9 -- gpt_index/llm_predictor/__init__.py | 8 -- gpt_index/logger/__init__.py | 5 -- gpt_index/node_parser/__init__.py | 6 -- gpt_index/optimization/__init__.py | 7 -- gpt_index/output_parsers/__init__.py | 6 -- gpt_index/prompts/__init__.py | 5 -- gpt_index/query_engine/__init__.py | 14 ---- gpt_index/readers/__init__.py | 83 ------------------- gpt_index/readers/chatgpt_plugin/__init__.py | 5 -- gpt_index/retrievers/__init__.py | 31 ------- gpt_index/selectors/__init__.py | 9 -- gpt_index/storage/__init__.py | 7 -- gpt_index/storage/docstore/__init__.py | 16 ---- gpt_index/storage/index_store/__init__.py | 5 -- gpt_index/storage/kvstore/__init__.py | 4 - gpt_index/tools/__init__.py | 7 -- gpt_index/tts/__init__.py | 6 -- gpt_index/vector_stores/__init__.py | 31 ------- {gpt_index => llama_index}/VERSION | 0 {gpt_index => llama_index}/__init__.py | 54 ++++++------ {gpt_index => llama_index}/async_utils.py | 0 .../callbacks/__init__.py | 0 {gpt_index => llama_index}/callbacks/base.py | 2 +- .../callbacks/llama_debug.py | 4 +- .../callbacks/schema.py | 0 llama_index/composability/__init__.py | 7 ++ .../composability/base.py | 2 +- .../composability/joint_qa_summary.py | 20 ++--- {gpt_index => llama_index}/constants.py | 0 .../data_structs/__init__.py | 6 +- .../data_structs/data_structs.py | 6 +- .../data_structs/data_structs_v2.py | 4 +- .../data_structs/node_v2.py | 2 +- .../data_structs/registry.py | 6 +- .../data_structs/struct_type.py | 0 .../data_structs/table.py | 2 +- .../data_structs/table_v2.py | 4 +- .../embeddings/__init__.py | 0 {gpt_index => llama_index}/embeddings/base.py | 2 +- .../embeddings/google.py | 2 +- .../embeddings/langchain.py | 2 +- .../embeddings/openai.py | 2 +- .../embeddings/utils.py | 0 llama_index/evaluation/__init__.py | 6 ++ {gpt_index => llama_index}/evaluation/base.py | 2 +- .../evaluation/dataset_generation.py | 6 +- .../experimental/evaporate/__init__.py | 2 +- .../experimental/evaporate/base.py | 10 +-- .../experimental/evaporate/prompts.py | 4 +- {gpt_index => llama_index}/img_utils.py | 0 llama_index/indices/__init__.py | 16 ++++ {gpt_index => llama_index}/indices/base.py | 22 ++--- .../indices/base_retriever.py | 4 +- .../indices/common/__init__.py | 0 .../indices/common/struct_store/__init__.py | 0 .../indices/common/struct_store/base.py | 26 +++--- .../indices/common/struct_store/schema.py | 0 .../indices/common/struct_store/sql.py | 10 +-- .../indices/common_tree/__init__.py | 0 .../indices/common_tree/base.py | 18 ++-- .../indices/composability/__init__.py | 2 +- .../indices/composability/graph.py | 12 +-- llama_index/indices/empty/__init__.py | 6 ++ .../indices/empty/base.py | 12 +-- .../indices/empty/retrievers.py | 12 +-- .../indices/keyword_table/README.md | 2 +- .../indices/keyword_table/__init__.py | 8 +- .../indices/keyword_table/base.py | 22 ++--- .../indices/keyword_table/rake_base.py | 4 +- .../indices/keyword_table/retrievers.py | 18 ++-- .../indices/keyword_table/simple_base.py | 6 +- .../indices/keyword_table/utils.py | 4 +- .../indices/knowledge_graph/__init__.py | 9 ++ .../indices/knowledge_graph/base.py | 16 ++-- .../indices/knowledge_graph/retrievers.py | 20 ++--- .../indices/list/README.md | 2 +- .../indices/list/__init__.py | 4 +- .../indices/list/base.py | 12 +-- .../indices/list/retrievers.py | 12 +-- {gpt_index => llama_index}/indices/loading.py | 8 +- .../indices/postprocessor/__init__.py | 8 +- .../indices/postprocessor/base.py | 0 .../indices/postprocessor/node.py | 16 ++-- .../indices/postprocessor/node_recency.py | 6 +- .../indices/postprocessor/pii.py | 8 +- .../indices/prompt_helper.py | 12 +-- llama_index/indices/query/__init__.py | 7 ++ .../indices/query/base.py | 6 +- .../indices/query/embedding_utils.py | 4 +- .../indices/query/query_transform/__init__.py | 2 +- .../indices/query/query_transform/base.py | 12 +-- .../indices/query/query_transform/prompts.py | 4 +- .../indices/query/response_synthesis.py | 18 ++-- .../indices/query/schema.py | 0 .../indices/registry.py | 24 +++--- .../indices/response/__init__.py | 4 +- .../indices/response/response_builder.py | 30 +++---- .../indices/response/type.py | 0 .../indices/service_context.py | 18 ++-- .../indices/struct_store/__init__.py | 8 +- .../indices/struct_store/base.py | 12 +-- .../indices/struct_store/container_builder.py | 14 ++-- .../indices/struct_store/pandas.py | 12 +-- .../indices/struct_store/pandas_query.py | 14 ++-- .../indices/struct_store/sql.py | 24 +++--- .../indices/struct_store/sql_query.py | 20 +++-- .../indices/tree/README.md | 2 +- llama_index/indices/tree/__init__.py | 18 ++++ .../indices/tree/all_leaf_retriever.py | 12 +-- .../indices/tree/base.py | 30 +++---- .../indices/tree/inserter.py | 19 +++-- .../tree/select_leaf_embedding_retriever.py | 8 +- .../indices/tree/select_leaf_retriever.py | 27 +++--- .../indices/tree/tree_root_retriever.py | 10 +-- {gpt_index => llama_index}/indices/utils.py | 6 +- llama_index/indices/vector_store/__init__.py | 9 ++ .../indices/vector_store/base.py | 22 ++--- .../indices/vector_store/retrievers.py | 20 ++--- .../langchain_helpers/__init__.py | 0 .../langchain_helpers/agents/__init__.py | 6 +- .../langchain_helpers/agents/agents.py | 2 +- .../langchain_helpers/agents/toolkits.py | 2 +- .../langchain_helpers/agents/tools.py | 4 +- .../langchain_helpers/chain_wrapper.py | 4 +- .../langchain_helpers/memory_wrapper.py | 6 +- .../langchain_helpers/sql_wrapper.py | 0 .../langchain_helpers/text_splitter.py | 4 +- llama_index/llm_predictor/__init__.py | 8 ++ .../llm_predictor/base.py | 6 +- .../llm_predictor/chatgpt.py | 6 +- .../llm_predictor/stable_lm.py | 4 +- .../llm_predictor/structured.py | 4 +- llama_index/logger/__init__.py | 5 ++ {gpt_index => llama_index}/logger/base.py | 0 llama_index/node_parser/__init__.py | 6 ++ .../node_parser/interface.py | 4 +- .../node_parser/node_utils.py | 10 +-- .../node_parser/simple.py | 10 +-- llama_index/optimization/__init__.py | 7 ++ .../optimization/optimizer.py | 10 +-- llama_index/output_parsers/__init__.py | 6 ++ .../output_parsers/base.py | 0 .../output_parsers/guardrails.py | 2 +- .../output_parsers/langchain.py | 2 +- .../output_parsers/selection.py | 2 +- .../playground/__init__.py | 2 +- {gpt_index => llama_index}/playground/base.py | 10 +-- llama_index/prompts/__init__.py | 5 ++ {gpt_index => llama_index}/prompts/base.py | 4 +- .../prompts/chat_prompts.py | 2 +- .../prompts/default_prompt_selectors.py | 6 +- .../prompts/default_prompts.py | 2 +- .../prompts/prompt_type.py | 0 {gpt_index => llama_index}/prompts/prompts.py | 4 +- {gpt_index => llama_index}/py.typed | 0 llama_index/query_engine/__init__.py | 14 ++++ .../query_engine/graph_query_engine.py | 10 +-- .../query_engine/multistep_query_engine.py | 12 +-- .../query_engine/retriever_query_engine.py | 26 +++--- .../query_engine/router_query_engine.py | 12 +-- .../query_engine/transform_query_engine.py | 10 +-- llama_index/readers/__init__.py | 83 +++++++++++++++++++ {gpt_index => llama_index}/readers/base.py | 2 +- .../readers/chatgpt_plugin/__init__.py | 5 ++ .../readers/chatgpt_plugin/base.py | 4 +- {gpt_index => llama_index}/readers/chroma.py | 4 +- .../readers/database.py | 6 +- .../readers/deeplake.py | 4 +- .../readers/discord_reader.py | 4 +- .../readers/download.py | 8 +- .../readers/elasticsearch.py | 4 +- {gpt_index => llama_index}/readers/faiss.py | 4 +- .../readers/file/__init__.py | 0 .../readers/file/base.py | 24 +++--- .../readers/file/base_parser.py | 0 .../readers/file/docs_parser.py | 2 +- .../readers/file/epub_parser.py | 2 +- .../readers/file/image_caption_parser.py | 4 +- .../readers/file/image_parser.py | 4 +- .../readers/file/image_vision_llm_parser.py | 4 +- .../readers/file/ipynb_parser.py | 2 +- .../readers/file/markdown_parser.py | 2 +- .../readers/file/mbox_parser.py | 2 +- .../readers/file/slides_parser.py | 2 +- .../readers/file/tabular_parser.py | 2 +- .../readers/file/video_audio.py | 2 +- .../readers/github_readers/__init__.py | 0 .../github_readers/github_api_client.py | 0 .../github_repository_reader.py | 14 ++-- .../readers/github_readers/utils.py | 2 +- .../readers/google_readers/__init__.py | 0 .../readers/google_readers/gdocs.py | 4 +- .../readers/google_readers/gsheets.py | 4 +- {gpt_index => llama_index}/readers/json.py | 4 +- .../readers/make_com/__init__.py | 0 .../readers/make_com/wrapper.py | 8 +- {gpt_index => llama_index}/readers/mbox.py | 6 +- {gpt_index => llama_index}/readers/milvus.py | 4 +- {gpt_index => llama_index}/readers/mongo.py | 4 +- {gpt_index => llama_index}/readers/myscale.py | 4 +- {gpt_index => llama_index}/readers/notion.py | 4 +- .../readers/obsidian.py | 6 +- .../readers/pinecone.py | 4 +- {gpt_index => llama_index}/readers/qdrant.py | 4 +- .../readers/schema/__init__.py | 0 .../readers/schema/base.py | 2 +- {gpt_index => llama_index}/readers/slack.py | 4 +- .../readers/steamship/__init__.py | 0 .../readers/steamship/file_reader.py | 4 +- .../readers/string_iterable.py | 6 +- {gpt_index => llama_index}/readers/twitter.py | 4 +- .../readers/weaviate/__init__.py | 0 .../readers/weaviate/client.py | 10 +-- .../readers/weaviate/reader.py | 4 +- .../readers/weaviate/utils.py | 2 +- {gpt_index => llama_index}/readers/web.py | 4 +- .../readers/wikipedia.py | 4 +- .../readers/youtube_transcript.py | 4 +- .../response/__init__.py | 0 .../response/notebook_utils.py | 8 +- {gpt_index => llama_index}/response/schema.py | 4 +- {gpt_index => llama_index}/response/utils.py | 0 llama_index/retrievers/__init__.py | 31 +++++++ .../retrievers/transform_retriever.py | 8 +- {gpt_index => llama_index}/schema.py | 2 +- llama_index/selectors/__init__.py | 9 ++ .../selectors/llm_selectors.py | 16 ++-- .../selectors/prompts.py | 4 +- {gpt_index => llama_index}/selectors/types.py | 4 +- llama_index/storage/__init__.py | 7 ++ llama_index/storage/docstore/__init__.py | 16 ++++ .../storage/docstore/keyval_docstore.py | 8 +- .../storage/docstore/mongo_docstore.py | 4 +- .../storage/docstore/registry.py | 6 +- .../storage/docstore/simple_docstore.py | 8 +- .../storage/docstore/types.py | 4 +- .../storage/docstore/utils.py | 8 +- llama_index/storage/index_store/__init__.py | 5 ++ .../storage/index_store/keyval_index_store.py | 8 +- .../storage/index_store/mongo_index_store.py | 4 +- .../storage/index_store/simple_index_store.py | 8 +- .../storage/index_store/types.py | 2 +- .../storage/index_store/utils.py | 6 +- llama_index/storage/kvstore/__init__.py | 4 + .../storage/kvstore/mongodb_kvstore.py | 2 +- .../storage/kvstore/simple_kvstore.py | 2 +- .../storage/kvstore/types.py | 0 .../storage/storage_context.py | 18 ++-- .../token_counter/__init__.py | 0 .../token_counter/mock_chain_wrapper.py | 12 +-- .../token_counter/mock_embed_model.py | 2 +- .../token_counter/token_counter.py | 2 +- .../token_counter/utils.py | 2 +- llama_index/tools/__init__.py | 7 ++ .../tools/query_engine.py | 4 +- {gpt_index => llama_index}/tools/types.py | 0 llama_index/tts/__init__.py | 6 ++ {gpt_index => llama_index}/tts/bark.py | 2 +- {gpt_index => llama_index}/tts/base.py | 0 {gpt_index => llama_index}/tts/elevenlabs.py | 2 +- {gpt_index => llama_index}/types.py | 0 {gpt_index => llama_index}/utils.py | 0 llama_index/vector_stores/__init__.py | 31 +++++++ .../vector_stores/chatgpt_plugin.py | 4 +- .../vector_stores/chroma.py | 6 +- .../vector_stores/deeplake.py | 4 +- .../vector_stores/faiss.py | 2 +- .../vector_stores/milvus.py | 4 +- .../vector_stores/myscale.py | 14 ++-- .../vector_stores/opensearch.py | 4 +- .../vector_stores/pinecone.py | 4 +- .../vector_stores/qdrant.py | 6 +- .../vector_stores/registry.py | 24 +++--- .../vector_stores/simple.py | 4 +- .../vector_stores/types.py | 2 +- .../vector_stores/weaviate.py | 6 +- scripts/create_llama_package.sh | 31 ------- scripts/publish_gpt_index_package.sh | 14 ++++ scripts/publish_llama_package.sh | 36 -------- setup.py | 11 ++- setup_llama.py | 42 ---------- tests/callbacks/test_llama_debug.py | 6 +- tests/conftest.py | 6 +- tests/embeddings/test_base.py | 4 +- tests/indices/composability/test_utils.py | 2 +- tests/indices/conftest.py | 4 +- tests/indices/empty/test_base.py | 6 +- tests/indices/keyword_table/test_base.py | 14 ++-- .../indices/keyword_table/test_retrievers.py | 12 +-- tests/indices/keyword_table/test_utils.py | 2 +- tests/indices/knowledge_graph/conftest.py | 2 +- tests/indices/knowledge_graph/test_base.py | 10 +-- .../knowledge_graph/test_retrievers.py | 10 +-- tests/indices/list/test_index.py | 10 +-- tests/indices/list/test_retrievers.py | 8 +- tests/indices/postprocessor/test_base.py | 18 ++-- tests/indices/query/conftest.py | 4 +- .../query/query_transform/mock_utils.py | 2 +- .../query/query_transform/test_base.py | 4 +- tests/indices/query/test_compose.py | 12 +-- tests/indices/query/test_compose_vector.py | 18 ++-- tests/indices/query/test_query_bundle.py | 10 +-- .../indices/response/test_response_builder.py | 12 +-- tests/indices/struct_store/test_base.py | 18 ++-- tests/indices/struct_store/test_pandas.py | 8 +- tests/indices/struct_store/test_sql_query.py | 12 +-- tests/indices/test_loading.py | 23 ++--- tests/indices/test_loading_graph.py | 16 ++-- tests/indices/test_node_utils.py | 6 +- tests/indices/test_prompt_helper.py | 6 +- tests/indices/test_utils.py | 2 +- tests/indices/tree/conftest.py | 2 +- .../indices/tree/test_embedding_retriever.py | 18 ++-- tests/indices/tree/test_index.py | 14 ++-- tests/indices/tree/test_retrievers.py | 6 +- tests/indices/vector_store/conftest.py | 4 +- tests/indices/vector_store/mock_services.py | 2 +- tests/indices/vector_store/test_faiss.py | 14 ++-- tests/indices/vector_store/test_milvus.py | 8 +- tests/indices/vector_store/test_myscale.py | 12 +-- tests/indices/vector_store/test_pinecone.py | 10 +-- tests/indices/vector_store/test_retrievers.py | 14 ++-- tests/indices/vector_store/test_simple.py | 8 +- tests/indices/vector_store/test_weaviate.py | 8 +- tests/langchain_helpers/test_text_splitter.py | 2 +- tests/llm_predictor/test_base.py | 8 +- tests/logger/test_base.py | 2 +- tests/mock_utils/mock_predict.py | 8 +- tests/mock_utils/mock_prompts.py | 2 +- tests/mock_utils/mock_text_splitter.py | 2 +- tests/mock_utils/mock_utils.py | 2 +- tests/optimization/test_base.py | 6 +- tests/output_parsers/test_base.py | 2 +- tests/output_parsers/test_selection.py | 4 +- tests/playground/test_base.py | 16 ++-- tests/prompts/test_base.py | 2 +- tests/readers/test_file.py | 2 +- tests/readers/test_json.py | 2 +- tests/readers/test_mongo.py | 2 +- tests/readers/test_string_iterable.py | 2 +- tests/selectors/test_llm_selectors.py | 4 +- tests/storage/conftest.py | 4 +- tests/storage/docstore/test_mongo_docstore.py | 8 +- .../storage/docstore/test_simple_docstore.py | 8 +- tests/storage/kvstore/test_mongodb_kvstore.py | 2 +- tests/storage/kvstore/test_simple_kvstore.py | 2 +- tests/test_utils.py | 2 +- tests/token_predictor/test_base.py | 14 ++-- tests/vector_stores/test_qdrant.py | 6 +- tests/vector_stores/test_weaviate.py | 6 +- 441 files changed, 1514 insertions(+), 1590 deletions(-) delete mode 100644 MANIFEST_llama.in delete mode 100644 gpt_index/composability/__init__.py delete mode 100644 gpt_index/evaluation/__init__.py delete mode 100644 gpt_index/indices/__init__.py delete mode 100644 gpt_index/indices/empty/__init__.py delete mode 100644 gpt_index/indices/knowledge_graph/__init__.py delete mode 100644 gpt_index/indices/query/__init__.py delete mode 100644 gpt_index/indices/tree/__init__.py delete mode 100644 gpt_index/indices/vector_store/__init__.py delete mode 100644 gpt_index/llm_predictor/__init__.py delete mode 100644 gpt_index/logger/__init__.py delete mode 100644 gpt_index/node_parser/__init__.py delete mode 100644 gpt_index/optimization/__init__.py delete mode 100644 gpt_index/output_parsers/__init__.py delete mode 100644 gpt_index/prompts/__init__.py delete mode 100644 gpt_index/query_engine/__init__.py delete mode 100644 gpt_index/readers/__init__.py delete mode 100644 gpt_index/readers/chatgpt_plugin/__init__.py delete mode 100644 gpt_index/retrievers/__init__.py delete mode 100644 gpt_index/selectors/__init__.py delete mode 100644 gpt_index/storage/__init__.py delete mode 100644 gpt_index/storage/docstore/__init__.py delete mode 100644 gpt_index/storage/index_store/__init__.py delete mode 100644 gpt_index/storage/kvstore/__init__.py delete mode 100644 gpt_index/tools/__init__.py delete mode 100644 gpt_index/tts/__init__.py delete mode 100644 gpt_index/vector_stores/__init__.py rename {gpt_index => llama_index}/VERSION (100%) rename {gpt_index => llama_index}/__init__.py (65%) rename {gpt_index => llama_index}/async_utils.py (100%) rename {gpt_index => llama_index}/callbacks/__init__.py (100%) rename {gpt_index => llama_index}/callbacks/base.py (95%) rename {gpt_index => llama_index}/callbacks/llama_debug.py (95%) rename {gpt_index => llama_index}/callbacks/schema.py (100%) create mode 100644 llama_index/composability/__init__.py rename {gpt_index => llama_index}/composability/base.py (52%) rename {gpt_index => llama_index}/composability/joint_qa_summary.py (85%) rename {gpt_index => llama_index}/constants.py (100%) rename {gpt_index => llama_index}/data_structs/__init__.py (55%) rename {gpt_index => llama_index}/data_structs/data_structs.py (98%) rename {gpt_index => llama_index}/data_structs/data_structs_v2.py (98%) rename {gpt_index => llama_index}/data_structs/node_v2.py (99%) rename {gpt_index => llama_index}/data_structs/registry.py (74%) rename {gpt_index => llama_index}/data_structs/struct_type.py (100%) rename {gpt_index => llama_index}/data_structs/table.py (93%) rename {gpt_index => llama_index}/data_structs/table_v2.py (87%) rename {gpt_index => llama_index}/embeddings/__init__.py (100%) rename {gpt_index => llama_index}/embeddings/base.py (99%) rename {gpt_index => llama_index}/embeddings/google.py (95%) rename {gpt_index => llama_index}/embeddings/langchain.py (95%) rename {gpt_index => llama_index}/embeddings/openai.py (99%) rename {gpt_index => llama_index}/embeddings/utils.py (100%) create mode 100644 llama_index/evaluation/__init__.py rename {gpt_index => llama_index}/evaluation/base.py (99%) rename {gpt_index => llama_index}/evaluation/dataset_generation.py (96%) rename {gpt_index => llama_index}/experimental/evaporate/__init__.py (80%) rename {gpt_index => llama_index}/experimental/evaporate/base.py (96%) rename {gpt_index => llama_index}/experimental/evaporate/prompts.py (97%) rename {gpt_index => llama_index}/img_utils.py (100%) create mode 100644 llama_index/indices/__init__.py rename {gpt_index => llama_index}/indices/base.py (92%) rename {gpt_index => llama_index}/indices/base_retriever.py (85%) rename {gpt_index => llama_index}/indices/common/__init__.py (100%) rename {gpt_index => llama_index}/indices/common/struct_store/__init__.py (100%) rename {gpt_index => llama_index}/indices/common/struct_store/base.py (91%) rename {gpt_index => llama_index}/indices/common/struct_store/schema.py (100%) rename {gpt_index => llama_index}/indices/common/struct_store/sql.py (88%) rename {gpt_index => llama_index}/indices/common_tree/__init__.py (100%) rename {gpt_index => llama_index}/indices/common_tree/base.py (93%) rename {gpt_index => llama_index}/indices/composability/__init__.py (62%) rename {gpt_index => llama_index}/indices/composability/graph.py (90%) create mode 100644 llama_index/indices/empty/__init__.py rename {gpt_index => llama_index}/indices/empty/base.py (83%) rename {gpt_index => llama_index}/indices/empty/retrievers.py (68%) rename {gpt_index => llama_index}/indices/keyword_table/README.md (97%) rename {gpt_index => llama_index}/indices/keyword_table/__init__.py (54%) rename {gpt_index => llama_index}/indices/keyword_table/base.py (92%) rename {gpt_index => llama_index}/indices/keyword_table/rake_base.py (76%) rename {gpt_index => llama_index}/indices/keyword_table/retrievers.py (91%) rename {gpt_index => llama_index}/indices/keyword_table/simple_base.py (71%) rename {gpt_index => llama_index}/indices/keyword_table/utils.py (95%) create mode 100644 llama_index/indices/knowledge_graph/__init__.py rename {gpt_index => llama_index}/indices/knowledge_graph/base.py (95%) rename {gpt_index => llama_index}/indices/knowledge_graph/retrievers.py (93%) rename {gpt_index => llama_index}/indices/list/README.md (94%) rename {gpt_index => llama_index}/indices/list/__init__.py (64%) rename {gpt_index => llama_index}/indices/list/base.py (89%) rename {gpt_index => llama_index}/indices/list/retrievers.py (91%) rename {gpt_index => llama_index}/indices/loading.py (92%) rename {gpt_index => llama_index}/indices/postprocessor/__init__.py (73%) rename {gpt_index => llama_index}/indices/postprocessor/base.py (100%) rename {gpt_index => llama_index}/indices/postprocessor/node.py (95%) rename {gpt_index => llama_index}/indices/postprocessor/node_recency.py (97%) rename {gpt_index => llama_index}/indices/postprocessor/pii.py (94%) rename {gpt_index => llama_index}/indices/prompt_helper.py (96%) create mode 100644 llama_index/indices/query/__init__.py rename {gpt_index => llama_index}/indices/query/base.py (91%) rename {gpt_index => llama_index}/indices/query/embedding_utils.py (95%) rename {gpt_index => llama_index}/indices/query/query_transform/__init__.py (78%) rename {gpt_index => llama_index}/indices/query/query_transform/base.py (95%) rename {gpt_index => llama_index}/indices/query/query_transform/prompts.py (98%) rename {gpt_index => llama_index}/indices/query/response_synthesis.py (93%) rename {gpt_index => llama_index}/indices/query/schema.py (100%) rename {gpt_index => llama_index}/indices/registry.py (57%) rename {gpt_index => llama_index}/indices/response/__init__.py (71%) rename {gpt_index => llama_index}/indices/response/response_builder.py (96%) rename {gpt_index => llama_index}/indices/response/type.py (100%) rename {gpt_index => llama_index}/indices/service_context.py (85%) rename {gpt_index => llama_index}/indices/struct_store/__init__.py (58%) rename {gpt_index => llama_index}/indices/struct_store/base.py (82%) rename {gpt_index => llama_index}/indices/struct_store/container_builder.py (92%) rename {gpt_index => llama_index}/indices/struct_store/pandas.py (82%) rename {gpt_index => llama_index}/indices/struct_store/pandas_query.py (92%) rename {gpt_index => llama_index}/indices/struct_store/sql.py (87%) rename {gpt_index => llama_index}/indices/struct_store/sql_query.py (91%) rename {gpt_index => llama_index}/indices/tree/README.md (97%) create mode 100644 llama_index/indices/tree/__init__.py rename {gpt_index => llama_index}/indices/tree/all_leaf_retriever.py (77%) rename {gpt_index => llama_index}/indices/tree/base.py (83%) rename {gpt_index => llama_index}/indices/tree/inserter.py (92%) rename {gpt_index => llama_index}/indices/tree/select_leaf_embedding_retriever.py (95%) rename {gpt_index => llama_index}/indices/tree/select_leaf_retriever.py (95%) rename {gpt_index => llama_index}/indices/tree/tree_root_retriever.py (78%) rename {gpt_index => llama_index}/indices/utils.py (91%) create mode 100644 llama_index/indices/vector_store/__init__.py rename {gpt_index => llama_index}/indices/vector_store/base.py (92%) rename {gpt_index => llama_index}/indices/vector_store/retrievers.py (86%) rename {gpt_index => llama_index}/langchain_helpers/__init__.py (100%) rename {gpt_index => llama_index}/langchain_helpers/agents/__init__.py (63%) rename {gpt_index => llama_index}/langchain_helpers/agents/agents.py (97%) rename {gpt_index => llama_index}/langchain_helpers/agents/toolkits.py (93%) rename {gpt_index => llama_index}/langchain_helpers/agents/tools.py (94%) rename {gpt_index => llama_index}/langchain_helpers/chain_wrapper.py (56%) rename {gpt_index => llama_index}/langchain_helpers/memory_wrapper.py (98%) rename {gpt_index => llama_index}/langchain_helpers/sql_wrapper.py (100%) rename {gpt_index => llama_index}/langchain_helpers/text_splitter.py (99%) create mode 100644 llama_index/llm_predictor/__init__.py rename {gpt_index => llama_index}/llm_predictor/base.py (98%) rename {gpt_index => llama_index}/llm_predictor/chatgpt.py (95%) rename {gpt_index => llama_index}/llm_predictor/stable_lm.py (97%) rename {gpt_index => llama_index}/llm_predictor/structured.py (95%) create mode 100644 llama_index/logger/__init__.py rename {gpt_index => llama_index}/logger/base.py (100%) create mode 100644 llama_index/node_parser/__init__.py rename {gpt_index => llama_index}/node_parser/interface.py (80%) rename {gpt_index => llama_index}/node_parser/node_utils.py (91%) rename {gpt_index => llama_index}/node_parser/simple.py (82%) create mode 100644 llama_index/optimization/__init__.py rename {gpt_index => llama_index}/optimization/optimizer.py (92%) create mode 100644 llama_index/output_parsers/__init__.py rename {gpt_index => llama_index}/output_parsers/base.py (100%) rename {gpt_index => llama_index}/output_parsers/guardrails.py (97%) rename {gpt_index => llama_index}/output_parsers/langchain.py (96%) rename {gpt_index => llama_index}/output_parsers/selection.py (94%) rename {gpt_index => llama_index}/playground/__init__.py (55%) rename {gpt_index => llama_index}/playground/base.py (95%) create mode 100644 llama_index/prompts/__init__.py rename {gpt_index => llama_index}/prompts/base.py (98%) rename {gpt_index => llama_index}/prompts/chat_prompts.py (95%) rename {gpt_index => llama_index}/prompts/default_prompt_selectors.py (84%) rename {gpt_index => llama_index}/prompts/default_prompts.py (99%) rename {gpt_index => llama_index}/prompts/prompt_type.py (100%) rename {gpt_index => llama_index}/prompts/prompts.py (98%) rename {gpt_index => llama_index}/py.typed (100%) create mode 100644 llama_index/query_engine/__init__.py rename {gpt_index => llama_index}/query_engine/graph_query_engine.py (91%) rename {gpt_index => llama_index}/query_engine/multistep_query_engine.py (93%) rename {gpt_index => llama_index}/query_engine/retriever_query_engine.py (88%) rename {gpt_index => llama_index}/query_engine/router_query_engine.py (85%) rename {gpt_index => llama_index}/query_engine/transform_query_engine.py (89%) create mode 100644 llama_index/readers/__init__.py rename {gpt_index => llama_index}/readers/base.py (91%) create mode 100644 llama_index/readers/chatgpt_plugin/__init__.py rename {gpt_index => llama_index}/readers/chatgpt_plugin/base.py (95%) rename {gpt_index => llama_index}/readers/chroma.py (97%) rename {gpt_index => llama_index}/readers/database.py (94%) rename {gpt_index => llama_index}/readers/deeplake.py (97%) rename {gpt_index => llama_index}/readers/discord_reader.py (97%) rename {gpt_index => llama_index}/readers/download.py (97%) rename {gpt_index => llama_index}/readers/elasticsearch.py (95%) rename {gpt_index => llama_index}/readers/faiss.py (95%) rename {gpt_index => llama_index}/readers/file/__init__.py (100%) rename {gpt_index => llama_index}/readers/file/base.py (90%) rename {gpt_index => llama_index}/readers/file/base_parser.py (100%) rename {gpt_index => llama_index}/readers/file/docs_parser.py (96%) rename {gpt_index => llama_index}/readers/file/epub_parser.py (95%) rename {gpt_index => llama_index}/readers/file/image_caption_parser.py (95%) rename {gpt_index => llama_index}/readers/file/image_parser.py (96%) rename {gpt_index => llama_index}/readers/file/image_vision_llm_parser.py (95%) rename {gpt_index => llama_index}/readers/file/ipynb_parser.py (94%) rename {gpt_index => llama_index}/readers/file/markdown_parser.py (98%) rename {gpt_index => llama_index}/readers/file/mbox_parser.py (98%) rename {gpt_index => llama_index}/readers/file/slides_parser.py (98%) rename {gpt_index => llama_index}/readers/file/tabular_parser.py (98%) rename {gpt_index => llama_index}/readers/file/video_audio.py (96%) rename {gpt_index => llama_index}/readers/github_readers/__init__.py (100%) rename {gpt_index => llama_index}/readers/github_readers/github_api_client.py (100%) rename {gpt_index => llama_index}/readers/github_readers/github_repository_reader.py (97%) rename {gpt_index => llama_index}/readers/github_readers/utils.py (98%) rename {gpt_index => llama_index}/readers/google_readers/__init__.py (100%) rename {gpt_index => llama_index}/readers/google_readers/gdocs.py (98%) rename {gpt_index => llama_index}/readers/google_readers/gsheets.py (97%) rename {gpt_index => llama_index}/readers/json.py (97%) rename {gpt_index => llama_index}/readers/make_com/__init__.py (100%) rename {gpt_index => llama_index}/readers/make_com/wrapper.py (87%) rename {gpt_index => llama_index}/readers/mbox.py (87%) rename {gpt_index => llama_index}/readers/milvus.py (97%) rename {gpt_index => llama_index}/readers/mongo.py (96%) rename {gpt_index => llama_index}/readers/myscale.py (98%) rename {gpt_index => llama_index}/readers/notion.py (98%) rename {gpt_index => llama_index}/readers/obsidian.py (89%) rename {gpt_index => llama_index}/readers/pinecone.py (96%) rename {gpt_index => llama_index}/readers/qdrant.py (97%) rename {gpt_index => llama_index}/readers/schema/__init__.py (100%) rename {gpt_index => llama_index}/readers/schema/base.py (96%) rename {gpt_index => llama_index}/readers/slack.py (98%) rename {gpt_index => llama_index}/readers/steamship/__init__.py (100%) rename {gpt_index => llama_index}/readers/steamship/file_reader.py (97%) rename {gpt_index => llama_index}/readers/string_iterable.py (83%) rename {gpt_index => llama_index}/readers/twitter.py (94%) rename {gpt_index => llama_index}/readers/weaviate/__init__.py (100%) rename {gpt_index => llama_index}/readers/weaviate/client.py (96%) rename {gpt_index => llama_index}/readers/weaviate/reader.py (97%) rename {gpt_index => llama_index}/readers/weaviate/utils.py (97%) rename {gpt_index => llama_index}/readers/web.py (98%) rename {gpt_index => llama_index}/readers/wikipedia.py (89%) rename {gpt_index => llama_index}/readers/youtube_transcript.py (91%) rename {gpt_index => llama_index}/response/__init__.py (100%) rename {gpt_index => llama_index}/response/notebook_utils.py (89%) rename {gpt_index => llama_index}/response/schema.py (96%) rename {gpt_index => llama_index}/response/utils.py (100%) create mode 100644 llama_index/retrievers/__init__.py rename {gpt_index => llama_index}/retrievers/transform_retriever.py (76%) rename {gpt_index => llama_index}/schema.py (98%) create mode 100644 llama_index/selectors/__init__.py rename {gpt_index => llama_index}/selectors/llm_selectors.py (93%) rename {gpt_index => llama_index}/selectors/prompts.py (95%) rename {gpt_index => llama_index}/selectors/types.py (94%) create mode 100644 llama_index/storage/__init__.py create mode 100644 llama_index/storage/docstore/__init__.py rename {gpt_index => llama_index}/storage/docstore/keyval_docstore.py (95%) rename {gpt_index => llama_index}/storage/docstore/mongo_docstore.py (89%) rename {gpt_index => llama_index}/storage/docstore/registry.py (72%) rename {gpt_index => llama_index}/storage/docstore/simple_docstore.py (88%) rename {gpt_index => llama_index}/storage/docstore/types.py (96%) rename {gpt_index => llama_index}/storage/docstore/utils.py (75%) create mode 100644 llama_index/storage/index_store/__init__.py rename {gpt_index => llama_index}/storage/index_store/keyval_index_store.py (89%) rename {gpt_index => llama_index}/storage/index_store/mongo_index_store.py (89%) rename {gpt_index => llama_index}/storage/index_store/simple_index_store.py (82%) rename {gpt_index => llama_index}/storage/index_store/types.py (92%) rename {gpt_index => llama_index}/storage/index_store/utils.py (68%) create mode 100644 llama_index/storage/kvstore/__init__.py rename {gpt_index => llama_index}/storage/kvstore/mongodb_kvstore.py (98%) rename {gpt_index => llama_index}/storage/kvstore/simple_kvstore.py (97%) rename {gpt_index => llama_index}/storage/kvstore/types.py (100%) rename {gpt_index => llama_index}/storage/storage_context.py (79%) rename {gpt_index => llama_index}/token_counter/__init__.py (100%) rename {gpt_index => llama_index}/token_counter/mock_chain_wrapper.py (93%) rename {gpt_index => llama_index}/token_counter/mock_embed_model.py (92%) rename {gpt_index => llama_index}/token_counter/token_counter.py (97%) rename {gpt_index => llama_index}/token_counter/utils.py (91%) create mode 100644 llama_index/tools/__init__.py rename {gpt_index => llama_index}/tools/query_engine.py (92%) rename {gpt_index => llama_index}/tools/types.py (100%) create mode 100644 llama_index/tts/__init__.py rename {gpt_index => llama_index}/tts/bark.py (98%) rename {gpt_index => llama_index}/tts/base.py (100%) rename {gpt_index => llama_index}/tts/elevenlabs.py (96%) rename {gpt_index => llama_index}/types.py (100%) rename {gpt_index => llama_index}/utils.py (100%) create mode 100644 llama_index/vector_stores/__init__.py rename {gpt_index => llama_index}/vector_stores/chatgpt_plugin.py (97%) rename {gpt_index => llama_index}/vector_stores/chroma.py (95%) rename {gpt_index => llama_index}/vector_stores/deeplake.py (98%) rename {gpt_index => llama_index}/vector_stores/faiss.py (98%) rename {gpt_index => llama_index}/vector_stores/milvus.py (99%) rename {gpt_index => llama_index}/vector_stores/myscale.py (96%) rename {gpt_index => llama_index}/vector_stores/opensearch.py (98%) rename {gpt_index => llama_index}/vector_stores/pinecone.py (98%) rename {gpt_index => llama_index}/vector_stores/qdrant.py (97%) rename {gpt_index => llama_index}/vector_stores/registry.py (60%) rename {gpt_index => llama_index}/vector_stores/simple.py (97%) rename {gpt_index => llama_index}/vector_stores/types.py (97%) rename {gpt_index => llama_index}/vector_stores/weaviate.py (95%) delete mode 100644 scripts/create_llama_package.sh create mode 100644 scripts/publish_gpt_index_package.sh delete mode 100644 scripts/publish_llama_package.sh delete mode 100644 setup_llama.py diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 6f1a0a2ffd565..509bae6797920 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -36,5 +36,5 @@ jobs: - name: Test import working-directory: ${{ vars.RUNNER_TEMP }} run: | - python -c "import gpt_index" + python -c "import llama_index" \ No newline at end of file diff --git a/.github/workflows/dev_docs.yml b/.github/workflows/dev_docs.yml index f0b2e907ffde9..4e20610f975f7 100644 --- a/.github/workflows/dev_docs.yml +++ b/.github/workflows/dev_docs.yml @@ -15,7 +15,7 @@ jobs: with: source-directory: './docs' destination-github-username: 'avb-is-me' - destination-repository-name: 'gpt_index' + destination-repository-name: 'llama_index' user-email: github-actions[bot]@users.noreply.github.com target-branch: main target-directory: docs \ No newline at end of file diff --git a/CITATION.cff b/CITATION.cff index 8c0ad930f5d60..0b21893e6b5bb 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -7,4 +7,4 @@ authors: title: "LlamaIndex" doi: 10.5281/zenodo.1234 date-released: 2022-11-1 -url: "https://github.com/jerryjliu/gpt_index" \ No newline at end of file +url: "https://github.com/jerryjliu/llama_index" \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 731ee109c60c8..f675d2080361c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,7 +55,7 @@ It is responsible for splitting text (via text splitters) and explicitly modelli **Interface**: `get_nodes_from_documents` takes a sequence of `Document` objects as input, and outputs a sequence of `Node` objects. **Examples**: -* [Simple Node Parser](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/node_parser/simple.py) +* [Simple Node Parser](https://github.com/jerryjliu/llama_index/blob/main/llama_index/node_parser/simple.py) See [the API reference](https://gpt-index.readthedocs.io/en/latest/reference/node_parser.html) for full details. @@ -69,8 +69,8 @@ Text splitter splits a long text `str` into smaller text `str` chunks with desir **Interface**: `split_text` takes a `str` as input, and outputs a sequence of `str` **Examples**: -* [Token Text Splitter](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/langchain_helpers/text_splitter.py#L23) -* [Sentence Splitter](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/langchain_helpers/text_splitter.py#L239) +* [Token Text Splitter](https://github.com/jerryjliu/llama_index/blob/main/llama_index/langchain_helpers/text_splitter.py#L23) +* [Sentence Splitter](https://github.com/jerryjliu/llama_index/blob/main/llama_index/langchain_helpers/text_splitter.py#L239) --- @@ -95,9 +95,9 @@ These serve as the main data store and retrieval engine for our vector index. * `query` retrieves top-k most similar entries given a query embedding. **Examples**: -* [Pinecone](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/vector_stores/pinecone.py) -* [Faiss](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/vector_stores/faiss.py) -* [Chroma](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/vector_stores/chroma.py) +* [Pinecone](https://github.com/jerryjliu/llama_index/blob/main/llama_index/vector_stores/pinecone.py) +* [Faiss](https://github.com/jerryjliu/llama_index/blob/main/llama_index/vector_stores/faiss.py) +* [Chroma](https://github.com/jerryjliu/llama_index/blob/main/llama_index/vector_stores/chroma.py) **Ideas**: * See a vector database out there that we don't support yet? Make a PR! @@ -119,9 +119,9 @@ data if you wish. - `retrieve` takes in a `str` or `QueryBundle` as input, and outputs a list of `NodeWithScore` objects **Examples**: -* [Vector Index Retriever](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/indices/vector_store/retrievers.py) -* [List Index Retriever](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/indices/list/retrievers.py) -* [Transform Retriever](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/retrievers/transform_retriever.py) +* [Vector Index Retriever](https://github.com/jerryjliu/llama_index/blob/main/llama_index/indices/vector_store/retrievers.py) +* [List Index Retriever](https://github.com/jerryjliu/llama_index/blob/main/llama_index/indices/list/retrievers.py) +* [Transform Retriever](https://github.com/jerryjliu/llama_index/blob/main/llama_index/retrievers/transform_retriever.py) **Ideas**: * Besides the "default" retrievers built on top of each index, what about fancier retrievers? E.g. retrievers that take in other retrivers as input? Or other @@ -141,8 +141,8 @@ They may take in other query engine classes in as input too. - `query` takes in a `str` or `QueryBundle` as input, and outputs a `Response` object. **Examples**: -- [Retriever Query Engine](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/query_engine/retriever_query_engine.py) -- [Transform Query Engine](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/query_engine/transform_query_engine.py) +- [Retriever Query Engine](https://github.com/jerryjliu/llama_index/blob/main/llama_index/query_engine/retriever_query_engine.py) +- [Transform Query Engine](https://github.com/jerryjliu/llama_index/blob/main/llama_index/query_engine/transform_query_engine.py) --- @@ -153,8 +153,8 @@ This can interpreted as a pre-processing stage, before the core index query logi **Interface**: `run` takes in a `str` or `Querybundle` as input, and outputs a transformed `QueryBundle`. **Examples**: -* [Hypothetical Document Embeddings](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/indices/query/query_transform/base.py#L77) -* [Query Decompose](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/indices/query/query_transform/base.py#L124) +* [Hypothetical Document Embeddings](https://github.com/jerryjliu/llama_index/blob/main/llama_index/indices/query/query_transform/base.py#L77) +* [Query Decompose](https://github.com/jerryjliu/llama_index/blob/main/llama_index/indices/query/query_transform/base.py#L124) See [guide](https://gpt-index.readthedocs.io/en/latest/how_to/query/query_transformations.html#hyde-hypothetical-document-embeddings) for more information. @@ -165,7 +165,7 @@ A token usage optimizer refines the retrieved `Nodes` to reduce token usage duri **Interface**: `optimize` takes in the `QueryBundle` and a text chunk `str`, and outputs a refined text chunk `str` that yeilds a more optimized response **Examples**: -* [Sentence Embedding Optimizer](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/optimization/optimizer.py) +* [Sentence Embedding Optimizer](https://github.com/jerryjliu/llama_index/blob/main/llama_index/optimization/optimizer.py) --- #### Node Postprocessors @@ -175,9 +175,9 @@ A node postprocessor refines a list of retrieve nodes given configuration and co **Examples**: -* [Keyword Postprocessor](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/indices/postprocessor/node.py#L32): filters nodes based on keyword match -* [Similarity Postprocessor](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/indices/postprocessor/node.py#L62): filers nodes based on similarity threshold -* [Prev Next Postprocessor](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/indices/postprocessor/node.py#L135): fetchs additional nodes to augment context based on node relationships. +* [Keyword Postprocessor](https://github.com/jerryjliu/llama_index/blob/main/llama_index/indices/postprocessor/node.py#L32): filters nodes based on keyword match +* [Similarity Postprocessor](https://github.com/jerryjliu/llama_index/blob/main/llama_index/indices/postprocessor/node.py#L62): filers nodes based on similarity threshold +* [Prev Next Postprocessor](https://github.com/jerryjliu/llama_index/blob/main/llama_index/indices/postprocessor/node.py#L135): fetchs additional nodes to augment context based on node relationships. --- #### Output Parsers @@ -188,15 +188,15 @@ A output parser enables us to extract structured output from the plain text outp * `parse`: takes a `str` (from LLM response) as input, and gives a parsed tructured output (optionally also validated, error-corrected). **Examples**: -* [Guardrails Output Parser](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/output_parsers/guardrails.py) -* [Langchain Output Parser](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/output_parsers/langchain.py) +* [Guardrails Output Parser](https://github.com/jerryjliu/llama_index/blob/main/llama_index/output_parsers/guardrails.py) +* [Langchain Output Parser](https://github.com/jerryjliu/llama_index/blob/main/llama_index/output_parsers/langchain.py) See [guide](https://gpt-index.readthedocs.io/en/latest/how_to/output_parsing.html) for more information. --- ### 2. 🐛 Fix Bugs -Most bugs are reported and tracked in the [Github Issues Page](https://github.com/jerryjliu/gpt_index/issues). +Most bugs are reported and tracked in the [Github Issues Page](https://github.com/jerryjliu/llama_index/issues). We try our best in triaging and tagging these issues: * Issues tagged as `bug` are confirmed bugs. * New contributors may want to start with issues tagged with `good first issue`. @@ -222,7 +222,7 @@ We would love your help in making the project cleaner, more robust, and more und LlamaIndex is a Python package. We've tested primarily with Python versions >= 3.8. Here's a quick and dirty guide to getting your environment setup. -First, create a fork of LlamaIndex, by clicking the "Fork" button on the [LlamaIndex Github page](https://github.com/jerryjliu/gpt_index). +First, create a fork of LlamaIndex, by clicking the "Fork" button on the [LlamaIndex Github page](https://github.com/jerryjliu/llama_index). Following [these steps](https://docs.github.com/en/get-started/quickstart/fork-a-repo) for more details on how to fork the repo and clone the forked repo. @@ -284,7 +284,7 @@ pytest tests For changes that involve entirely new features, it may be worth adding an example Jupyter notebook to showcase this feature. -Example notebooks can be found in this folder: https://github.com/jerryjliu/gpt_index/tree/main/examples. +Example notebooks can be found in this folder: https://github.com/jerryjliu/llama_index/tree/main/examples. ### Creating a pull request diff --git a/MANIFEST.in b/MANIFEST.in index 567a63cc13b0b..c39cc34f396dd 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ -include gpt_index/py.typed -include gpt_index/VERSION +include llama_index/py.typed +include llama_index/VERSION include LICENSE \ No newline at end of file diff --git a/MANIFEST_llama.in b/MANIFEST_llama.in deleted file mode 100644 index a17f70bda11d6..0000000000000 --- a/MANIFEST_llama.in +++ /dev/null @@ -1,3 +0,0 @@ -include llama_index/py.typed -include llama_index/VERSION -include LICENSE diff --git a/Makefile b/Makefile index 9cded5de17de8..f53ef67ae9160 100644 --- a/Makefile +++ b/Makefile @@ -15,4 +15,4 @@ test: # Docs watch-docs: ## Build and watch documentation - sphinx-autobuild docs/ docs/_build/html --open-browser --watch $(GIT_ROOT)/gpt_index/ + sphinx-autobuild docs/ docs/_build/html --open-browser --watch $(GIT_ROOT)/llama_index/ diff --git a/benchmarks/struct_indices/spider/evaluate.py b/benchmarks/struct_indices/spider/evaluate.py index 0c29e8a14425d..aaeb33115bd22 100644 --- a/benchmarks/struct_indices/spider/evaluate.py +++ b/benchmarks/struct_indices/spider/evaluate.py @@ -8,11 +8,11 @@ from langchain.chat_models import ChatOpenAI from langchain.schema import HumanMessage -from gpt_index.response.schema import Response +from llama_index.response.schema import Response from spider_utils import create_indexes, load_examples from tqdm import tqdm -from gpt_index.indices.struct_store.sql import GPTSQLStructStoreIndex, SQLQueryMode +from llama_index.indices.struct_store.sql import GPTSQLStructStoreIndex, SQLQueryMode logging.getLogger("root").setLevel(logging.WARNING) diff --git a/benchmarks/struct_indices/spider/generate_sql.py b/benchmarks/struct_indices/spider/generate_sql.py index 6024998fa57e8..9202c08456595 100644 --- a/benchmarks/struct_indices/spider/generate_sql.py +++ b/benchmarks/struct_indices/spider/generate_sql.py @@ -11,7 +11,7 @@ from sqlalchemy import create_engine, text from tqdm import tqdm -from gpt_index import GPTSQLStructStoreIndex, LLMPredictor, SQLDatabase +from llama_index import GPTSQLStructStoreIndex, LLMPredictor, SQLDatabase from typing import Any, cast logging.getLogger("root").setLevel(logging.WARNING) diff --git a/benchmarks/struct_indices/spider/spider_utils.py b/benchmarks/struct_indices/spider/spider_utils.py index 12d0111c65f0d..9da13a4b2fcd6 100644 --- a/benchmarks/struct_indices/spider/spider_utils.py +++ b/benchmarks/struct_indices/spider/spider_utils.py @@ -8,7 +8,7 @@ from langchain.chat_models import ChatOpenAI from sqlalchemy import create_engine, text -from gpt_index import GPTSQLStructStoreIndex, LLMPredictor, SQLDatabase +from llama_index import GPTSQLStructStoreIndex, LLMPredictor, SQLDatabase def load_examples(spider_dir: str) -> Tuple[list, list]: diff --git a/docs/conf.py b/docs/conf.py index 3dfd86eecd9aa..ecac8cd64139b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,7 +17,7 @@ sys.path.insert(0, os.path.abspath("../")) -with open("../gpt_index/VERSION") as f: +with open("../llama_index/VERSION") as f: version = f.read() # -- Project information ----------------------------------------------------- diff --git a/docs/getting_started/installation.md b/docs/getting_started/installation.md index 1dac3c06eb9ae..03cb10c927354 100644 --- a/docs/getting_started/installation.md +++ b/docs/getting_started/installation.md @@ -8,7 +8,7 @@ pip install llama-index ``` ### Installation from Source -Git clone this repository: `git clone git@github.com:jerryjliu/gpt_index.git`. Then do: +Git clone this repository: `git clone git@github.com:jerryjliu/llama_index.git`. Then do: - `pip install -e .` if you want to do an editable install (you can modify source files) of just the package itself. - `pip install -r requirements.txt` if you want to install optional dependencies + dependencies used for development (e.g. unit testing). diff --git a/docs/getting_started/starter_example.md b/docs/getting_started/starter_example.md index 9858f4b09e584..7be455140d3eb 100644 --- a/docs/getting_started/starter_example.md +++ b/docs/getting_started/starter_example.md @@ -8,18 +8,18 @@ LlamaIndex examples can be found in the `examples` folder of the LlamaIndex repo We first want to download this `examples` folder. An easy way to do this is to just clone the repo: ```bash -$ git clone https://github.com/jerryjliu/gpt_index.git +$ git clone https://github.com/jerryjliu/llama_index.git ``` Next, navigate to your newly-cloned repository, and verify the contents: ```bash -$ cd gpt_index +$ cd llama_index $ ls LICENSE data_requirements.txt tests/ MANIFEST.in examples/ pyproject.toml Makefile experimental/ requirements.txt -README.md gpt_index/ setup.py +README.md llama_index/ setup.py ``` We now want to navigate to the following folder: diff --git a/docs/guides/notebooks.rst b/docs/guides/notebooks.rst index 5fae146bab339..28bf266f59ff9 100644 --- a/docs/guides/notebooks.rst +++ b/docs/guides/notebooks.rst @@ -3,4 +3,4 @@ Notebooks We offer a wide variety of example notebooks. They are referenced throughout the documentation. -Example notebooks are found `here `_. \ No newline at end of file +Example notebooks are found `here `_. \ No newline at end of file diff --git a/docs/guides/tutorials/building_a_chatbot.md b/docs/guides/tutorials/building_a_chatbot.md index 166efe7d41b65..7b59d14caef7e 100644 --- a/docs/guides/tutorials/building_a_chatbot.md +++ b/docs/guides/tutorials/building_a_chatbot.md @@ -150,7 +150,7 @@ decompose_transform = DecomposeQueryTransform( ) # define custom retrievers -from gpt_index.query_engine.transform_query_engine import TransformQueryEngine +from llama_index.query_engine.transform_query_engine import TransformQueryEngine custom_query_engines = {} for index in index_set.values(): diff --git a/docs/guides/tutorials/sql_guide.md b/docs/guides/tutorials/sql_guide.md index 3e0cf58524183..345ba4bd3c246 100644 --- a/docs/guides/tutorials/sql_guide.md +++ b/docs/guides/tutorials/sql_guide.md @@ -230,8 +230,8 @@ stores the context on the generated context container. You can then build the context container, and pass it to the index during query-time! ```python -from gpt_index import GPTSQLStructStoreIndex, SQLDatabase, GPTVectorStoreIndex -from gpt_index.indices.struct_store import SQLContextContainerBuilder +from llama_index import GPTSQLStructStoreIndex, SQLDatabase, GPTVectorStoreIndex +from llama_index.indices.struct_store import SQLContextContainerBuilder sql_database = SQLDatabase(engine) # build a vector index from the table schema information diff --git a/docs/guides/tutorials/terms_definitions_tutorial.md b/docs/guides/tutorials/terms_definitions_tutorial.md index 701a7c9bb7169..86cf4718b49aa 100644 --- a/docs/guides/tutorials/terms_definitions_tutorial.md +++ b/docs/guides/tutorials/terms_definitions_tutorial.md @@ -300,7 +300,7 @@ If you play around with the app a bit now, you might notice that it stopped foll This is due to the concept of "refining" answers in Llama Index. Since we are querying across the top 5 matching results, sometimes all the results do not fit in a single prompt! OpenAI models typically have a max input size of 4097 tokens. So, Llama Index accounts for this by breaking up the matching results into chunks that will fit into the prompt. After Llama Index gets an initial answer from the first API call, it sends the next chunk to the API, along with the previous answer, and asks the model to refine that answer. -So, the refine process seems to be messing with our results! Rather than appending extra instructions to the `query_str`, remove that, and Llama Index will let us provide our own custom prompts! Let's create those now, using the [default prompts](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/prompts/default_prompts.py) and [chat specific prompts](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/prompts/chat_prompts.py) as a guide. Using a new file `constants.py`, let's create some new query templates: +So, the refine process seems to be messing with our results! Rather than appending extra instructions to the `query_str`, remove that, and Llama Index will let us provide our own custom prompts! Let's create those now, using the [default prompts](https://github.com/jerryjliu/llama_index/blob/main/llama_index/prompts/default_prompts.py) and [chat specific prompts](https://github.com/jerryjliu/llama_index/blob/main/llama_index/prompts/chat_prompts.py) as a guide. Using a new file `constants.py`, let's create some new query templates: ```python from langchain.chains.prompt_selector import ConditionalPromptSelector, is_chat_model diff --git a/docs/guides/tutorials/unified_query.md b/docs/guides/tutorials/unified_query.md index 6ca2a6452db88..740712d6237e1 100644 --- a/docs/guides/tutorials/unified_query.md +++ b/docs/guides/tutorials/unified_query.md @@ -67,7 +67,7 @@ that solves a distinct use case. We will first define a vector index over the documents of each city. ```python -from gpt_index import GPTVectorStoreIndex, ServiceContext, StorageContext +from llama_index import GPTVectorStoreIndex, ServiceContext, StorageContext from langchain.llms.openai import OpenAIChat # set service context @@ -127,7 +127,7 @@ Next, we compose a keyword table on top of these vector indexes, with these inde ```python -from gpt_index.indices.composability import ComposableGraph +from llama_index.indices.composability import ComposableGraph graph = ComposableGraph.from_indices( GPTSimpleKeywordTableIndex, @@ -152,13 +152,13 @@ An example is shown below. ```python # define decompose_transform -from gpt_index.indices.query.query_transform.base import DecomposeQueryTransform +from llama_index.indices.query.query_transform.base import DecomposeQueryTransform decompose_transform = DecomposeQueryTransform( llm_predictor_chatgpt, verbose=True ) # define custom query engines -from gpt_index.query_engine.transform_query_engine import TransformQueryEngine +from llama_index.query_engine.transform_query_engine import TransformQueryEngine custom_query_engines = {} for index in vector_indices.values(): query_engine = index.as_query_engine(service_context=service_context) @@ -204,7 +204,7 @@ First, we define the query engines for the set of indexes/graph that we want to ```python -from gpt_index.tools.query_engine import QueryEngineTool +from llama_index.tools.query_engine import QueryEngineTool query_engine_tools = [] @@ -231,8 +231,8 @@ Now, we can define the routing logic and overall router query engine. Here, we use the `LLMSingleSelector`, which uses LLM to choose a underlying query engine to route the query to. ```python -from gpt_index.query_engine.router_query_engine import RouterQueryEngine -from gpt_index.selectors.llm_selectors import LLMSingleSelector +from llama_index.query_engine.router_query_engine import RouterQueryEngine +from llama_index.selectors.llm_selectors import LLMSingleSelector router_query_engine = RouterQueryEngine( diff --git a/docs/how_to/analysis/cost_analysis.md b/docs/how_to/analysis/cost_analysis.md index c1c30c932b491..5bda4f327712e 100644 --- a/docs/how_to/analysis/cost_analysis.md +++ b/docs/how_to/analysis/cost_analysis.md @@ -116,4 +116,4 @@ response = query_engine.query( ``` -[Here is an example notebook](https://github.com/jerryjliu/gpt_index/blob/main/examples/cost_analysis/TokenPredictor.ipynb). \ No newline at end of file +[Here is an example notebook](https://github.com/jerryjliu/llama_index/blob/main/examples/cost_analysis/TokenPredictor.ipynb). \ No newline at end of file diff --git a/docs/how_to/customization/custom_llms.md b/docs/how_to/customization/custom_llms.md index 9d821060e33d8..f6ee72e5b9df2 100644 --- a/docs/how_to/customization/custom_llms.md +++ b/docs/how_to/customization/custom_llms.md @@ -197,4 +197,4 @@ Using this method, you can use any LLM. Maybe you have one running locally, or r Note that you may have to adjust the internal prompts to get good performance. Even then, you should be using a sufficiently large LLM to ensure it's capable of handling the complex queries that LlamaIndex uses internally, so your mileage may vary. -A list of all default internal prompts is available [here](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/prompts/default_prompts.py), and chat-specific prompts are listed [here](https://github.com/jerryjliu/llama_index/blob/main/gpt_index/prompts/chat_prompts.py). You can also implement your own custom prompts, as described [here](https://gpt-index.readthedocs.io/en/latest/how_to/customization/custom_prompts.html). +A list of all default internal prompts is available [here](https://github.com/jerryjliu/llama_index/blob/main/llama_index/prompts/default_prompts.py), and chat-specific prompts are listed [here](https://github.com/jerryjliu/llama_index/blob/main/llama_index/prompts/chat_prompts.py). You can also implement your own custom prompts, as described [here](https://gpt-index.readthedocs.io/en/latest/how_to/customization/custom_prompts.html). diff --git a/docs/how_to/customization/custom_prompts.md b/docs/how_to/customization/custom_prompts.md index e57011bb5e639..3e4501a1d223a 100644 --- a/docs/how_to/customization/custom_prompts.md +++ b/docs/how_to/customization/custom_prompts.md @@ -24,7 +24,7 @@ contains optional prompts that the user may pass in. ### Example -An example can be found in [this notebook](https://github.com/jerryjliu/gpt_index/blob/main/examples/paul_graham_essay/TestEssay.ipynb). +An example can be found in [this notebook](https://github.com/jerryjliu/llama_index/blob/main/examples/paul_graham_essay/TestEssay.ipynb). A corresponding snippet is below. We show how to define a custom `QuestionAnswer` prompt which diff --git a/docs/how_to/customization/embeddings.md b/docs/how_to/customization/embeddings.md index 59d2fd8e53b60..a5a1cec44b27b 100644 --- a/docs/how_to/customization/embeddings.md +++ b/docs/how_to/customization/embeddings.md @@ -48,7 +48,7 @@ For the tree index (`GPTTreeIndex`): **Example Notebook** -An example notebook is given [here](https://github.com/jerryjliu/gpt_index/blob/main/examples/test_wiki/TestNYC_Embeddings.ipynb). +An example notebook is given [here](https://github.com/jerryjliu/llama_index/blob/main/examples/test_wiki/TestNYC_Embeddings.ipynb). diff --git a/docs/how_to/evaluation/evaluation.md b/docs/how_to/evaluation/evaluation.md index cf265fac07637..32d04cabe1c54 100644 --- a/docs/how_to/evaluation/evaluation.md +++ b/docs/how_to/evaluation/evaluation.md @@ -26,8 +26,8 @@ and also get a response list across sources to see which sources match. This mode of evaluation will return "YES"/"NO" if the synthesized response matches any source context. ```python -from gpt_index import GPTVectorStoreIndex -from gpt_index.evaluation import ResponseEvaluator +from llama_index import GPTVectorStoreIndex +from llama_index.evaluation import ResponseEvaluator # build service context llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0, model_name="gpt-4")) @@ -61,8 +61,8 @@ You'll get back either a `YES` or `NO` response. This mode of evaluation will return "YES"/"NO" for every source node. ```python -from gpt_index import GPTVectorStoreIndex -from gpt_index.evaluation import ResponseEvaluator +from llama_index import GPTVectorStoreIndex +from llama_index.evaluation import ResponseEvaluator # build service context llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0, model_name="gpt-4")) @@ -105,8 +105,8 @@ if it matches the query. This mode of evaluation will return "YES"/"NO" if the synthesized response matches the query + any source context. ```python -from gpt_index import GPTVectorStoreIndex -from gpt_index.evaluation import QueryResponseEvaluator +from llama_index import GPTVectorStoreIndex +from llama_index.evaluation import QueryResponseEvaluator # build service context llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0, model_name="gpt-4")) @@ -136,8 +136,8 @@ print(str(eval_result)) This mode of evaluation will look at each source node, and see if each source node contains an answer to the query. ```python -from gpt_index import GPTVectorStoreIndex -from gpt_index.evaluation import QueryResponseEvaluator +from llama_index import GPTVectorStoreIndex +from llama_index.evaluation import QueryResponseEvaluator # build service context llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0, model_name="gpt-4")) diff --git a/docs/how_to/index_structs/composability.md b/docs/how_to/index_structs/composability.md index 9941f091604a7..945468b30fa8f 100644 --- a/docs/how_to/index_structs/composability.md +++ b/docs/how_to/index_structs/composability.md @@ -113,4 +113,4 @@ NOTE: You can stack indices as many times as you want, depending on the hierarch We can take a look at a code example below as well. We first build two tree indices, one over the Wikipedia NYC page, and the other over Paul Graham's essay. We then define a keyword extractor index over the two tree indices. -[Here is an example notebook](https://github.com/jerryjliu/gpt_index/blob/main/examples/composable_indices/ComposableIndices.ipynb). +[Here is an example notebook](https://github.com/jerryjliu/llama_index/blob/main/examples/composable_indices/ComposableIndices.ipynb). diff --git a/docs/how_to/index_structs/update.md b/docs/how_to/index_structs/update.md index 14b0a4f8cb80a..90bb536c14800 100644 --- a/docs/how_to/index_structs/update.md +++ b/docs/how_to/index_structs/update.md @@ -8,7 +8,7 @@ You can "insert" a new Document into any index data structure, after building th For instance, for the list index, a new Document is inserted as additional node(s) in the list. For the vector store index, a new Document (and embedding) is inserted into the underlying document/embedding store. -An example notebook showcasing our insert capabilities is given [here](https://github.com/jerryjliu/gpt_index/blob/main/examples/paul_graham_essay/InsertDemo.ipynb). +An example notebook showcasing our insert capabilities is given [here](https://github.com/jerryjliu/llama_index/blob/main/examples/paul_graham_essay/InsertDemo.ipynb). In this notebook we showcase how to construct an empty index, manually create Document objects, and add those to our index data structures. An example code snippet is given below: diff --git a/docs/how_to/integrations/chatgpt_plugins.md b/docs/how_to/integrations/chatgpt_plugins.md index fc85251e5d576..4b4b076370e90 100644 --- a/docs/how_to/integrations/chatgpt_plugins.md +++ b/docs/how_to/integrations/chatgpt_plugins.md @@ -78,7 +78,7 @@ reader = ChatGPTRetrievalPluginReader( documents = reader.load_data("What did the author do growing up?") # build and query index -from gpt_index import GPTListIndex +from llama_index import GPTListIndex index = GPTListIndex(documents) # set Logging to DEBUG for more detailed outputs query_engine = vector_index.as_query_engine( diff --git a/docs/how_to/integrations/using_with_langchain.md b/docs/how_to/integrations/using_with_langchain.md index d2aeb3c360478..2e48e2fa044e8 100644 --- a/docs/how_to/integrations/using_with_langchain.md +++ b/docs/how_to/integrations/using_with_langchain.md @@ -11,7 +11,7 @@ LlamaIndex provides Tool abstractions so that you can use LlamaIndex along with For instance, you can choose to create a "Tool" from an `QueryEngine` directly as follows: ```python -from gpt_index.langchain_helpers.agents import IndexToolConfig, LlamaIndexTool +from llama_index.langchain_helpers.agents import IndexToolConfig, LlamaIndexTool tool_config = IndexToolConfig( query_engine=query_engine, @@ -36,7 +36,7 @@ Such a toolkit can be used to create a downstream Langchain-based chat agent thr our `create_llama_agent` and `create_llama_chat_agent` commands: ```python -from gpt_index.langchain_helpers.agents import create_llama_chat_agent +from llama_index.langchain_helpers.agents import create_llama_chat_agent agent_chain = create_llama_chat_agent( toolkit, @@ -57,4 +57,4 @@ We provide another demo notebook showing how you can build a chat agent with the - Using LlamaIndex as a generic callable tool with a Langchain agent - Using LlamaIndex as a memory module; this allows you to insert arbitrary amounts of conversation history with a Langchain chatbot! -Please see the [notebook here](https://github.com/jerryjliu/gpt_index/blob/main/examples/langchain_demo/LangchainDemo.ipynb). \ No newline at end of file +Please see the [notebook here](https://github.com/jerryjliu/llama_index/blob/main/examples/langchain_demo/LangchainDemo.ipynb). \ No newline at end of file diff --git a/docs/how_to/integrations/vector_stores.md b/docs/how_to/integrations/vector_stores.md index 253444168342a..a80f5352d14ad 100644 --- a/docs/how_to/integrations/vector_stores.md +++ b/docs/how_to/integrations/vector_stores.md @@ -24,8 +24,8 @@ Chroma stores both documents and vectors. This is an example of how to use Chrom ```python -from gpt_index.readers.chroma import ChromaReader -from gpt_index.indices import GPTListIndex +from llama_index.readers.chroma import ChromaReader +from llama_index.indices import GPTListIndex # The chroma reader loads data from a persisted Chroma collection. # This requires a collection name and a persist directory. @@ -48,7 +48,7 @@ Qdrant also stores both documents and vectors. This is an example of how to use ```python -from gpt_index.readers.qdrant import QdrantReader +from llama_index.readers.qdrant import QdrantReader reader = QdrantReader(host="localhost") @@ -100,7 +100,7 @@ For instance, this is an example usage of the Pinecone data loader `PineconeRead ```python -from gpt_index.readers.pinecone import PineconeReader +from llama_index.readers.pinecone import PineconeReader reader = PineconeReader(api_key=api_key, environment="us-west1-gcp") @@ -118,7 +118,7 @@ documents = reader.load_data( ``` -[Example notebooks can be found here](https://github.com/jerryjliu/gpt_index/tree/main/examples/data_connectors). +[Example notebooks can be found here](https://github.com/jerryjliu/llama_index/tree/main/examples/data_connectors). (vector-store-index)= @@ -140,7 +140,7 @@ Once constructed, the index can be used for querying. By default, `GPTVectorStoreIndex` uses a in-memory `SimpleVectorStore` that's initialized as part of the default storage context. ```python -from gpt_index import GPTVectorStoreIndex, SimpleDirectoryReader +from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader # Load documents and build index documents = SimpleDirectoryReader('../paul_graham_essay/data').load_data() @@ -156,8 +156,8 @@ response = query_engine.query("What did the author do growing up?") We can query over a custom vector store as follows: ```python -from gpt_index import GPTVectorStoreIndex, SimpleDirectoryReader, StorageContext -from gpt_index.vector_stores import DeepLakeVectorStore +from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader, StorageContext +from llama_index.vector_stores import DeepLakeVectorStore # construct vector store and customize storage context storage_context = StorageContext.from_defaults( @@ -179,7 +179,7 @@ Below we show more examples of how to construct various vector stores we support ```python import os import getpath -from gpt_index.vector_stores import DeepLakeVectorStore +from llama_index.vector_stores import DeepLakeVectorStore os.environ["OPENAI_API_KEY"] = getpath.getpath("OPENAI_API_KEY: ") os.environ["ACTIVELOOP_TOKEN"] = getpath.getpath("ACTIVELOOP_TOKEN: ") @@ -192,7 +192,7 @@ vector_store = DeepLakeVectorStore(dataset_path=dataset_path, overwrite=True) **Faiss** ```python import faiss -from gpt_index.vector_stores import FaissVectorStore +from llama_index.vector_stores import FaissVectorStore # create faiss index d = 1536 @@ -211,7 +211,7 @@ storage_context.persist() **Weaviate** ```python import weaviate -from gpt_index.vector_stores import WeaviateVectorStore +from llama_index.vector_stores import WeaviateVectorStore # creating a Weaviate client resource_owner_config = weaviate.AuthClientPassword( @@ -229,7 +229,7 @@ vector_store = WeaviateVectorStore(weaviate_client=client) **Pinecone** ```python import pinecone -from gpt_index.vector_stores import PineconeVectorStore +from llama_index.vector_stores import PineconeVectorStore # Creating a Pinecone index api_key = "api_key" @@ -256,7 +256,7 @@ vector_store = PineconeVectorStore( **Qdrant** ```python import qdrant_client -from gpt_index.vector_stores import QdrantVectorStore +from llama_index.vector_stores import QdrantVectorStore # Creating a Qdrant vector store client = qdrant_client.QdrantClient( @@ -277,7 +277,7 @@ vector_store = QdrantVectorStore( ```python import chromadb -from gpt_index.vector_stores import ChromaVectorStore +from llama_index.vector_stores import ChromaVectorStore # Creating a Chroma client # By default, Chroma will operate purely in-memory. @@ -295,7 +295,7 @@ vector_store = ChromaVectorStore( ```python import pymilvus -from gpt_index.vector_stores import MilvusVectorStore +from llama_index.vector_stores import MilvusVectorStore # construct vector store vector_store = MilvusVectorStore( @@ -318,7 +318,7 @@ and try downgrading. ```python import pymilvus -from gpt_index.vector_stores import MilvusVectorStore +from llama_index.vector_stores import MilvusVectorStore # construct vector store @@ -342,7 +342,7 @@ and try downgrading. ```python import clickhouse_connect -from gpt_index.vector_stores import MyScaleVectorStore +from llama_index.vector_stores import MyScaleVectorStore # Creating a MyScale client client = clickhouse_connect.get_client( @@ -360,4 +360,4 @@ vector_store = MyScaleVectorStore( ``` -[Example notebooks can be found here](https://github.com/jerryjliu/gpt_index/tree/main/examples/vector_indices). +[Example notebooks can be found here](https://github.com/jerryjliu/llama_index/tree/main/examples/vector_indices). diff --git a/docs/how_to/query/node_postprocessor.md b/docs/how_to/query/node_postprocessor.md index deb49c5a38966..15847b8491257 100644 --- a/docs/how_to/query/node_postprocessor.md +++ b/docs/how_to/query/node_postprocessor.md @@ -47,7 +47,7 @@ The postprocessor can be used as part of a `ResponseSynthesizer` in a `QueryEngi ```python -from gpt_index.indices.postprocessor import ( +from llama_index.indices.postprocessor import ( FixedRecencyPostprocessor, ) node_postprocessor = FixedRecencyPostprocessor(service_context=service_context) @@ -69,7 +69,7 @@ The module can also be used on its own as part of a broader flow. For instance, here's an example where you choose to manually postprocess an initial set of source nodes. ```python -from gpt_index.indices.postprocessor import ( +from llama_index.indices.postprocessor import ( FixedRecencyPostprocessor, ) diff --git a/docs/reference/callbacks.rst b/docs/reference/callbacks.rst index 57d387e8e9397..adf0362a9e951 100644 --- a/docs/reference/callbacks.rst +++ b/docs/reference/callbacks.rst @@ -3,6 +3,6 @@ Callbacks ================= -.. automodule:: gpt_index.callbacks +.. automodule:: llama_index.callbacks :members: :inherited-members: diff --git a/docs/reference/composability.rst b/docs/reference/composability.rst index 46e673a47680a..540d18b663c55 100644 --- a/docs/reference/composability.rst +++ b/docs/reference/composability.rst @@ -7,6 +7,6 @@ Below we show the API reference for composable data structures. This contains both the `ComposableGraph` class as well as any builder classes that generate `ComposableGraph` objects. -.. automodule:: gpt_index.composability +.. automodule:: llama_index.composability :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/example_notebooks.rst b/docs/reference/example_notebooks.rst index df5e3e58bc5b7..33839ef942f94 100644 --- a/docs/reference/example_notebooks.rst +++ b/docs/reference/example_notebooks.rst @@ -5,4 +5,4 @@ Example Notebooks We offer a wide variety of example notebooks. They are referenced throughout the documentation. -Example notebooks are found `here `_. \ No newline at end of file +Example notebooks are found `here `_. \ No newline at end of file diff --git a/docs/reference/indices.rst b/docs/reference/indices.rst index 50ccac9b36f50..cd9f5a7ade25c 100644 --- a/docs/reference/indices.rst +++ b/docs/reference/indices.rst @@ -27,6 +27,6 @@ parameters and methods common to all indices. Base Index Class ^^^^^^^^^^^^^^^^ -.. automodule:: gpt_index.indices.base +.. automodule:: llama_index.indices.base :members: :inherited-members: diff --git a/docs/reference/indices/empty.rst b/docs/reference/indices/empty.rst index d99397bce0d76..dfd342d3536fa 100644 --- a/docs/reference/indices/empty.rst +++ b/docs/reference/indices/empty.rst @@ -5,7 +5,7 @@ Empty Index Building the Empty Index -.. automodule:: gpt_index.indices.empty +.. automodule:: llama_index.indices.empty :members: :inherited-members: :exclude-members: delete, docstore, index_struct, index_struct_cls \ No newline at end of file diff --git a/docs/reference/indices/kg.rst b/docs/reference/indices/kg.rst index 6e1ad2731ef45..654e110738edb 100644 --- a/docs/reference/indices/kg.rst +++ b/docs/reference/indices/kg.rst @@ -5,7 +5,7 @@ Knowledge Graph Index Building the Knowledge Graph Index -.. automodule:: gpt_index.indices.knowledge_graph +.. automodule:: llama_index.indices.knowledge_graph :members: :inherited-members: :exclude-members: delete, docstore, index_struct, index_struct_cls \ No newline at end of file diff --git a/docs/reference/indices/list.rst b/docs/reference/indices/list.rst index 37fc135824c0f..879281f620e0d 100644 --- a/docs/reference/indices/list.rst +++ b/docs/reference/indices/list.rst @@ -5,7 +5,7 @@ List Index Building the List Index -.. automodule:: gpt_index.indices.list +.. automodule:: llama_index.indices.list :members: :inherited-members: :exclude-members: delete, docstore, index_struct, index_struct_cls \ No newline at end of file diff --git a/docs/reference/indices/struct_store.rst b/docs/reference/indices/struct_store.rst index 38d128cfc5948..288685b944b77 100644 --- a/docs/reference/indices/struct_store.rst +++ b/docs/reference/indices/struct_store.rst @@ -3,7 +3,7 @@ Structured Store Index ====================== -.. automodule:: gpt_index.indices.struct_store +.. automodule:: llama_index.indices.struct_store :members: :inherited-members: :exclude-members: delete, docstore, index_struct, index_struct_cls \ No newline at end of file diff --git a/docs/reference/indices/table.rst b/docs/reference/indices/table.rst index 62d637c3da2b1..6943312c3c081 100644 --- a/docs/reference/indices/table.rst +++ b/docs/reference/indices/table.rst @@ -5,6 +5,6 @@ Table Index Building the Keyword Table Index -.. automodule:: gpt_index.indices.keyword_table +.. automodule:: llama_index.indices.keyword_table :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/indices/tree.rst b/docs/reference/indices/tree.rst index 84906537afefb..b1de45e80076c 100644 --- a/docs/reference/indices/tree.rst +++ b/docs/reference/indices/tree.rst @@ -5,6 +5,6 @@ Tree Index Building the Tree Index -.. automodule:: gpt_index.indices.tree +.. automodule:: llama_index.indices.tree :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/indices/vector_store.rst b/docs/reference/indices/vector_store.rst index 8550abddd98f9..edaef1f8882d9 100644 --- a/docs/reference/indices/vector_store.rst +++ b/docs/reference/indices/vector_store.rst @@ -8,7 +8,7 @@ Below we show the vector store index classes. Each vector store index class is a combination of a base vector store index class and a vector store, shown below. -.. automodule:: gpt_index.indices.vector_store.base +.. automodule:: llama_index.indices.vector_store.base :members: :inherited-members: :exclude-members: delete, docstore, index_struct, index_struct_cls diff --git a/docs/reference/langchain_integrations/base.rst b/docs/reference/langchain_integrations/base.rst index 954b219315bd2..5a49c74e20be0 100644 --- a/docs/reference/langchain_integrations/base.rst +++ b/docs/reference/langchain_integrations/base.rst @@ -5,13 +5,13 @@ Langchain Integrations Agent Tools + Functions -.. automodule:: gpt_index.langchain_helpers.agents +.. automodule:: llama_index.langchain_helpers.agents :members: :inherited-members: Memory Module -.. automodule:: gpt_index.langchain_helpers.memory_wrapper +.. automodule:: llama_index.langchain_helpers.memory_wrapper :members: :inherited-members: diff --git a/docs/reference/node.rst b/docs/reference/node.rst index 01a82b20a5bf5..032be6bc86498 100644 --- a/docs/reference/node.rst +++ b/docs/reference/node.rst @@ -3,7 +3,7 @@ Node ================= -.. automodule:: gpt_index.data_structs.node_v2 +.. automodule:: llama_index.data_structs.node_v2 :members: :inherited-members: :exclude-members: NodeType, ImageNode, IndexNode \ No newline at end of file diff --git a/docs/reference/node_parser.rst b/docs/reference/node_parser.rst index 9225da0a7f5f1..e75631271dbf7 100644 --- a/docs/reference/node_parser.rst +++ b/docs/reference/node_parser.rst @@ -1,6 +1,6 @@ Node Parser =========== -.. automodule:: gpt_index.node_parser +.. automodule:: llama_index.node_parser :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/node_postprocessor.rst b/docs/reference/node_postprocessor.rst index e611a393c8c54..94c252a373ceb 100644 --- a/docs/reference/node_postprocessor.rst +++ b/docs/reference/node_postprocessor.rst @@ -3,6 +3,6 @@ Node Postprocessor =================== -.. automodule:: gpt_index.indices.postprocessor +.. automodule:: llama_index.indices.postprocessor :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/optimizers.rst b/docs/reference/optimizers.rst index 70d601b29e07d..c946555990330 100644 --- a/docs/reference/optimizers.rst +++ b/docs/reference/optimizers.rst @@ -1,6 +1,6 @@ Optimizers ========== -.. automodule:: gpt_index.optimization +.. automodule:: llama_index.optimization :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/playground.rst b/docs/reference/playground.rst index 7c46b8416ec01..b79ad2ca08be1 100644 --- a/docs/reference/playground.rst +++ b/docs/reference/playground.rst @@ -3,6 +3,6 @@ Playground ================= -.. automodule:: gpt_index.playground.base +.. automodule:: llama_index.playground.base :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/prompts.rst b/docs/reference/prompts.rst index 86f29bb3e5644..78e6078490706 100644 --- a/docs/reference/prompts.rst +++ b/docs/reference/prompts.rst @@ -14,17 +14,17 @@ derived from `Langchain `_. +The list of default prompts can be `found here `_. **NOTE**: we've also curated a set of refine prompts for ChatGPT use cases. The list of ChatGPT refine prompts can be -`found here `_. +`found here `_. Prompts ^^^^^^^ -.. automodule:: gpt_index.prompts.prompts +.. automodule:: llama_index.prompts.prompts :members: :inherited-members: :exclude-members: get_full_format_args @@ -33,7 +33,7 @@ Prompts Base Prompt Class ^^^^^^^^^^^^^^^^^ -.. automodule:: gpt_index.prompts +.. automodule:: llama_index.prompts :members: :inherited-members: :exclude-members: Config, construct, copy, dict, from_examples, from_file, get_full_format_args, output_parser, save, template, template_format, update_forward_refs, validate_variable_names, json, template_is_valid diff --git a/docs/reference/query/query_bundle.rst b/docs/reference/query/query_bundle.rst index 58572fdeb713f..0706ef9fc59b7 100644 --- a/docs/reference/query/query_bundle.rst +++ b/docs/reference/query/query_bundle.rst @@ -1,7 +1,7 @@ Query Bundle ============ -.. automodule:: gpt_index.indices.query.schema +.. automodule:: llama_index.indices.query.schema :members: QueryBundle :inherited-members: :exclude-members: \ No newline at end of file diff --git a/docs/reference/query/query_engines/graph_query_engine.rst b/docs/reference/query/query_engines/graph_query_engine.rst index 119ae5c517eb6..8f86e70e08124 100644 --- a/docs/reference/query/query_engines/graph_query_engine.rst +++ b/docs/reference/query/query_engines/graph_query_engine.rst @@ -1,7 +1,7 @@ Graph Query Engine ======================= -.. automodule:: gpt_index.query_engine.graph_query_engine +.. automodule:: llama_index.query_engine.graph_query_engine :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper \ No newline at end of file diff --git a/docs/reference/query/query_engines/multistep_query_engine.rst b/docs/reference/query/query_engines/multistep_query_engine.rst index f9fa2a12a2cc0..5b1b12de6db04 100644 --- a/docs/reference/query/query_engines/multistep_query_engine.rst +++ b/docs/reference/query/query_engines/multistep_query_engine.rst @@ -1,7 +1,7 @@ Multistep Query Engine ======================= -.. automodule:: gpt_index.query_engine.multistep_query_engine +.. automodule:: llama_index.query_engine.multistep_query_engine :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper \ No newline at end of file diff --git a/docs/reference/query/query_engines/pandas_query_engine.rst b/docs/reference/query/query_engines/pandas_query_engine.rst index 07193d1b0ba0c..121ef5f2b2af5 100644 --- a/docs/reference/query/query_engines/pandas_query_engine.rst +++ b/docs/reference/query/query_engines/pandas_query_engine.rst @@ -1,6 +1,6 @@ Pandas Query Engine ======================= -.. automodule:: gpt_index.indices.struct_store.pandas_query +.. automodule:: llama_index.indices.struct_store.pandas_query :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/query/query_engines/retriever_query_engine.rst b/docs/reference/query/query_engines/retriever_query_engine.rst index b0389e17e9b70..7b8d8879c82cf 100644 --- a/docs/reference/query/query_engines/retriever_query_engine.rst +++ b/docs/reference/query/query_engines/retriever_query_engine.rst @@ -1,6 +1,6 @@ Retriever Query Engine ======================= -.. automodule:: gpt_index.query_engine.retriever_query_engine +.. automodule:: llama_index.query_engine.retriever_query_engine :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/query/query_engines/router_query_engine.rst b/docs/reference/query/query_engines/router_query_engine.rst index 6112c3599bb2a..76b85602868fa 100644 --- a/docs/reference/query/query_engines/router_query_engine.rst +++ b/docs/reference/query/query_engines/router_query_engine.rst @@ -1,6 +1,6 @@ Router Query Engine ======================= -.. automodule:: gpt_index.query_engine.router_query_engine +.. automodule:: llama_index.query_engine.router_query_engine :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/query/query_engines/sql_query_engine.rst b/docs/reference/query/query_engines/sql_query_engine.rst index 5261868724722..a6d6b66dd75d8 100644 --- a/docs/reference/query/query_engines/sql_query_engine.rst +++ b/docs/reference/query/query_engines/sql_query_engine.rst @@ -1,6 +1,6 @@ SQL Query Engine ======================= -.. automodule:: gpt_index.indices.struct_store.sql_query +.. automodule:: llama_index.indices.struct_store.sql_query :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/query/query_engines/transform_query_engine.rst b/docs/reference/query/query_engines/transform_query_engine.rst index 8a113ec500159..d765f1bda2891 100644 --- a/docs/reference/query/query_engines/transform_query_engine.rst +++ b/docs/reference/query/query_engines/transform_query_engine.rst @@ -1,6 +1,6 @@ Transform Query Engine ======================= -.. automodule:: gpt_index.query_engine.transform_query_engine +.. automodule:: llama_index.query_engine.transform_query_engine :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/query/query_transform.rst b/docs/reference/query/query_transform.rst index 419dbcd0a0ab3..f9a7dd7128ce7 100644 --- a/docs/reference/query/query_transform.rst +++ b/docs/reference/query/query_transform.rst @@ -1,7 +1,7 @@ Query Transform =============== -.. automodule:: gpt_index.indices.query.query_transform +.. automodule:: llama_index.indices.query.query_transform :members: :inherited-members: :exclude-members: diff --git a/docs/reference/query/response_synthesizer.rst b/docs/reference/query/response_synthesizer.rst index 2fc15e7787fee..be14db6491051 100644 --- a/docs/reference/query/response_synthesizer.rst +++ b/docs/reference/query/response_synthesizer.rst @@ -3,6 +3,6 @@ Response Synthesizer ===================== -.. automodule:: gpt_index.indices.query.response_synthesis +.. automodule:: llama_index.indices.query.response_synthesis :members: :inherited-members: diff --git a/docs/reference/query/retrievers.rst b/docs/reference/query/retrievers.rst index a92f3db0a2fee..27e0fb0c10905 100644 --- a/docs/reference/query/retrievers.rst +++ b/docs/reference/query/retrievers.rst @@ -43,7 +43,7 @@ Here we show the base retriever class, which contains the `retrieve` method which is shared amongst all retrievers. -.. automodule:: gpt_index.indices.base_retriever +.. automodule:: llama_index.indices.base_retriever :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper diff --git a/docs/reference/query/retrievers/empty.rst b/docs/reference/query/retrievers/empty.rst index 5cd947424e5f3..b3729ee8c5cad 100644 --- a/docs/reference/query/retrievers/empty.rst +++ b/docs/reference/query/retrievers/empty.rst @@ -1,7 +1,7 @@ Empty Index Retriever ======================= -.. automodule:: gpt_index.indices.empty.retrievers +.. automodule:: llama_index.indices.empty.retrievers :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper \ No newline at end of file diff --git a/docs/reference/query/retrievers/kg.rst b/docs/reference/query/retrievers/kg.rst index d6443a8ce4277..e03fad6fbb6db 100644 --- a/docs/reference/query/retrievers/kg.rst +++ b/docs/reference/query/retrievers/kg.rst @@ -1,7 +1,7 @@ Knowledge Graph Retriever ========================== -.. automodule:: gpt_index.indices.knowledge_graph.retrievers +.. automodule:: llama_index.indices.knowledge_graph.retrievers :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper \ No newline at end of file diff --git a/docs/reference/query/retrievers/list.rst b/docs/reference/query/retrievers/list.rst index a0c06c75322b5..5836370f90280 100644 --- a/docs/reference/query/retrievers/list.rst +++ b/docs/reference/query/retrievers/list.rst @@ -1,7 +1,7 @@ List Retriever ======================= -.. automodule:: gpt_index.indices.list.retrievers +.. automodule:: llama_index.indices.list.retrievers :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper \ No newline at end of file diff --git a/docs/reference/query/retrievers/table.rst b/docs/reference/query/retrievers/table.rst index b7eb3e909487d..198b95038aa20 100644 --- a/docs/reference/query/retrievers/table.rst +++ b/docs/reference/query/retrievers/table.rst @@ -1,7 +1,7 @@ Keyword Table Retrievers ========================= -.. automodule:: gpt_index.indices.keyword_table.retrievers +.. automodule:: llama_index.indices.keyword_table.retrievers :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper \ No newline at end of file diff --git a/docs/reference/query/retrievers/transform.rst b/docs/reference/query/retrievers/transform.rst index 2bb7cc9be797a..b3da68f14aedc 100644 --- a/docs/reference/query/retrievers/transform.rst +++ b/docs/reference/query/retrievers/transform.rst @@ -1,7 +1,7 @@ Transform Retriever ======================= -.. automodule:: gpt_index.retrievers.transform_retriever +.. automodule:: llama_index.retrievers.transform_retriever :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper \ No newline at end of file diff --git a/docs/reference/query/retrievers/tree.rst b/docs/reference/query/retrievers/tree.rst index 000718182788b..dce7eae1244ac 100644 --- a/docs/reference/query/retrievers/tree.rst +++ b/docs/reference/query/retrievers/tree.rst @@ -1,17 +1,17 @@ Tree Retrievers ======================= -.. automodule:: gpt_index.indices.tree.all_leaf_retriever +.. automodule:: llama_index.indices.tree.all_leaf_retriever :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper -.. automodule:: gpt_index.indices.tree.select_leaf_retriever +.. automodule:: llama_index.indices.tree.select_leaf_retriever :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper -.. automodule:: gpt_index.indices.tree.select_leaf_embedding_retriever +.. automodule:: llama_index.indices.tree.select_leaf_embedding_retriever :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper \ No newline at end of file diff --git a/docs/reference/query/retrievers/vector_store.rst b/docs/reference/query/retrievers/vector_store.rst index 18f08d02d1c62..8385493949725 100644 --- a/docs/reference/query/retrievers/vector_store.rst +++ b/docs/reference/query/retrievers/vector_store.rst @@ -1,7 +1,7 @@ Vector Store Retrievers ======================= -.. automodule:: gpt_index.indices.vector_store.retrievers +.. automodule:: llama_index.indices.vector_store.retrievers :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper \ No newline at end of file diff --git a/docs/reference/readers.rst b/docs/reference/readers.rst index a1fb425202aaa..f6a4729a4bd14 100644 --- a/docs/reference/readers.rst +++ b/docs/reference/readers.rst @@ -6,6 +6,6 @@ LlamaHub is an open-source repository containing data loaders that you can easil The following data connectors are still available in the core repo. -.. automodule:: gpt_index.readers +.. automodule:: llama_index.readers :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/response.rst b/docs/reference/response.rst index 72e290f418f4c..a9a8f2af5cef7 100644 --- a/docs/reference/response.rst +++ b/docs/reference/response.rst @@ -3,6 +3,6 @@ Response ================= -.. automodule:: gpt_index.response.schema +.. automodule:: llama_index.response.schema :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/service_context.rst b/docs/reference/service_context.rst index 478740fd4b156..0de94197ef14d 100644 --- a/docs/reference/service_context.rst +++ b/docs/reference/service_context.rst @@ -23,6 +23,6 @@ the BaseEmbedding (for configuring the embedding model), and more. ------------ -.. automodule:: gpt_index.indices.service_context +.. automodule:: llama_index.indices.service_context :members: :inherited-members: diff --git a/docs/reference/service_context/embeddings.rst b/docs/reference/service_context/embeddings.rst index b6931c4433e84..999f54d5a0d42 100644 --- a/docs/reference/service_context/embeddings.rst +++ b/docs/reference/service_context/embeddings.rst @@ -9,7 +9,7 @@ Users have a few options to choose from when it comes to embeddings. - :code:`LangchainEmbedding`: a wrapper around Langchain's embedding models. -.. automodule:: gpt_index.embeddings.openai +.. automodule:: llama_index.embeddings.openai :members: :inherited-members: :exclude-members: OAEM, OpenAIEmbeddingMode @@ -18,7 +18,7 @@ Users have a few options to choose from when it comes to embeddings. We also introduce a :code:`LangchainEmbedding` class, which is a wrapper around Langchain's embedding models. A full list of embeddings can be found `here `_. -.. automodule:: gpt_index.embeddings.langchain +.. automodule:: llama_index.embeddings.langchain :members: :inherited-members: diff --git a/docs/reference/service_context/llama_logger.rst b/docs/reference/service_context/llama_logger.rst index 8d4794a7e2c93..d94ae6f263c0e 100644 --- a/docs/reference/service_context/llama_logger.rst +++ b/docs/reference/service_context/llama_logger.rst @@ -3,7 +3,7 @@ Llama Logger 🪵 ================= -.. automodule:: gpt_index.logger +.. automodule:: llama_index.logger :members: :inherited-members: diff --git a/docs/reference/service_context/llm_predictor.rst b/docs/reference/service_context/llm_predictor.rst index 388a7793c01ba..2b7feb8d68946 100644 --- a/docs/reference/service_context/llm_predictor.rst +++ b/docs/reference/service_context/llm_predictor.rst @@ -5,13 +5,13 @@ LLMPredictor Our LLMPredictor is a wrapper around Langchain's `LLMChain` that allows easy integration into LlamaIndex. -.. automodule:: gpt_index.langchain_helpers.chain_wrapper +.. automodule:: llama_index.langchain_helpers.chain_wrapper :members: :inherited-members: Our MockLLMPredictor is used for token prediction. See `Cost Analysis How-To <../../how_to/analysis/cost_analysis.html>`_ for more information. -.. automodule:: gpt_index.token_counter.mock_chain_wrapper +.. automodule:: llama_index.token_counter.mock_chain_wrapper :members: :inherited-members: diff --git a/docs/reference/service_context/prompt_helper.rst b/docs/reference/service_context/prompt_helper.rst index bf878c255ae27..24ecf2acd71ba 100644 --- a/docs/reference/service_context/prompt_helper.rst +++ b/docs/reference/service_context/prompt_helper.rst @@ -3,7 +3,7 @@ PromptHelper ================= -.. automodule:: gpt_index.indices.prompt_helper +.. automodule:: llama_index.indices.prompt_helper :members: :inherited-members: diff --git a/docs/reference/storage.rst b/docs/reference/storage.rst index 1274cdf7ea6fc..b2ddb83e5e70a 100644 --- a/docs/reference/storage.rst +++ b/docs/reference/storage.rst @@ -35,6 +35,6 @@ We show the API references for the Storage Classes, loading indices from the Sto ------------ -.. automodule:: gpt_index.storage.storage_context +.. automodule:: llama_index.storage.storage_context :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/storage/docstore.rst b/docs/reference/storage/docstore.rst index 025013d3b33b8..79ab2508a8fe8 100644 --- a/docs/reference/storage/docstore.rst +++ b/docs/reference/storage/docstore.rst @@ -3,6 +3,6 @@ Document Store ===================== -.. automodule:: gpt_index.storage.docstore +.. automodule:: llama_index.storage.docstore :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/storage/index_store.rst b/docs/reference/storage/index_store.rst index 012b3d60ef6fc..935c10828bd22 100644 --- a/docs/reference/storage/index_store.rst +++ b/docs/reference/storage/index_store.rst @@ -3,6 +3,6 @@ Index Store ===================== -.. automodule:: gpt_index.storage.index_store +.. automodule:: llama_index.storage.index_store :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/storage/indices_save_load.rst b/docs/reference/storage/indices_save_load.rst index 60f274ca66989..fdbf12d058213 100644 --- a/docs/reference/storage/indices_save_load.rst +++ b/docs/reference/storage/indices_save_load.rst @@ -3,6 +3,6 @@ Loading Indices ===================== -.. automodule:: gpt_index.indices.loading +.. automodule:: llama_index.indices.loading :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/storage/kv_store.rst b/docs/reference/storage/kv_store.rst index 5ad3b3aa0e5cf..fea687c548454 100644 --- a/docs/reference/storage/kv_store.rst +++ b/docs/reference/storage/kv_store.rst @@ -4,6 +4,6 @@ KV Storage ================= -.. automodule:: gpt_index.storage.kvstore +.. automodule:: llama_index.storage.kvstore :members: :inherited-members: \ No newline at end of file diff --git a/docs/reference/storage/vector_store.rst b/docs/reference/storage/vector_store.rst index 35fa2dd109ceb..2bd31af3333e0 100644 --- a/docs/reference/storage/vector_store.rst +++ b/docs/reference/storage/vector_store.rst @@ -3,6 +3,6 @@ Vector Store ===================== -.. automodule:: gpt_index.vector_stores +.. automodule:: llama_index.vector_stores :members: :inherited-members: diff --git a/docs/reference/struct_store.rst b/docs/reference/struct_store.rst index eced9d0f5827e..2353abf18a86c 100644 --- a/docs/reference/struct_store.rst +++ b/docs/reference/struct_store.rst @@ -6,14 +6,14 @@ Structured Index Configuration Our structured indices are documented in :ref:`Ref-Indices-StructStore`. Below, we provide a reference of the classes that are used to configure our structured indices. -.. automodule:: gpt_index.langchain_helpers.sql_wrapper +.. automodule:: llama_index.langchain_helpers.sql_wrapper :members: :inherited-members: -.. automodule:: gpt_index.indices.struct_store.container_builder +.. automodule:: llama_index.indices.struct_store.container_builder :members: :inherited-members: -.. automodule:: gpt_index.indices.common.struct_store.base +.. automodule:: llama_index.indices.common.struct_store.base :members: :inherited-members: diff --git a/docs/use_cases/queries.md b/docs/use_cases/queries.md index c5160fd17ff64..decbdcda11d2b 100644 --- a/docs/use_cases/queries.md +++ b/docs/use_cases/queries.md @@ -153,7 +153,7 @@ Here are some relevant resources: You can also perform compare/contrast queries with a **query transformation** module. ```python -from gpt_index.indices.query.query_transform.base import DecomposeQueryTransform +from llama_index.indices.query.query_transform.base import DecomposeQueryTransform decompose_transform = DecomposeQueryTransform( llm_predictor_chatgpt, verbose=True ) diff --git a/experimental/classifier/utils.py b/experimental/classifier/utils.py index ee8ec9935ad93..2b46706ad7f20 100644 --- a/experimental/classifier/utils.py +++ b/experimental/classifier/utils.py @@ -7,9 +7,9 @@ import pandas as pd from sklearn.model_selection import train_test_split -from gpt_index.indices.utils import extract_numbers_given_response -from gpt_index.langchain_helpers.chain_wrapper import LLMPredictor -from gpt_index.prompts.base import Prompt +from llama_index.indices.utils import extract_numbers_given_response +from llama_index.langchain_helpers.chain_wrapper import LLMPredictor +from llama_index.prompts.base import Prompt def get_train_and_eval_data( diff --git a/experimental/cli/cli_add.py b/experimental/cli/cli_add.py index d0c9d58879b60..d944330647edd 100644 --- a/experimental/cli/cli_add.py +++ b/experimental/cli/cli_add.py @@ -1,7 +1,7 @@ import os from .configuration import load_index, save_index from argparse import Namespace, _SubParsersAction -from gpt_index import SimpleDirectoryReader +from llama_index import SimpleDirectoryReader def add_cli(args: Namespace) -> None: diff --git a/experimental/cli/configuration.py b/experimental/cli/configuration.py index 3f3b5e40f0b24..11923cecedf9d 100644 --- a/experimental/cli/configuration.py +++ b/experimental/cli/configuration.py @@ -1,20 +1,20 @@ import os from configparser import ConfigParser, SectionProxy from typing import Any, Type -from gpt_index.embeddings.openai import OpenAIEmbedding +from llama_index.embeddings.openai import OpenAIEmbedding from langchain import OpenAI from langchain.base_language import BaseLanguageModel -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.embeddings.base import BaseEmbedding -from gpt_index import ( +from llama_index.indices.base import BaseGPTIndex +from llama_index.embeddings.base import BaseEmbedding +from llama_index import ( GPTVectorStoreIndex, GPTSimpleKeywordTableIndex, ServiceContext, LLMPredictor, ) -from gpt_index.indices.loading import load_index_from_storage -from gpt_index.llm_predictor import StructuredLLMPredictor -from gpt_index.storage.storage_context import StorageContext +from llama_index.indices.loading import load_index_from_storage +from llama_index.llm_predictor import StructuredLLMPredictor +from llama_index.storage.storage_context import StorageContext CONFIG_FILE_NAME = "config.ini" diff --git a/gpt_index/composability/__init__.py b/gpt_index/composability/__init__.py deleted file mode 100644 index af570fc81f7fc..0000000000000 --- a/gpt_index/composability/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Init composability.""" - - -from gpt_index.composability.base import ComposableGraph -from gpt_index.composability.joint_qa_summary import QASummaryQueryEngineBuilder - -__all__ = ["ComposableGraph", "QASummaryQueryEngineBuilder"] diff --git a/gpt_index/evaluation/__init__.py b/gpt_index/evaluation/__init__.py deleted file mode 100644 index a016d04f2bb10..0000000000000 --- a/gpt_index/evaluation/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -"""Evaluation modules.""" - -from gpt_index.evaluation.base import ResponseEvaluator, QueryResponseEvaluator -from gpt_index.evaluation.dataset_generation import DatasetGenerator - -__all__ = ["ResponseEvaluator", "QueryResponseEvaluator", "DatasetGenerator"] diff --git a/gpt_index/indices/__init__.py b/gpt_index/indices/__init__.py deleted file mode 100644 index d1523729d92a3..0000000000000 --- a/gpt_index/indices/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -"""LlamaIndex data structures.""" - -# indices -from gpt_index.indices.keyword_table.base import GPTKeywordTableIndex -from gpt_index.indices.keyword_table.rake_base import GPTRAKEKeywordTableIndex -from gpt_index.indices.keyword_table.simple_base import GPTSimpleKeywordTableIndex -from gpt_index.indices.list.base import GPTListIndex -from gpt_index.indices.tree.base import GPTTreeIndex - -__all__ = [ - "GPTKeywordTableIndex", - "GPTSimpleKeywordTableIndex", - "GPTRAKEKeywordTableIndex", - "GPTListIndex", - "GPTTreeIndex", -] diff --git a/gpt_index/indices/empty/__init__.py b/gpt_index/indices/empty/__init__.py deleted file mode 100644 index 0bc905d02e123..0000000000000 --- a/gpt_index/indices/empty/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -"""Empty Index.""" - -from gpt_index.indices.empty.base import GPTEmptyIndex -from gpt_index.indices.empty.retrievers import EmptyIndexRetriever - -__all__ = ["GPTEmptyIndex", "EmptyIndexRetriever"] diff --git a/gpt_index/indices/knowledge_graph/__init__.py b/gpt_index/indices/knowledge_graph/__init__.py deleted file mode 100644 index 6a796a503cc1e..0000000000000 --- a/gpt_index/indices/knowledge_graph/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -"""KG-based data structures.""" - -from gpt_index.indices.knowledge_graph.base import GPTKnowledgeGraphIndex -from gpt_index.indices.knowledge_graph.retrievers import KGTableRetriever - -__all__ = [ - "GPTKnowledgeGraphIndex", - "KGTableRetriever", -] diff --git a/gpt_index/indices/query/__init__.py b/gpt_index/indices/query/__init__.py deleted file mode 100644 index 0685f183b0753..0000000000000 --- a/gpt_index/indices/query/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Init file.""" - -from gpt_index.indices.query.response_synthesis import ResponseSynthesizer - -__all__ = [ - "ResponseSynthesizer", -] diff --git a/gpt_index/indices/tree/__init__.py b/gpt_index/indices/tree/__init__.py deleted file mode 100644 index 75d0c1adae569..0000000000000 --- a/gpt_index/indices/tree/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -"""Tree-structured Index Data Structures.""" - -# indices -from gpt_index.indices.tree.base import GPTTreeIndex -from gpt_index.indices.tree.select_leaf_embedding_retriever import ( - TreeSelectLeafEmbeddingRetriever, -) -from gpt_index.indices.tree.select_leaf_retriever import TreeSelectLeafRetriever -from gpt_index.indices.tree.all_leaf_retriever import TreeAllLeafRetriever -from gpt_index.indices.tree.tree_root_retriever import TreeRootRetriever - -__all__ = [ - "GPTTreeIndex", - "TreeSelectLeafEmbeddingRetriever", - "TreeSelectLeafRetriever", - "TreeAllLeafRetriever", - "TreeRootRetriever", -] diff --git a/gpt_index/indices/vector_store/__init__.py b/gpt_index/indices/vector_store/__init__.py deleted file mode 100644 index 5547b615e4da0..0000000000000 --- a/gpt_index/indices/vector_store/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -"""Vector-store based data structures.""" - -from gpt_index.indices.vector_store.base import GPTVectorStoreIndex -from gpt_index.indices.vector_store.retrievers import VectorIndexRetriever - -__all__ = [ - "GPTVectorStoreIndex", - "VectorIndexRetriever", -] diff --git a/gpt_index/llm_predictor/__init__.py b/gpt_index/llm_predictor/__init__.py deleted file mode 100644 index a53cdbb04fb2c..0000000000000 --- a/gpt_index/llm_predictor/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -"""Init params.""" - -# TODO: move LLMPredictor to this folder -from gpt_index.llm_predictor.base import LLMPredictor -from gpt_index.llm_predictor.stable_lm import StableLMPredictor -from gpt_index.llm_predictor.structured import StructuredLLMPredictor - -__all__ = ["LLMPredictor", "StructuredLLMPredictor", "StableLMPredictor"] diff --git a/gpt_index/logger/__init__.py b/gpt_index/logger/__init__.py deleted file mode 100644 index 8509401358e40..0000000000000 --- a/gpt_index/logger/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -"""Init params.""" - -from gpt_index.logger.base import LlamaLogger - -__all__ = ["LlamaLogger"] diff --git a/gpt_index/node_parser/__init__.py b/gpt_index/node_parser/__init__.py deleted file mode 100644 index ade2af564956b..0000000000000 --- a/gpt_index/node_parser/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -"""Node parsers.""" - -from gpt_index.node_parser.simple import SimpleNodeParser -from gpt_index.node_parser.interface import NodeParser - -__all__ = ["SimpleNodeParser", "NodeParser"] diff --git a/gpt_index/optimization/__init__.py b/gpt_index/optimization/__init__.py deleted file mode 100644 index 3cc74bd10d703..0000000000000 --- a/gpt_index/optimization/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Optimization.""" - -from gpt_index.optimization.optimizer import SentenceEmbeddingOptimizer - -__all__ = [ - "SentenceEmbeddingOptimizer", -] diff --git a/gpt_index/output_parsers/__init__.py b/gpt_index/output_parsers/__init__.py deleted file mode 100644 index aee6c7b335190..0000000000000 --- a/gpt_index/output_parsers/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -"""Output parsers.""" - -from gpt_index.output_parsers.guardrails import GuardrailsOutputParser -from gpt_index.output_parsers.langchain import LangchainOutputParser - -__all__ = ["GuardrailsOutputParser", "LangchainOutputParser"] diff --git a/gpt_index/prompts/__init__.py b/gpt_index/prompts/__init__.py deleted file mode 100644 index 70a9a06c14c38..0000000000000 --- a/gpt_index/prompts/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -"""Prompt class.""" - -from gpt_index.prompts.base import Prompt - -__all__ = ["Prompt"] diff --git a/gpt_index/query_engine/__init__.py b/gpt_index/query_engine/__init__.py deleted file mode 100644 index df22cda9ec71e..0000000000000 --- a/gpt_index/query_engine/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -from gpt_index.query_engine.graph_query_engine import ComposableGraphQueryEngine -from gpt_index.query_engine.retriever_query_engine import RetrieverQueryEngine -from gpt_index.query_engine.transform_query_engine import TransformQueryEngine -from gpt_index.query_engine.multistep_query_engine import MultiStepQueryEngine -from gpt_index.query_engine.router_query_engine import RouterQueryEngine - - -__all__ = [ - "ComposableGraphQueryEngine", - "RetrieverQueryEngine", - "TransformQueryEngine", - "MultiStepQueryEngine", - "RouterQueryEngine", -] diff --git a/gpt_index/readers/__init__.py b/gpt_index/readers/__init__.py deleted file mode 100644 index 3cdbd9d596dca..0000000000000 --- a/gpt_index/readers/__init__.py +++ /dev/null @@ -1,83 +0,0 @@ -"""Data Connectors for LlamaIndex. - -This module contains the data connectors for LlamaIndex. Each connector inherits -from a `BaseReader` class, connects to a data source, and loads Document objects -from that data source. - -You may also choose to construct Document objects manually, for instance -in our `Insert How-To Guide <../how_to/insert.html>`_. See below for the API -definition of a Document - the bare minimum is a `text` property. - -""" - -from gpt_index.readers.chatgpt_plugin import ChatGPTRetrievalPluginReader -from gpt_index.readers.chroma import ChromaReader -from gpt_index.readers.deeplake import DeepLakeReader -from gpt_index.readers.discord_reader import DiscordReader -from gpt_index.readers.elasticsearch import ElasticsearchReader -from gpt_index.readers.faiss import FaissReader - -# readers -from gpt_index.readers.file.base import SimpleDirectoryReader -from gpt_index.readers.github_readers.github_repository_reader import ( - GithubRepositoryReader, -) -from gpt_index.readers.google_readers.gdocs import GoogleDocsReader -from gpt_index.readers.json import JSONReader -from gpt_index.readers.make_com.wrapper import MakeWrapper -from gpt_index.readers.mbox import MboxReader -from gpt_index.readers.milvus import MilvusReader -from gpt_index.readers.mongo import SimpleMongoReader -from gpt_index.readers.myscale import MyScaleReader -from gpt_index.readers.notion import NotionPageReader -from gpt_index.readers.obsidian import ObsidianReader -from gpt_index.readers.pinecone import PineconeReader -from gpt_index.readers.qdrant import QdrantReader -from gpt_index.readers.schema.base import Document -from gpt_index.readers.slack import SlackReader -from gpt_index.readers.steamship.file_reader import SteamshipFileReader -from gpt_index.readers.string_iterable import StringIterableReader -from gpt_index.readers.twitter import TwitterTweetReader -from gpt_index.readers.weaviate.reader import WeaviateReader -from gpt_index.readers.web import ( - BeautifulSoupWebReader, - RssReader, - SimpleWebPageReader, - TrafilaturaWebReader, -) -from gpt_index.readers.wikipedia import WikipediaReader -from gpt_index.readers.youtube_transcript import YoutubeTranscriptReader - -__all__ = [ - "WikipediaReader", - "YoutubeTranscriptReader", - "SimpleDirectoryReader", - "JSONReader", - "SimpleMongoReader", - "NotionPageReader", - "GoogleDocsReader", - "DiscordReader", - "SlackReader", - "WeaviateReader", - "PineconeReader", - "QdrantReader", - "MilvusReader", - "ChromaReader", - "DeepLakeReader", - "FaissReader", - "MyScaleReader", - "Document", - "StringIterableReader", - "SimpleWebPageReader", - "BeautifulSoupWebReader", - "TrafilaturaWebReader", - "RssReader", - "MakeWrapper", - "TwitterTweetReader", - "ObsidianReader", - "GithubRepositoryReader", - "MboxReader", - "ElasticsearchReader", - "SteamshipFileReader", - "ChatGPTRetrievalPluginReader", -] diff --git a/gpt_index/readers/chatgpt_plugin/__init__.py b/gpt_index/readers/chatgpt_plugin/__init__.py deleted file mode 100644 index edf3da6405070..0000000000000 --- a/gpt_index/readers/chatgpt_plugin/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -"""Init params.""" - -from gpt_index.readers.chatgpt_plugin.base import ChatGPTRetrievalPluginReader - -__all__ = ["ChatGPTRetrievalPluginReader"] diff --git a/gpt_index/retrievers/__init__.py b/gpt_index/retrievers/__init__.py deleted file mode 100644 index 16ad262dd7c84..0000000000000 --- a/gpt_index/retrievers/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -from gpt_index.indices.vector_store.retrievers import VectorIndexRetriever -from gpt_index.indices.list.retrievers import ( - ListIndexEmbeddingRetriever, - ListIndexRetriever, -) -from gpt_index.indices.knowledge_graph.retrievers import KGTableRetriever -from gpt_index.indices.empty.retrievers import EmptyIndexRetriever -from gpt_index.indices.tree.all_leaf_retriever import TreeAllLeafRetriever -from gpt_index.indices.tree.select_leaf_embedding_retriever import ( - TreeSelectLeafEmbeddingRetriever, -) -from gpt_index.indices.tree.select_leaf_retriever import TreeSelectLeafRetriever -from gpt_index.indices.tree.tree_root_retriever import TreeRootRetriever -from gpt_index.retrievers.transform_retriever import TransformRetriever -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.keyword_table.retrievers import KeywordTableSimpleRetriever - -__all__ = [ - "VectorIndexRetriever", - "ListIndexEmbeddingRetriever", - "ListIndexRetriever", - "KGTableRetriever", - "EmptyIndexRetriever", - "TreeAllLeafRetriever", - "TreeSelectLeafEmbeddingRetriever", - "TreeSelectLeafRetriever", - "TreeRootRetriever", - "TransformRetriever", - "KeywordTableSimpleRetriever", - "BaseRetriever", -] diff --git a/gpt_index/selectors/__init__.py b/gpt_index/selectors/__init__.py deleted file mode 100644 index af774891eea42..0000000000000 --- a/gpt_index/selectors/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -from gpt_index.selectors.types import BaseSelector, SelectorResult -from gpt_index.selectors.llm_selectors import LLMSingleSelector, LLMMultiSelector - -__all__ = [ - "BaseSelector", - "SelectorResult", - "LLMSingleSelector", - "LLMMultiSelector", -] diff --git a/gpt_index/storage/__init__.py b/gpt_index/storage/__init__.py deleted file mode 100644 index a9d273822fe9b..0000000000000 --- a/gpt_index/storage/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Storage classes.""" - -from gpt_index.storage.storage_context import StorageContext - -__all__ = [ - "StorageContext", -] diff --git a/gpt_index/storage/docstore/__init__.py b/gpt_index/storage/docstore/__init__.py deleted file mode 100644 index 048756a4b815f..0000000000000 --- a/gpt_index/storage/docstore/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -from gpt_index.storage.docstore.types import BaseDocumentStore -from gpt_index.storage.docstore.simple_docstore import SimpleDocumentStore -from gpt_index.storage.docstore.mongo_docstore import MongoDocumentStore -from gpt_index.storage.docstore.keyval_docstore import KVDocumentStore - -# alias for backwards compatibility -from gpt_index.storage.docstore.simple_docstore import DocumentStore - - -__all__ = [ - "BaseDocumentStore", - "DocumentStore", - "SimpleDocumentStore", - "MongoDocumentStore", - "KVDocumentStore", -] diff --git a/gpt_index/storage/index_store/__init__.py b/gpt_index/storage/index_store/__init__.py deleted file mode 100644 index 43d96c3d8e920..0000000000000 --- a/gpt_index/storage/index_store/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from gpt_index.storage.index_store.keyval_index_store import KVIndexStore -from gpt_index.storage.index_store.simple_index_store import SimpleIndexStore -from gpt_index.storage.index_store.mongo_index_store import MongoIndexStore - -__all__ = ["KVIndexStore", "SimpleIndexStore", "MongoIndexStore"] diff --git a/gpt_index/storage/kvstore/__init__.py b/gpt_index/storage/kvstore/__init__.py deleted file mode 100644 index 1ea307b2afb36..0000000000000 --- a/gpt_index/storage/kvstore/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from gpt_index.storage.kvstore.simple_kvstore import SimpleKVStore -from gpt_index.storage.kvstore.mongodb_kvstore import MongoDBKVStore - -__all__ = ["SimpleKVStore", "MongoDBKVStore"] diff --git a/gpt_index/tools/__init__.py b/gpt_index/tools/__init__.py deleted file mode 100644 index 84136d2faa8c3..0000000000000 --- a/gpt_index/tools/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Tools.""" - -from gpt_index.tools.types import BaseTool -from gpt_index.tools.query_engine import QueryEngineTool - - -__all__ = ["BaseTool", "QueryEngineTool"] diff --git a/gpt_index/tts/__init__.py b/gpt_index/tts/__init__.py deleted file mode 100644 index c86535be7b070..0000000000000 --- a/gpt_index/tts/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -"""TTS modules.""" - -from gpt_index.tts.bark import BarkTTS -from gpt_index.tts.elevenlabs import ElevenLabsTTS - -__all__ = ["BarkTTS", "ElevenLabsTTS"] diff --git a/gpt_index/vector_stores/__init__.py b/gpt_index/vector_stores/__init__.py deleted file mode 100644 index 657d51c2bd3d9..0000000000000 --- a/gpt_index/vector_stores/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -"""Vector stores.""" - -from gpt_index.vector_stores.chatgpt_plugin import ChatGPTRetrievalPluginClient -from gpt_index.vector_stores.chroma import ChromaVectorStore -from gpt_index.vector_stores.deeplake import DeepLakeVectorStore -from gpt_index.vector_stores.faiss import FaissVectorStore -from gpt_index.vector_stores.milvus import MilvusVectorStore -from gpt_index.vector_stores.myscale import MyScaleVectorStore -from gpt_index.vector_stores.opensearch import ( - OpensearchVectorClient, - OpensearchVectorStore, -) -from gpt_index.vector_stores.pinecone import PineconeVectorStore -from gpt_index.vector_stores.qdrant import QdrantVectorStore -from gpt_index.vector_stores.simple import SimpleVectorStore -from gpt_index.vector_stores.weaviate import WeaviateVectorStore - -__all__ = [ - "SimpleVectorStore", - "FaissVectorStore", - "PineconeVectorStore", - "WeaviateVectorStore", - "QdrantVectorStore", - "ChromaVectorStore", - "OpensearchVectorStore", - "OpensearchVectorClient", - "ChatGPTRetrievalPluginClient", - "MilvusVectorStore", - "DeepLakeVectorStore", - "MyScaleVectorStore", -] diff --git a/gpt_index/VERSION b/llama_index/VERSION similarity index 100% rename from gpt_index/VERSION rename to llama_index/VERSION diff --git a/gpt_index/__init__.py b/llama_index/__init__.py similarity index 65% rename from gpt_index/__init__.py rename to llama_index/__init__.py index b686eb844875b..81e56180deb03 100644 --- a/gpt_index/__init__.py +++ b/llama_index/__init__.py @@ -8,45 +8,45 @@ import logging from logging import NullHandler -from gpt_index.data_structs.struct_type import IndexStructType +from llama_index.data_structs.struct_type import IndexStructType # embeddings -from gpt_index.embeddings.langchain import LangchainEmbedding -from gpt_index.embeddings.openai import OpenAIEmbedding +from llama_index.embeddings.langchain import LangchainEmbedding +from llama_index.embeddings.openai import OpenAIEmbedding # structured -from gpt_index.indices.common.struct_store.base import SQLDocumentContextBuilder -from gpt_index.indices.composability.graph import ComposableGraph -from gpt_index.indices.empty import GPTEmptyIndex +from llama_index.indices.common.struct_store.base import SQLDocumentContextBuilder +from llama_index.indices.composability.graph import ComposableGraph +from llama_index.indices.empty import GPTEmptyIndex # indices -from gpt_index.indices.keyword_table import ( +from llama_index.indices.keyword_table import ( GPTKeywordTableIndex, GPTRAKEKeywordTableIndex, GPTSimpleKeywordTableIndex, ) -from gpt_index.indices.list import GPTListIndex +from llama_index.indices.list import GPTListIndex # prompt helper -from gpt_index.indices.prompt_helper import PromptHelper +from llama_index.indices.prompt_helper import PromptHelper # for composability -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.struct_store.sql import GPTSQLStructStoreIndex -from gpt_index.indices.tree import GPTTreeIndex -from gpt_index.indices.vector_store import GPTVectorStoreIndex +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.struct_store.sql import GPTSQLStructStoreIndex +from llama_index.indices.tree import GPTTreeIndex +from llama_index.indices.vector_store import GPTVectorStoreIndex # storage -from gpt_index.storage.storage_context import StorageContext +from llama_index.storage.storage_context import StorageContext # langchain helper -from gpt_index.langchain_helpers.chain_wrapper import LLMPredictor -from gpt_index.langchain_helpers.memory_wrapper import GPTIndexMemory -from gpt_index.langchain_helpers.sql_wrapper import SQLDatabase +from llama_index.langchain_helpers.chain_wrapper import LLMPredictor +from llama_index.langchain_helpers.memory_wrapper import GPTIndexMemory +from llama_index.langchain_helpers.sql_wrapper import SQLDatabase # prompts -from gpt_index.prompts.base import Prompt -from gpt_index.prompts.prompts import ( +from llama_index.prompts.base import Prompt +from llama_index.prompts.prompts import ( KeywordExtractPrompt, QueryKeywordExtractPrompt, QuestionAnswerPrompt, @@ -58,7 +58,7 @@ ) # readers -from gpt_index.readers import ( +from llama_index.readers import ( BeautifulSoupWebReader, ChromaReader, DeepLakeReader, @@ -85,27 +85,27 @@ WeaviateReader, WikipediaReader, ) -from gpt_index.readers.download import download_loader +from llama_index.readers.download import download_loader # response -from gpt_index.response.schema import Response +from llama_index.response.schema import Response # token predictor -from gpt_index.token_counter.mock_chain_wrapper import MockLLMPredictor -from gpt_index.token_counter.mock_embed_model import MockEmbedding +from llama_index.token_counter.mock_chain_wrapper import MockLLMPredictor +from llama_index.token_counter.mock_embed_model import MockEmbedding # loading -from gpt_index.indices.loading import ( +from llama_index.indices.loading import ( load_graph_from_storage, load_index_from_storage, load_indices_from_storage, ) # QueryBundle -from gpt_index.indices.query.schema import QueryBundle +from llama_index.indices.query.schema import QueryBundle # Response Synthesizer -from gpt_index.indices.query.response_synthesis import ResponseSynthesizer +from llama_index.indices.query.response_synthesis import ResponseSynthesizer # best practices for library logging: # https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library diff --git a/gpt_index/async_utils.py b/llama_index/async_utils.py similarity index 100% rename from gpt_index/async_utils.py rename to llama_index/async_utils.py diff --git a/gpt_index/callbacks/__init__.py b/llama_index/callbacks/__init__.py similarity index 100% rename from gpt_index/callbacks/__init__.py rename to llama_index/callbacks/__init__.py diff --git a/gpt_index/callbacks/base.py b/llama_index/callbacks/base.py similarity index 95% rename from gpt_index/callbacks/base.py rename to llama_index/callbacks/base.py index 6e597427e4b57..5c1c572225bec 100644 --- a/gpt_index/callbacks/base.py +++ b/llama_index/callbacks/base.py @@ -2,7 +2,7 @@ from abc import ABC, abstractmethod from typing import Any, Dict, List, Optional -from gpt_index.callbacks.schema import CBEventType +from llama_index.callbacks.schema import CBEventType class BaseCallbackHandler(ABC): diff --git a/gpt_index/callbacks/llama_debug.py b/llama_index/callbacks/llama_debug.py similarity index 95% rename from gpt_index/callbacks/llama_debug.py rename to llama_index/callbacks/llama_debug.py index 4148168a043a2..682bdb39e8d2c 100644 --- a/gpt_index/callbacks/llama_debug.py +++ b/llama_index/callbacks/llama_debug.py @@ -2,8 +2,8 @@ from datetime import datetime from typing import Dict, List, Any, Optional -from gpt_index.callbacks.base import BaseCallbackHandler -from gpt_index.callbacks.schema import ( +from llama_index.callbacks.base import BaseCallbackHandler +from llama_index.callbacks.schema import ( CBEvent, CBEventType, EventStats, diff --git a/gpt_index/callbacks/schema.py b/llama_index/callbacks/schema.py similarity index 100% rename from gpt_index/callbacks/schema.py rename to llama_index/callbacks/schema.py diff --git a/llama_index/composability/__init__.py b/llama_index/composability/__init__.py new file mode 100644 index 0000000000000..6a7e60131b2ef --- /dev/null +++ b/llama_index/composability/__init__.py @@ -0,0 +1,7 @@ +"""Init composability.""" + + +from llama_index.composability.base import ComposableGraph +from llama_index.composability.joint_qa_summary import QASummaryQueryEngineBuilder + +__all__ = ["ComposableGraph", "QASummaryQueryEngineBuilder"] diff --git a/gpt_index/composability/base.py b/llama_index/composability/base.py similarity index 52% rename from gpt_index/composability/base.py rename to llama_index/composability/base.py index b7d952ed60c83..51cc52ffa86d6 100644 --- a/gpt_index/composability/base.py +++ b/llama_index/composability/base.py @@ -1,4 +1,4 @@ """Composable graph.""" # TODO: remove this file, only keep for backwards compatibility -from gpt_index.indices.composability.graph import ComposableGraph # noqa: F401 +from llama_index.indices.composability.graph import ComposableGraph # noqa: F401 diff --git a/gpt_index/composability/joint_qa_summary.py b/llama_index/composability/joint_qa_summary.py similarity index 85% rename from gpt_index/composability/joint_qa_summary.py rename to llama_index/composability/joint_qa_summary.py index 647121626b45f..123dea37e8240 100644 --- a/gpt_index/composability/joint_qa_summary.py +++ b/llama_index/composability/joint_qa_summary.py @@ -3,16 +3,16 @@ from typing import Sequence, Optional -from gpt_index.callbacks.schema import CBEventType -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.list.base import GPTListIndex -from gpt_index.indices.vector_store import GPTVectorStoreIndex -from gpt_index.readers.schema.base import Document -from gpt_index.selectors.llm_selectors import LLMSingleSelector -from gpt_index.storage.storage_context import StorageContext - -from gpt_index.query_engine.router_query_engine import RouterQueryEngine -from gpt_index.tools.query_engine import QueryEngineTool +from llama_index.callbacks.schema import CBEventType +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.list.base import GPTListIndex +from llama_index.indices.vector_store import GPTVectorStoreIndex +from llama_index.readers.schema.base import Document +from llama_index.selectors.llm_selectors import LLMSingleSelector +from llama_index.storage.storage_context import StorageContext + +from llama_index.query_engine.router_query_engine import RouterQueryEngine +from llama_index.tools.query_engine import QueryEngineTool DEFAULT_SUMMARY_TEXT = "Use this index for summarization queries" DEFAULT_QA_TEXT = ( diff --git a/gpt_index/constants.py b/llama_index/constants.py similarity index 100% rename from gpt_index/constants.py rename to llama_index/constants.py diff --git a/gpt_index/data_structs/__init__.py b/llama_index/data_structs/__init__.py similarity index 55% rename from gpt_index/data_structs/__init__.py rename to llama_index/data_structs/__init__.py index 885e7603df972..507295a07e03a 100644 --- a/gpt_index/data_structs/__init__.py +++ b/llama_index/data_structs/__init__.py @@ -1,13 +1,13 @@ """Init file.""" -from gpt_index.data_structs.data_structs_v2 import ( +from llama_index.data_structs.data_structs_v2 import ( IndexDict, IndexGraph, IndexList, KeywordTable, ) -from gpt_index.data_structs.node_v2 import Node, NodeWithScore -from gpt_index.data_structs.table_v2 import StructDatapoint +from llama_index.data_structs.node_v2 import Node, NodeWithScore +from llama_index.data_structs.table_v2 import StructDatapoint __all__ = [ "Node", diff --git a/gpt_index/data_structs/data_structs.py b/llama_index/data_structs/data_structs.py similarity index 98% rename from gpt_index/data_structs/data_structs.py rename to llama_index/data_structs/data_structs.py index 3f9c8d93b0199..642ba87cfae89 100644 --- a/gpt_index/data_structs/data_structs.py +++ b/llama_index/data_structs/data_structs.py @@ -7,9 +7,9 @@ from dataclasses_json import DataClassJsonMixin -from gpt_index.data_structs.struct_type import IndexStructType -from gpt_index.schema import BaseDocument -from gpt_index.utils import get_new_int_id +from llama_index.data_structs.struct_type import IndexStructType +from llama_index.schema import BaseDocument +from llama_index.utils import get_new_int_id @dataclass diff --git a/gpt_index/data_structs/data_structs_v2.py b/llama_index/data_structs/data_structs_v2.py similarity index 98% rename from gpt_index/data_structs/data_structs_v2.py rename to llama_index/data_structs/data_structs_v2.py index eec5b3d2cf37e..a3c3ce5b43f6e 100644 --- a/gpt_index/data_structs/data_structs_v2.py +++ b/llama_index/data_structs/data_structs_v2.py @@ -11,8 +11,8 @@ from dataclasses_json import DataClassJsonMixin -from gpt_index.data_structs.node_v2 import Node -from gpt_index.data_structs.struct_type import IndexStructType +from llama_index.data_structs.node_v2 import Node +from llama_index.data_structs.struct_type import IndexStructType @dataclass diff --git a/gpt_index/data_structs/node_v2.py b/llama_index/data_structs/node_v2.py similarity index 99% rename from gpt_index/data_structs/node_v2.py rename to llama_index/data_structs/node_v2.py index cd2fde036a9fe..1717a33baa0c4 100644 --- a/gpt_index/data_structs/node_v2.py +++ b/llama_index/data_structs/node_v2.py @@ -16,7 +16,7 @@ from dataclasses_json import DataClassJsonMixin -from gpt_index.schema import BaseDocument +from llama_index.schema import BaseDocument _logger = logging.getLogger(__name__) diff --git a/gpt_index/data_structs/registry.py b/llama_index/data_structs/registry.py similarity index 74% rename from gpt_index/data_structs/registry.py rename to llama_index/data_structs/registry.py index d6d180a7af765..0c4d8c91c709c 100644 --- a/gpt_index/data_structs/registry.py +++ b/llama_index/data_structs/registry.py @@ -2,7 +2,7 @@ from typing import Dict, Type -from gpt_index.data_structs.data_structs_v2 import ( +from llama_index.data_structs.data_structs_v2 import ( KG, EmptyIndex, IndexDict, @@ -11,8 +11,8 @@ KeywordTable, V2IndexStruct, ) -from gpt_index.data_structs.struct_type import IndexStructType -from gpt_index.data_structs.table_v2 import PandasStructTable, SQLStructTable +from llama_index.data_structs.struct_type import IndexStructType +from llama_index.data_structs.table_v2 import PandasStructTable, SQLStructTable INDEX_STRUCT_TYPE_TO_INDEX_STRUCT_CLASS: Dict[IndexStructType, Type[V2IndexStruct]] = { diff --git a/gpt_index/data_structs/struct_type.py b/llama_index/data_structs/struct_type.py similarity index 100% rename from gpt_index/data_structs/struct_type.py rename to llama_index/data_structs/struct_type.py diff --git a/gpt_index/data_structs/table.py b/llama_index/data_structs/table.py similarity index 93% rename from gpt_index/data_structs/table.py rename to llama_index/data_structs/table.py index 0129a094dd358..dbb7155f61067 100644 --- a/gpt_index/data_structs/table.py +++ b/llama_index/data_structs/table.py @@ -5,7 +5,7 @@ from dataclasses_json import DataClassJsonMixin -from gpt_index.data_structs.data_structs import IndexStruct +from llama_index.data_structs.data_structs import IndexStruct @dataclass diff --git a/gpt_index/data_structs/table_v2.py b/llama_index/data_structs/table_v2.py similarity index 87% rename from gpt_index/data_structs/table_v2.py rename to llama_index/data_structs/table_v2.py index 3dbfbc151e201..bfcf600a489da 100644 --- a/gpt_index/data_structs/table_v2.py +++ b/llama_index/data_structs/table_v2.py @@ -5,8 +5,8 @@ from dataclasses_json import DataClassJsonMixin -from gpt_index.data_structs.data_structs_v2 import V2IndexStruct -from gpt_index.data_structs.struct_type import IndexStructType +from llama_index.data_structs.data_structs_v2 import V2IndexStruct +from llama_index.data_structs.struct_type import IndexStructType @dataclass diff --git a/gpt_index/embeddings/__init__.py b/llama_index/embeddings/__init__.py similarity index 100% rename from gpt_index/embeddings/__init__.py rename to llama_index/embeddings/__init__.py diff --git a/gpt_index/embeddings/base.py b/llama_index/embeddings/base.py similarity index 99% rename from gpt_index/embeddings/base.py rename to llama_index/embeddings/base.py index 01c212d6059a8..7413f27dc1110 100644 --- a/gpt_index/embeddings/base.py +++ b/llama_index/embeddings/base.py @@ -7,7 +7,7 @@ import numpy as np -from gpt_index.utils import globals_helper +from llama_index.utils import globals_helper # TODO: change to numpy array EMB_TYPE = List diff --git a/gpt_index/embeddings/google.py b/llama_index/embeddings/google.py similarity index 95% rename from gpt_index/embeddings/google.py rename to llama_index/embeddings/google.py index dfa459496e0f5..c092deae28eb9 100644 --- a/gpt_index/embeddings/google.py +++ b/llama_index/embeddings/google.py @@ -3,7 +3,7 @@ from typing import List, Optional -from gpt_index.embeddings.base import BaseEmbedding +from llama_index.embeddings.base import BaseEmbedding # Google Universal Sentence Encode v5 DEFAULT_HANDLE = "https://tfhub.dev/google/universal-sentence-encoder-large/5" diff --git a/gpt_index/embeddings/langchain.py b/llama_index/embeddings/langchain.py similarity index 95% rename from gpt_index/embeddings/langchain.py rename to llama_index/embeddings/langchain.py index dd286f97744a3..0b89aa7dbc9d1 100644 --- a/gpt_index/embeddings/langchain.py +++ b/llama_index/embeddings/langchain.py @@ -5,7 +5,7 @@ from langchain.embeddings.base import Embeddings as LCEmbeddings -from gpt_index.embeddings.base import BaseEmbedding +from llama_index.embeddings.base import BaseEmbedding class LangchainEmbedding(BaseEmbedding): diff --git a/gpt_index/embeddings/openai.py b/llama_index/embeddings/openai.py similarity index 99% rename from gpt_index/embeddings/openai.py rename to llama_index/embeddings/openai.py index bb2cfbe6392c3..54e57646f3dca 100644 --- a/gpt_index/embeddings/openai.py +++ b/llama_index/embeddings/openai.py @@ -6,7 +6,7 @@ import openai from tenacity import retry, stop_after_attempt, wait_random_exponential -from gpt_index.embeddings.base import BaseEmbedding +from llama_index.embeddings.base import BaseEmbedding class OpenAIEmbeddingMode(str, Enum): diff --git a/gpt_index/embeddings/utils.py b/llama_index/embeddings/utils.py similarity index 100% rename from gpt_index/embeddings/utils.py rename to llama_index/embeddings/utils.py diff --git a/llama_index/evaluation/__init__.py b/llama_index/evaluation/__init__.py new file mode 100644 index 0000000000000..e001c05a40a96 --- /dev/null +++ b/llama_index/evaluation/__init__.py @@ -0,0 +1,6 @@ +"""Evaluation modules.""" + +from llama_index.evaluation.base import ResponseEvaluator, QueryResponseEvaluator +from llama_index.evaluation.dataset_generation import DatasetGenerator + +__all__ = ["ResponseEvaluator", "QueryResponseEvaluator", "DatasetGenerator"] diff --git a/gpt_index/evaluation/base.py b/llama_index/evaluation/base.py similarity index 99% rename from gpt_index/evaluation/base.py rename to llama_index/evaluation/base.py index c11e9bef6e633..74b1ab920702e 100644 --- a/gpt_index/evaluation/base.py +++ b/llama_index/evaluation/base.py @@ -3,7 +3,7 @@ from typing import List, Optional -from gpt_index import ( +from llama_index import ( Document, GPTListIndex, QuestionAnswerPrompt, diff --git a/gpt_index/evaluation/dataset_generation.py b/llama_index/evaluation/dataset_generation.py similarity index 96% rename from gpt_index/evaluation/dataset_generation.py rename to llama_index/evaluation/dataset_generation.py index 193ebc0daa7cc..df39a86d78f40 100644 --- a/gpt_index/evaluation/dataset_generation.py +++ b/llama_index/evaluation/dataset_generation.py @@ -4,15 +4,15 @@ from typing import List, Optional import re -from gpt_index import ( +from llama_index import ( Document, GPTListIndex, QuestionAnswerPrompt, ServiceContext, LLMPredictor, ) -from gpt_index.indices.postprocessor.node import KeywordNodePostprocessor -from gpt_index.data_structs.node_v2 import Node, NodeWithScore +from llama_index.indices.postprocessor.node import KeywordNodePostprocessor +from llama_index.data_structs.node_v2 import Node, NodeWithScore from langchain.chat_models import ChatOpenAI diff --git a/gpt_index/experimental/evaporate/__init__.py b/llama_index/experimental/evaporate/__init__.py similarity index 80% rename from gpt_index/experimental/evaporate/__init__.py rename to llama_index/experimental/evaporate/__init__.py index d76fc2507f89b..11b60378a8d2a 100644 --- a/gpt_index/experimental/evaporate/__init__.py +++ b/llama_index/experimental/evaporate/__init__.py @@ -9,6 +9,6 @@ """ -from gpt_index.experimental.evaporate.base import EvaporateExtractor +from llama_index.experimental.evaporate.base import EvaporateExtractor __all__ = ["EvaporateExtractor"] diff --git a/gpt_index/experimental/evaporate/base.py b/llama_index/experimental/evaporate/base.py similarity index 96% rename from gpt_index/experimental/evaporate/base.py rename to llama_index/experimental/evaporate/base.py index 4caf1cf5a06db..a9d4551b264a7 100644 --- a/gpt_index/experimental/evaporate/base.py +++ b/llama_index/experimental/evaporate/base.py @@ -1,18 +1,18 @@ """Evaporate wrapper.""" -from gpt_index.indices.service_context import ServiceContext -from gpt_index.prompts.prompts import ( +from llama_index.indices.service_context import ServiceContext +from llama_index.prompts.prompts import ( QuestionAnswerPrompt, ) -from gpt_index.data_structs.node_v2 import Node +from llama_index.data_structs.node_v2 import Node from typing import Optional, List, Dict, Tuple -from gpt_index.experimental.evaporate.prompts import ( +from llama_index.experimental.evaporate.prompts import ( SchemaIDPrompt, FnGeneratePrompt, SCHEMA_ID_PROMPT, FN_GENERATION_PROMPT, ) -from gpt_index.indices.list.base import GPTListIndex +from llama_index.indices.list.base import GPTListIndex from collections import defaultdict from typing import Set, Any from contextlib import contextmanager diff --git a/gpt_index/experimental/evaporate/prompts.py b/llama_index/experimental/evaporate/prompts.py similarity index 97% rename from gpt_index/experimental/evaporate/prompts.py rename to llama_index/experimental/evaporate/prompts.py index b3d730d72d2e5..7236f62de1819 100644 --- a/gpt_index/experimental/evaporate/prompts.py +++ b/llama_index/experimental/evaporate/prompts.py @@ -6,8 +6,8 @@ """ -from gpt_index.prompts.prompts import Prompt -from gpt_index.prompts.prompt_type import PromptType +from llama_index.prompts.prompts import Prompt +from llama_index.prompts.prompt_type import PromptType from typing import List diff --git a/gpt_index/img_utils.py b/llama_index/img_utils.py similarity index 100% rename from gpt_index/img_utils.py rename to llama_index/img_utils.py diff --git a/llama_index/indices/__init__.py b/llama_index/indices/__init__.py new file mode 100644 index 0000000000000..21284cf2ebbe1 --- /dev/null +++ b/llama_index/indices/__init__.py @@ -0,0 +1,16 @@ +"""LlamaIndex data structures.""" + +# indices +from llama_index.indices.keyword_table.base import GPTKeywordTableIndex +from llama_index.indices.keyword_table.rake_base import GPTRAKEKeywordTableIndex +from llama_index.indices.keyword_table.simple_base import GPTSimpleKeywordTableIndex +from llama_index.indices.list.base import GPTListIndex +from llama_index.indices.tree.base import GPTTreeIndex + +__all__ = [ + "GPTKeywordTableIndex", + "GPTSimpleKeywordTableIndex", + "GPTRAKEKeywordTableIndex", + "GPTListIndex", + "GPTTreeIndex", +] diff --git a/gpt_index/indices/base.py b/llama_index/indices/base.py similarity index 92% rename from gpt_index/indices/base.py rename to llama_index/indices/base.py index b129e4acd6dd2..da5c376f6f7a6 100644 --- a/gpt_index/indices/base.py +++ b/llama_index/indices/base.py @@ -3,16 +3,16 @@ from abc import ABC, abstractmethod from typing import Any, Generic, List, Optional, Sequence, Type, TypeVar -from gpt_index.callbacks.schema import CBEventType -from gpt_index.data_structs.data_structs_v2 import V2IndexStruct -from gpt_index.data_structs.node_v2 import Node -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.indices.service_context import ServiceContext -from gpt_index.readers.schema.base import Document -from gpt_index.storage.docstore.types import BaseDocumentStore -from gpt_index.storage.storage_context import StorageContext -from gpt_index.token_counter.token_counter import llm_token_counter +from llama_index.callbacks.schema import CBEventType +from llama_index.data_structs.data_structs_v2 import V2IndexStruct +from llama_index.data_structs.node_v2 import Node +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.indices.service_context import ServiceContext +from llama_index.readers.schema.base import Document +from llama_index.storage.docstore.types import BaseDocumentStore +from llama_index.storage.storage_context import StorageContext +from llama_index.token_counter.token_counter import llm_token_counter IS = TypeVar("IS", bound=V2IndexStruct) IndexType = TypeVar("IndexType", bound="BaseGPTIndex") @@ -240,7 +240,7 @@ def as_retriever(self, **kwargs: Any) -> BaseRetriever: def as_query_engine(self, **kwargs: Any) -> BaseQueryEngine: # NOTE: lazy import - from gpt_index.query_engine.retriever_query_engine import RetrieverQueryEngine + from llama_index.query_engine.retriever_query_engine import RetrieverQueryEngine retriever = self.as_retriever(**kwargs) diff --git a/gpt_index/indices/base_retriever.py b/llama_index/indices/base_retriever.py similarity index 85% rename from gpt_index/indices/base_retriever.py rename to llama_index/indices/base_retriever.py index 72602f95a8072..cfc554fd4037b 100644 --- a/gpt_index/indices/base_retriever.py +++ b/llama_index/indices/base_retriever.py @@ -1,8 +1,8 @@ from abc import ABC, abstractmethod from typing import List -from gpt_index.data_structs.node_v2 import NodeWithScore +from llama_index.data_structs.node_v2 import NodeWithScore -from gpt_index.indices.query.schema import QueryBundle, QueryType +from llama_index.indices.query.schema import QueryBundle, QueryType class BaseRetriever(ABC): diff --git a/gpt_index/indices/common/__init__.py b/llama_index/indices/common/__init__.py similarity index 100% rename from gpt_index/indices/common/__init__.py rename to llama_index/indices/common/__init__.py diff --git a/gpt_index/indices/common/struct_store/__init__.py b/llama_index/indices/common/struct_store/__init__.py similarity index 100% rename from gpt_index/indices/common/struct_store/__init__.py rename to llama_index/indices/common/struct_store/__init__.py diff --git a/gpt_index/indices/common/struct_store/base.py b/llama_index/indices/common/struct_store/base.py similarity index 91% rename from gpt_index/indices/common/struct_store/base.py rename to llama_index/indices/common/struct_store/base.py index 96f47b93c37d9..52d56bfff308f 100644 --- a/gpt_index/indices/common/struct_store/base.py +++ b/llama_index/indices/common/struct_store/base.py @@ -4,30 +4,30 @@ from abc import abstractmethod from typing import Any, Callable, Dict, List, Optional, Sequence, cast -from gpt_index.callbacks.schema import CBEventType -from gpt_index.data_structs.node_v2 import Node -from gpt_index.data_structs.table import StructDatapoint -from gpt_index.indices.response.response_builder import get_response_builder -from gpt_index.indices.service_context import ServiceContext -from gpt_index.langchain_helpers.chain_wrapper import LLMPredictor -from gpt_index.langchain_helpers.sql_wrapper import SQLDatabase -from gpt_index.langchain_helpers.text_splitter import TextSplitter -from gpt_index.prompts.default_prompt_selectors import ( +from llama_index.callbacks.schema import CBEventType +from llama_index.data_structs.node_v2 import Node +from llama_index.data_structs.table import StructDatapoint +from llama_index.indices.response.response_builder import get_response_builder +from llama_index.indices.service_context import ServiceContext +from llama_index.langchain_helpers.chain_wrapper import LLMPredictor +from llama_index.langchain_helpers.sql_wrapper import SQLDatabase +from llama_index.langchain_helpers.text_splitter import TextSplitter +from llama_index.prompts.default_prompt_selectors import ( DEFAULT_REFINE_TABLE_CONTEXT_PROMPT_SEL, ) -from gpt_index.prompts.default_prompts import ( +from llama_index.prompts.default_prompts import ( DEFAULT_TABLE_CONTEXT_PROMPT, DEFAULT_TABLE_CONTEXT_QUERY, ) -from gpt_index.prompts.prompts import ( +from llama_index.prompts.prompts import ( QuestionAnswerPrompt, RefinePrompt, RefineTableContextPrompt, SchemaExtractPrompt, TableContextPrompt, ) -from gpt_index.schema import BaseDocument -from gpt_index.utils import truncate_text +from llama_index.schema import BaseDocument +from llama_index.utils import truncate_text logger = logging.getLogger(__name__) diff --git a/gpt_index/indices/common/struct_store/schema.py b/llama_index/indices/common/struct_store/schema.py similarity index 100% rename from gpt_index/indices/common/struct_store/schema.py rename to llama_index/indices/common/struct_store/schema.py diff --git a/gpt_index/indices/common/struct_store/sql.py b/llama_index/indices/common/struct_store/sql.py similarity index 88% rename from gpt_index/indices/common/struct_store/sql.py rename to llama_index/indices/common/struct_store/sql.py index 34d3f1207d360..bc403799b5646 100644 --- a/gpt_index/indices/common/struct_store/sql.py +++ b/llama_index/indices/common/struct_store/sql.py @@ -4,14 +4,14 @@ from sqlalchemy import Table -from gpt_index.data_structs.table import StructDatapoint -from gpt_index.indices.common.struct_store.base import ( +from llama_index.data_structs.table import StructDatapoint +from llama_index.indices.common.struct_store.base import ( OUTPUT_PARSER_TYPE, BaseStructDatapointExtractor, ) -from gpt_index.langchain_helpers.chain_wrapper import LLMPredictor -from gpt_index.langchain_helpers.sql_wrapper import SQLDatabase -from gpt_index.prompts.prompts import SchemaExtractPrompt +from llama_index.langchain_helpers.chain_wrapper import LLMPredictor +from llama_index.langchain_helpers.sql_wrapper import SQLDatabase +from llama_index.prompts.prompts import SchemaExtractPrompt class SQLStructDatapointExtractor(BaseStructDatapointExtractor): diff --git a/gpt_index/indices/common_tree/__init__.py b/llama_index/indices/common_tree/__init__.py similarity index 100% rename from gpt_index/indices/common_tree/__init__.py rename to llama_index/indices/common_tree/__init__.py diff --git a/gpt_index/indices/common_tree/base.py b/llama_index/indices/common_tree/base.py similarity index 93% rename from gpt_index/indices/common_tree/base.py rename to llama_index/indices/common_tree/base.py index 0e1abf8f63290..e43bbcfb0b4ed 100644 --- a/gpt_index/indices/common_tree/base.py +++ b/llama_index/indices/common_tree/base.py @@ -5,15 +5,15 @@ import logging from typing import Dict, List, Optional, Sequence, Tuple -from gpt_index.async_utils import run_async_tasks -from gpt_index.callbacks.schema import CBEventType -from gpt_index.data_structs.data_structs_v2 import IndexGraph -from gpt_index.data_structs.node_v2 import Node -from gpt_index.storage.docstore import BaseDocumentStore -from gpt_index.storage.docstore.registry import get_default_docstore -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.utils import get_sorted_node_list, truncate_text -from gpt_index.prompts.prompts import SummaryPrompt +from llama_index.async_utils import run_async_tasks +from llama_index.callbacks.schema import CBEventType +from llama_index.data_structs.data_structs_v2 import IndexGraph +from llama_index.data_structs.node_v2 import Node +from llama_index.storage.docstore import BaseDocumentStore +from llama_index.storage.docstore.registry import get_default_docstore +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.utils import get_sorted_node_list, truncate_text +from llama_index.prompts.prompts import SummaryPrompt logger = logging.getLogger(__name__) diff --git a/gpt_index/indices/composability/__init__.py b/llama_index/indices/composability/__init__.py similarity index 62% rename from gpt_index/indices/composability/__init__.py rename to llama_index/indices/composability/__init__.py index 1e3674e2b7cf7..4681fe4429e01 100644 --- a/gpt_index/indices/composability/__init__.py +++ b/llama_index/indices/composability/__init__.py @@ -1,6 +1,6 @@ """This module contains all classes used for composing graphs over indices.""" -from gpt_index.indices.composability.graph import ComposableGraph +from llama_index.indices.composability.graph import ComposableGraph __all__ = ["ComposableGraph"] diff --git a/gpt_index/indices/composability/graph.py b/llama_index/indices/composability/graph.py similarity index 90% rename from gpt_index/indices/composability/graph.py rename to llama_index/indices/composability/graph.py index 8d8c4480a4fbe..a9ee763cada45 100644 --- a/gpt_index/indices/composability/graph.py +++ b/llama_index/indices/composability/graph.py @@ -2,11 +2,11 @@ from typing import Any, Dict, List, Optional, Sequence, Type, cast -from gpt_index.data_structs.data_structs_v2 import V2IndexStruct -from gpt_index.data_structs.node_v2 import IndexNode, DocumentRelationship -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.indices.service_context import ServiceContext +from llama_index.data_structs.data_structs_v2 import V2IndexStruct +from llama_index.data_structs.node_v2 import IndexNode, DocumentRelationship +from llama_index.indices.base import BaseGPTIndex +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.indices.service_context import ServiceContext class ComposableGraph: @@ -104,7 +104,7 @@ def get_index(self, index_struct_id: Optional[str] = None) -> BaseGPTIndex: def as_query_engine(self, **kwargs: Any) -> BaseQueryEngine: # NOTE: lazy import - from gpt_index.query_engine.graph_query_engine import ( + from llama_index.query_engine.graph_query_engine import ( ComposableGraphQueryEngine, ) diff --git a/llama_index/indices/empty/__init__.py b/llama_index/indices/empty/__init__.py new file mode 100644 index 0000000000000..4736166183b5c --- /dev/null +++ b/llama_index/indices/empty/__init__.py @@ -0,0 +1,6 @@ +"""Empty Index.""" + +from llama_index.indices.empty.base import GPTEmptyIndex +from llama_index.indices.empty.retrievers import EmptyIndexRetriever + +__all__ = ["GPTEmptyIndex", "EmptyIndexRetriever"] diff --git a/gpt_index/indices/empty/base.py b/llama_index/indices/empty/base.py similarity index 83% rename from gpt_index/indices/empty/base.py rename to llama_index/indices/empty/base.py index 2301feaf3fac3..b75542def35f6 100644 --- a/gpt_index/indices/empty/base.py +++ b/llama_index/indices/empty/base.py @@ -7,11 +7,11 @@ from typing import Any, Optional, Sequence -from gpt_index.data_structs.data_structs_v2 import EmptyIndex -from gpt_index.data_structs.node_v2 import Node -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.service_context import ServiceContext +from llama_index.data_structs.data_structs_v2 import EmptyIndex +from llama_index.data_structs.node_v2 import Node +from llama_index.indices.base import BaseGPTIndex +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.service_context import ServiceContext class GPTEmptyIndex(BaseGPTIndex[EmptyIndex]): @@ -43,7 +43,7 @@ def __init__( def as_retriever(self, **kwargs: Any) -> BaseRetriever: # NOTE: lazy import - from gpt_index.indices.empty.retrievers import EmptyIndexRetriever + from llama_index.indices.empty.retrievers import EmptyIndexRetriever return EmptyIndexRetriever(self) diff --git a/gpt_index/indices/empty/retrievers.py b/llama_index/indices/empty/retrievers.py similarity index 68% rename from gpt_index/indices/empty/retrievers.py rename to llama_index/indices/empty/retrievers.py index 56f1cd92a1d39..09b0552a1db83 100644 --- a/gpt_index/indices/empty/retrievers.py +++ b/llama_index/indices/empty/retrievers.py @@ -1,13 +1,13 @@ """Default query for GPTEmptyIndex.""" from typing import Any, List, Optional -from gpt_index.indices.base_retriever import BaseRetriever +from llama_index.indices.base_retriever import BaseRetriever -from gpt_index.data_structs.node_v2 import NodeWithScore -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.prompts.default_prompts import DEFAULT_SIMPLE_INPUT_PROMPT -from gpt_index.prompts.prompts import SimpleInputPrompt +from llama_index.data_structs.node_v2 import NodeWithScore +from llama_index.indices.query.schema import QueryBundle +from llama_index.prompts.default_prompts import DEFAULT_SIMPLE_INPUT_PROMPT +from llama_index.prompts.prompts import SimpleInputPrompt -from gpt_index.indices.empty.base import GPTEmptyIndex +from llama_index.indices.empty.base import GPTEmptyIndex class EmptyIndexRetriever(BaseRetriever): diff --git a/gpt_index/indices/keyword_table/README.md b/llama_index/indices/keyword_table/README.md similarity index 97% rename from gpt_index/indices/keyword_table/README.md rename to llama_index/indices/keyword_table/README.md index 79c3ac394302a..ca4e5068efee2 100644 --- a/gpt_index/indices/keyword_table/README.md +++ b/llama_index/indices/keyword_table/README.md @@ -25,7 +25,7 @@ Use the popular RAKE keyword extractor. ### Usage ```python -from gpt_index import GPTKeywordTableIndex, SimpleDirectoryReader +from llama_index import GPTKeywordTableIndex, SimpleDirectoryReader # build index documents = SimpleDirectoryReader('data').load_data() diff --git a/gpt_index/indices/keyword_table/__init__.py b/llama_index/indices/keyword_table/__init__.py similarity index 54% rename from gpt_index/indices/keyword_table/__init__.py rename to llama_index/indices/keyword_table/__init__.py index b8dea994145ca..c06ceec9bf700 100644 --- a/gpt_index/indices/keyword_table/__init__.py +++ b/llama_index/indices/keyword_table/__init__.py @@ -1,14 +1,14 @@ """Keyword Table Index Data Structures.""" # indices -from gpt_index.indices.keyword_table.base import GPTKeywordTableIndex -from gpt_index.indices.keyword_table.retrievers import ( +from llama_index.indices.keyword_table.base import GPTKeywordTableIndex +from llama_index.indices.keyword_table.retrievers import ( KeywordTableGPTRetriever, KeywordTableRAKERetriever, KeywordTableSimpleRetriever, ) -from gpt_index.indices.keyword_table.rake_base import GPTRAKEKeywordTableIndex -from gpt_index.indices.keyword_table.simple_base import GPTSimpleKeywordTableIndex +from llama_index.indices.keyword_table.rake_base import GPTRAKEKeywordTableIndex +from llama_index.indices.keyword_table.simple_base import GPTSimpleKeywordTableIndex __all__ = [ "GPTKeywordTableIndex", diff --git a/gpt_index/indices/keyword_table/base.py b/llama_index/indices/keyword_table/base.py similarity index 92% rename from gpt_index/indices/keyword_table/base.py rename to llama_index/indices/keyword_table/base.py index 00df6d0dbfb57..a105bdaaeb959 100644 --- a/gpt_index/indices/keyword_table/base.py +++ b/llama_index/indices/keyword_table/base.py @@ -12,19 +12,19 @@ from enum import Enum from typing import Any, Optional, Sequence, Set, Union -from gpt_index.async_utils import run_async_tasks -from gpt_index.callbacks.schema import CBEventType -from gpt_index.data_structs.data_structs_v2 import KeywordTable -from gpt_index.data_structs.node_v2 import Node -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.keyword_table.utils import extract_keywords_given_response -from gpt_index.indices.service_context import ServiceContext -from gpt_index.prompts.default_prompts import ( +from llama_index.async_utils import run_async_tasks +from llama_index.callbacks.schema import CBEventType +from llama_index.data_structs.data_structs_v2 import KeywordTable +from llama_index.data_structs.node_v2 import Node +from llama_index.indices.base import BaseGPTIndex +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.keyword_table.utils import extract_keywords_given_response +from llama_index.indices.service_context import ServiceContext +from llama_index.prompts.default_prompts import ( DEFAULT_KEYWORD_EXTRACT_TEMPLATE, DEFAULT_QUERY_KEYWORD_EXTRACT_TEMPLATE, ) -from gpt_index.prompts.prompts import KeywordExtractPrompt +from llama_index.prompts.prompts import KeywordExtractPrompt DQKET = DEFAULT_QUERY_KEYWORD_EXTRACT_TEMPLATE @@ -93,7 +93,7 @@ def as_retriever( **kwargs: Any, ) -> BaseRetriever: # NOTE: lazy import - from gpt_index.indices.keyword_table.retrievers import ( + from llama_index.indices.keyword_table.retrievers import ( KeywordTableGPTRetriever, KeywordTableRAKERetriever, KeywordTableSimpleRetriever, diff --git a/gpt_index/indices/keyword_table/rake_base.py b/llama_index/indices/keyword_table/rake_base.py similarity index 76% rename from gpt_index/indices/keyword_table/rake_base.py rename to llama_index/indices/keyword_table/rake_base.py index 61b26ce6dc58e..143be3c1fc715 100644 --- a/gpt_index/indices/keyword_table/rake_base.py +++ b/llama_index/indices/keyword_table/rake_base.py @@ -6,8 +6,8 @@ from typing import Set -from gpt_index.indices.keyword_table.base import BaseGPTKeywordTableIndex -from gpt_index.indices.keyword_table.utils import rake_extract_keywords +from llama_index.indices.keyword_table.base import BaseGPTKeywordTableIndex +from llama_index.indices.keyword_table.utils import rake_extract_keywords class GPTRAKEKeywordTableIndex(BaseGPTKeywordTableIndex): diff --git a/gpt_index/indices/keyword_table/retrievers.py b/llama_index/indices/keyword_table/retrievers.py similarity index 91% rename from gpt_index/indices/keyword_table/retrievers.py rename to llama_index/indices/keyword_table/retrievers.py index e7b2df80c99d5..9ffeb9d505fe4 100644 --- a/gpt_index/indices/keyword_table/retrievers.py +++ b/llama_index/indices/keyword_table/retrievers.py @@ -4,24 +4,24 @@ from collections import defaultdict from typing import Any, Dict, List, Optional -from gpt_index.callbacks.schema import CBEventType -from gpt_index.data_structs.node_v2 import NodeWithScore -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.keyword_table.base import ( +from llama_index.callbacks.schema import CBEventType +from llama_index.data_structs.node_v2 import NodeWithScore +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.keyword_table.base import ( BaseGPTKeywordTableIndex, ) -from gpt_index.indices.keyword_table.utils import ( +from llama_index.indices.keyword_table.utils import ( extract_keywords_given_response, rake_extract_keywords, simple_extract_keywords, ) -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.prompts.default_prompts import ( +from llama_index.indices.query.schema import QueryBundle +from llama_index.prompts.default_prompts import ( DEFAULT_KEYWORD_EXTRACT_TEMPLATE, DEFAULT_QUERY_KEYWORD_EXTRACT_TEMPLATE, ) -from gpt_index.prompts.prompts import KeywordExtractPrompt, QueryKeywordExtractPrompt -from gpt_index.utils import truncate_text +from llama_index.prompts.prompts import KeywordExtractPrompt, QueryKeywordExtractPrompt +from llama_index.utils import truncate_text DQKET = DEFAULT_QUERY_KEYWORD_EXTRACT_TEMPLATE diff --git a/gpt_index/indices/keyword_table/simple_base.py b/llama_index/indices/keyword_table/simple_base.py similarity index 71% rename from gpt_index/indices/keyword_table/simple_base.py rename to llama_index/indices/keyword_table/simple_base.py index 4d542c38da0d3..930240865d0a8 100644 --- a/gpt_index/indices/keyword_table/simple_base.py +++ b/llama_index/indices/keyword_table/simple_base.py @@ -7,9 +7,9 @@ from typing import Set -from gpt_index.indices.keyword_table.base import BaseGPTKeywordTableIndex -from gpt_index.indices.keyword_table.utils import simple_extract_keywords -from gpt_index.prompts.default_prompts import DEFAULT_QUERY_KEYWORD_EXTRACT_TEMPLATE +from llama_index.indices.keyword_table.base import BaseGPTKeywordTableIndex +from llama_index.indices.keyword_table.utils import simple_extract_keywords +from llama_index.prompts.default_prompts import DEFAULT_QUERY_KEYWORD_EXTRACT_TEMPLATE DQKET = DEFAULT_QUERY_KEYWORD_EXTRACT_TEMPLATE diff --git a/gpt_index/indices/keyword_table/utils.py b/llama_index/indices/keyword_table/utils.py similarity index 95% rename from gpt_index/indices/keyword_table/utils.py rename to llama_index/indices/keyword_table/utils.py index 2a9b502dd54b7..e3d05648620cd 100644 --- a/gpt_index/indices/keyword_table/utils.py +++ b/llama_index/indices/keyword_table/utils.py @@ -5,8 +5,8 @@ import pandas as pd -from gpt_index.indices.utils import expand_tokens_with_subtokens -from gpt_index.utils import globals_helper +from llama_index.indices.utils import expand_tokens_with_subtokens +from llama_index.utils import globals_helper def simple_extract_keywords( diff --git a/llama_index/indices/knowledge_graph/__init__.py b/llama_index/indices/knowledge_graph/__init__.py new file mode 100644 index 0000000000000..17266699521c9 --- /dev/null +++ b/llama_index/indices/knowledge_graph/__init__.py @@ -0,0 +1,9 @@ +"""KG-based data structures.""" + +from llama_index.indices.knowledge_graph.base import GPTKnowledgeGraphIndex +from llama_index.indices.knowledge_graph.retrievers import KGTableRetriever + +__all__ = [ + "GPTKnowledgeGraphIndex", + "KGTableRetriever", +] diff --git a/gpt_index/indices/knowledge_graph/base.py b/llama_index/indices/knowledge_graph/base.py similarity index 95% rename from gpt_index/indices/knowledge_graph/base.py rename to llama_index/indices/knowledge_graph/base.py index 081413e3c64af..7f5db52432cc1 100644 --- a/gpt_index/indices/knowledge_graph/base.py +++ b/llama_index/indices/knowledge_graph/base.py @@ -11,16 +11,16 @@ import logging from typing import Any, List, Optional, Sequence, Tuple -from gpt_index.callbacks.schema import CBEventType -from gpt_index.data_structs.data_structs_v2 import KG -from gpt_index.data_structs.node_v2 import Node -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.prompts.default_prompts import ( +from llama_index.callbacks.schema import CBEventType +from llama_index.data_structs.data_structs_v2 import KG +from llama_index.data_structs.node_v2 import Node +from llama_index.indices.base import BaseGPTIndex +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.prompts.default_prompts import ( DEFAULT_KG_TRIPLET_EXTRACT_PROMPT, DEFAULT_QUERY_KEYWORD_EXTRACT_TEMPLATE, ) -from gpt_index.prompts.prompts import KnowledgeGraphPrompt +from llama_index.prompts.prompts import KnowledgeGraphPrompt DQKET = DEFAULT_QUERY_KEYWORD_EXTRACT_TEMPLATE @@ -71,7 +71,7 @@ def __init__( ) def as_retriever(self, **kwargs: Any) -> BaseRetriever: - from gpt_index.indices.knowledge_graph.retrievers import ( + from llama_index.indices.knowledge_graph.retrievers import ( KGRetrieverMode, KGTableRetriever, ) diff --git a/gpt_index/indices/knowledge_graph/retrievers.py b/llama_index/indices/knowledge_graph/retrievers.py similarity index 93% rename from gpt_index/indices/knowledge_graph/retrievers.py rename to llama_index/indices/knowledge_graph/retrievers.py index 6fcdf460f67f9..99a970e6795ad 100644 --- a/gpt_index/indices/knowledge_graph/retrievers.py +++ b/llama_index/indices/knowledge_graph/retrievers.py @@ -4,18 +4,18 @@ from enum import Enum from typing import Any, Dict, List, Optional -from gpt_index.callbacks.schema import CBEventType -from gpt_index.data_structs.node_v2 import Node, NodeWithScore -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.keyword_table.utils import extract_keywords_given_response -from gpt_index.indices.knowledge_graph.base import GPTKnowledgeGraphIndex -from gpt_index.indices.query.embedding_utils import ( +from llama_index.callbacks.schema import CBEventType +from llama_index.data_structs.node_v2 import Node, NodeWithScore +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.keyword_table.utils import extract_keywords_given_response +from llama_index.indices.knowledge_graph.base import GPTKnowledgeGraphIndex +from llama_index.indices.query.embedding_utils import ( get_top_k_embeddings, ) -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.prompts.default_prompts import DEFAULT_QUERY_KEYWORD_EXTRACT_TEMPLATE -from gpt_index.prompts.prompts import QueryKeywordExtractPrompt -from gpt_index.utils import truncate_text +from llama_index.indices.query.schema import QueryBundle +from llama_index.prompts.default_prompts import DEFAULT_QUERY_KEYWORD_EXTRACT_TEMPLATE +from llama_index.prompts.prompts import QueryKeywordExtractPrompt +from llama_index.utils import truncate_text DQKET = DEFAULT_QUERY_KEYWORD_EXTRACT_TEMPLATE diff --git a/gpt_index/indices/list/README.md b/llama_index/indices/list/README.md similarity index 94% rename from gpt_index/indices/list/README.md rename to llama_index/indices/list/README.md index 2143789c593ae..23e98512adbf8 100644 --- a/gpt_index/indices/list/README.md +++ b/llama_index/indices/list/README.md @@ -11,7 +11,7 @@ During query-time, GPT List Index constructs an answer using the _create and ref **Usage** ```python -from gpt_index import GPTListIndex, SimpleDirectoryReader +from llama_index import GPTListIndex, SimpleDirectoryReader # build index documents = SimpleDirectoryReader('data').load_data() diff --git a/gpt_index/indices/list/__init__.py b/llama_index/indices/list/__init__.py similarity index 64% rename from gpt_index/indices/list/__init__.py rename to llama_index/indices/list/__init__.py index 4f82be7e959c0..b620afe0a695d 100644 --- a/gpt_index/indices/list/__init__.py +++ b/llama_index/indices/list/__init__.py @@ -1,7 +1,7 @@ """List-based data structures.""" -from gpt_index.indices.list.base import GPTListIndex -from gpt_index.indices.list.retrievers import ( +from llama_index.indices.list.base import GPTListIndex +from llama_index.indices.list.retrievers import ( ListIndexRetriever, ListIndexEmbeddingRetriever, ) diff --git a/gpt_index/indices/list/base.py b/llama_index/indices/list/base.py similarity index 89% rename from gpt_index/indices/list/base.py rename to llama_index/indices/list/base.py index 1b0830a0fe16e..a9c092d65e5dc 100644 --- a/gpt_index/indices/list/base.py +++ b/llama_index/indices/list/base.py @@ -8,11 +8,11 @@ from enum import Enum from typing import Any, Optional, Sequence, Union -from gpt_index.data_structs.data_structs_v2 import IndexList -from gpt_index.data_structs.node_v2 import Node -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.service_context import ServiceContext +from llama_index.data_structs.data_structs_v2 import IndexList +from llama_index.data_structs.node_v2 import Node +from llama_index.indices.base import BaseGPTIndex +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.service_context import ServiceContext class ListRetrieverMode(str, Enum): @@ -60,7 +60,7 @@ def as_retriever( retriever_mode: Union[str, ListRetrieverMode] = ListRetrieverMode.DEFAULT, **kwargs: Any, ) -> BaseRetriever: - from gpt_index.indices.list.retrievers import ( + from llama_index.indices.list.retrievers import ( ListIndexEmbeddingRetriever, ListIndexRetriever, ) diff --git a/gpt_index/indices/list/retrievers.py b/llama_index/indices/list/retrievers.py similarity index 91% rename from gpt_index/indices/list/retrievers.py rename to llama_index/indices/list/retrievers.py index 79cbc4e6d6f8b..86d3f05117ee2 100644 --- a/gpt_index/indices/list/retrievers.py +++ b/llama_index/indices/list/retrievers.py @@ -2,14 +2,14 @@ import logging from typing import Any, List, Optional, Tuple -from gpt_index.callbacks.schema import CBEventType -from gpt_index.data_structs.node_v2 import Node, NodeWithScore -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.query.embedding_utils import ( +from llama_index.callbacks.schema import CBEventType +from llama_index.data_structs.node_v2 import Node, NodeWithScore +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.query.embedding_utils import ( get_top_k_embeddings, ) -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.list.base import GPTListIndex +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.list.base import GPTListIndex logger = logging.getLogger(__name__) diff --git a/gpt_index/indices/loading.py b/llama_index/indices/loading.py similarity index 92% rename from gpt_index/indices/loading.py rename to llama_index/indices/loading.py index ffa7ec8e8c03d..780bb41a0f860 100644 --- a/gpt_index/indices/loading.py +++ b/llama_index/indices/loading.py @@ -1,8 +1,8 @@ from typing import Any, List, Optional, Sequence -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.indices.composability.graph import ComposableGraph -from gpt_index.indices.registry import INDEX_STRUCT_TYPE_TO_INDEX_CLASS -from gpt_index.storage.storage_context import StorageContext +from llama_index.indices.base import BaseGPTIndex +from llama_index.indices.composability.graph import ComposableGraph +from llama_index.indices.registry import INDEX_STRUCT_TYPE_TO_INDEX_CLASS +from llama_index.storage.storage_context import StorageContext import logging diff --git a/gpt_index/indices/postprocessor/__init__.py b/llama_index/indices/postprocessor/__init__.py similarity index 73% rename from gpt_index/indices/postprocessor/__init__.py rename to llama_index/indices/postprocessor/__init__.py index 520ae52626e30..2b08315c00abb 100644 --- a/gpt_index/indices/postprocessor/__init__.py +++ b/llama_index/indices/postprocessor/__init__.py @@ -1,19 +1,19 @@ """Node PostProcessor module.""" -from gpt_index.indices.postprocessor.base import BasePostprocessor -from gpt_index.indices.postprocessor.node import ( +from llama_index.indices.postprocessor.base import BasePostprocessor +from llama_index.indices.postprocessor.node import ( SimilarityPostprocessor, KeywordNodePostprocessor, PrevNextNodePostprocessor, AutoPrevNextNodePostprocessor, ) -from gpt_index.indices.postprocessor.node_recency import ( +from llama_index.indices.postprocessor.node_recency import ( FixedRecencyPostprocessor, EmbeddingRecencyPostprocessor, TimeWeightedPostprocessor, ) -from gpt_index.indices.postprocessor.pii import ( +from llama_index.indices.postprocessor.pii import ( PIINodePostprocessor, NERPIINodePostprocessor, ) diff --git a/gpt_index/indices/postprocessor/base.py b/llama_index/indices/postprocessor/base.py similarity index 100% rename from gpt_index/indices/postprocessor/base.py rename to llama_index/indices/postprocessor/base.py diff --git a/gpt_index/indices/postprocessor/node.py b/llama_index/indices/postprocessor/node.py similarity index 95% rename from gpt_index/indices/postprocessor/node.py rename to llama_index/indices/postprocessor/node.py index 47da67cde9cd7..630c0ebf90dc0 100644 --- a/gpt_index/indices/postprocessor/node.py +++ b/llama_index/indices/postprocessor/node.py @@ -7,14 +7,14 @@ from pydantic import BaseModel, Field, validator import logging -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.response.type import ResponseMode -from gpt_index.indices.service_context import ServiceContext -from gpt_index.prompts.prompts import QuestionAnswerPrompt, RefinePrompt -from gpt_index.storage.docstore import BaseDocumentStore -from gpt_index.data_structs.node_v2 import DocumentRelationship, NodeWithScore -from gpt_index.indices.postprocessor.base import BasePostprocessor -from gpt_index.indices.response.response_builder import get_response_builder +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.response.type import ResponseMode +from llama_index.indices.service_context import ServiceContext +from llama_index.prompts.prompts import QuestionAnswerPrompt, RefinePrompt +from llama_index.storage.docstore import BaseDocumentStore +from llama_index.data_structs.node_v2 import DocumentRelationship, NodeWithScore +from llama_index.indices.postprocessor.base import BasePostprocessor +from llama_index.indices.response.response_builder import get_response_builder logger = logging.getLogger(__name__) diff --git a/gpt_index/indices/postprocessor/node_recency.py b/llama_index/indices/postprocessor/node_recency.py similarity index 97% rename from gpt_index/indices/postprocessor/node_recency.py rename to llama_index/indices/postprocessor/node_recency.py index b8a7ea60987aa..ae1a9d7ee3e11 100644 --- a/gpt_index/indices/postprocessor/node_recency.py +++ b/llama_index/indices/postprocessor/node_recency.py @@ -1,8 +1,8 @@ """Node recency post-processor.""" -from gpt_index.indices.postprocessor.node import BaseNodePostprocessor -from gpt_index.indices.service_context import ServiceContext -from gpt_index.data_structs.node_v2 import NodeWithScore +from llama_index.indices.postprocessor.node import BaseNodePostprocessor +from llama_index.indices.service_context import ServiceContext +from llama_index.data_structs.node_v2 import NodeWithScore from pydantic import Field from typing import Optional, Dict, List, Set import pandas as pd diff --git a/gpt_index/indices/postprocessor/pii.py b/llama_index/indices/postprocessor/pii.py similarity index 94% rename from gpt_index/indices/postprocessor/pii.py rename to llama_index/indices/postprocessor/pii.py index 138fd15e1f841..cd8af849e3658 100644 --- a/gpt_index/indices/postprocessor/pii.py +++ b/llama_index/indices/postprocessor/pii.py @@ -1,10 +1,10 @@ """PII postprocessor.""" -from gpt_index.indices.postprocessor.node import BaseNodePostprocessor -from gpt_index.data_structs.node_v2 import NodeWithScore +from llama_index.indices.postprocessor.node import BaseNodePostprocessor +from llama_index.data_structs.node_v2 import NodeWithScore from typing import List, Optional, Dict, Tuple, Callable -from gpt_index.indices.service_context import ServiceContext -from gpt_index.prompts.prompts import QuestionAnswerPrompt +from llama_index.indices.service_context import ServiceContext +from llama_index.prompts.prompts import QuestionAnswerPrompt from copy import deepcopy import json diff --git a/gpt_index/indices/prompt_helper.py b/llama_index/indices/prompt_helper.py similarity index 96% rename from gpt_index/indices/prompt_helper.py rename to llama_index/indices/prompt_helper.py index 6645035c98c06..164685a85bc00 100644 --- a/gpt_index/indices/prompt_helper.py +++ b/llama_index/indices/prompt_helper.py @@ -7,12 +7,12 @@ from typing import Callable, List, Optional, Sequence -from gpt_index.constants import MAX_CHUNK_OVERLAP -from gpt_index.data_structs.node_v2 import Node -from gpt_index.langchain_helpers.chain_wrapper import LLMPredictor -from gpt_index.langchain_helpers.text_splitter import TokenTextSplitter -from gpt_index.prompts.base import Prompt -from gpt_index.utils import globals_helper +from llama_index.constants import MAX_CHUNK_OVERLAP +from llama_index.data_structs.node_v2 import Node +from llama_index.langchain_helpers.chain_wrapper import LLMPredictor +from llama_index.langchain_helpers.text_splitter import TokenTextSplitter +from llama_index.prompts.base import Prompt +from llama_index.utils import globals_helper class PromptHelper: diff --git a/llama_index/indices/query/__init__.py b/llama_index/indices/query/__init__.py new file mode 100644 index 0000000000000..89e2cc08f3e69 --- /dev/null +++ b/llama_index/indices/query/__init__.py @@ -0,0 +1,7 @@ +"""Init file.""" + +from llama_index.indices.query.response_synthesis import ResponseSynthesizer + +__all__ = [ + "ResponseSynthesizer", +] diff --git a/gpt_index/indices/query/base.py b/llama_index/indices/query/base.py similarity index 91% rename from gpt_index/indices/query/base.py rename to llama_index/indices/query/base.py index ae4785e130136..3d5c5748f70dd 100644 --- a/gpt_index/indices/query/base.py +++ b/llama_index/indices/query/base.py @@ -3,10 +3,10 @@ import logging from abc import ABC, abstractmethod from typing import List, Optional, Sequence -from gpt_index.data_structs.node_v2 import NodeWithScore +from llama_index.data_structs.node_v2 import NodeWithScore -from gpt_index.indices.query.schema import QueryBundle, QueryType -from gpt_index.response.schema import ( +from llama_index.indices.query.schema import QueryBundle, QueryType +from llama_index.response.schema import ( RESPONSE_TYPE, ) diff --git a/gpt_index/indices/query/embedding_utils.py b/llama_index/indices/query/embedding_utils.py similarity index 95% rename from gpt_index/indices/query/embedding_utils.py rename to llama_index/indices/query/embedding_utils.py index 1fd1cf59b031b..acfd90e4a8694 100644 --- a/gpt_index/indices/query/embedding_utils.py +++ b/llama_index/indices/query/embedding_utils.py @@ -2,9 +2,9 @@ from typing import Callable, List, Optional, Tuple -from gpt_index.embeddings.base import similarity as default_similarity_fn +from llama_index.embeddings.base import similarity as default_similarity_fn import numpy as np -from gpt_index.vector_stores.types import VectorStoreQueryMode +from llama_index.vector_stores.types import VectorStoreQueryMode def get_top_k_embeddings( diff --git a/gpt_index/indices/query/query_transform/__init__.py b/llama_index/indices/query/query_transform/__init__.py similarity index 78% rename from gpt_index/indices/query/query_transform/__init__.py rename to llama_index/indices/query/query_transform/__init__.py index a366a978ed369..c133534a500ca 100644 --- a/gpt_index/indices/query/query_transform/__init__.py +++ b/llama_index/indices/query/query_transform/__init__.py @@ -1,6 +1,6 @@ """Query Transforms.""" -from gpt_index.indices.query.query_transform.base import ( +from llama_index.indices.query.query_transform.base import ( HyDEQueryTransform, DecomposeQueryTransform, StepDecomposeQueryTransform, diff --git a/gpt_index/indices/query/query_transform/base.py b/llama_index/indices/query/query_transform/base.py similarity index 95% rename from gpt_index/indices/query/query_transform/base.py rename to llama_index/indices/query/query_transform/base.py index e324542ffac30..e47ce9acaab54 100644 --- a/gpt_index/indices/query/query_transform/base.py +++ b/llama_index/indices/query/query_transform/base.py @@ -6,7 +6,7 @@ from langchain.input import print_text -from gpt_index.indices.query.query_transform.prompts import ( +from llama_index.indices.query.query_transform.prompts import ( DEFAULT_DECOMPOSE_QUERY_TRANSFORM_PROMPT, DEFAULT_IMAGE_OUTPUT_PROMPT, DEFAULT_STEP_DECOMPOSE_QUERY_TRANSFORM_PROMPT, @@ -14,11 +14,11 @@ ImageOutputQueryTransformPrompt, StepDecomposeQueryTransformPrompt, ) -from gpt_index.indices.query.schema import QueryBundle, QueryType -from gpt_index.langchain_helpers.chain_wrapper import LLMPredictor -from gpt_index.prompts.base import Prompt -from gpt_index.prompts.default_prompts import DEFAULT_HYDE_PROMPT -from gpt_index.response.schema import Response +from llama_index.indices.query.schema import QueryBundle, QueryType +from llama_index.langchain_helpers.chain_wrapper import LLMPredictor +from llama_index.prompts.base import Prompt +from llama_index.prompts.default_prompts import DEFAULT_HYDE_PROMPT +from llama_index.response.schema import Response class BaseQueryTransform: diff --git a/gpt_index/indices/query/query_transform/prompts.py b/llama_index/indices/query/query_transform/prompts.py similarity index 98% rename from gpt_index/indices/query/query_transform/prompts.py rename to llama_index/indices/query/query_transform/prompts.py index 523b4d424846b..df7d58c6d9c2c 100644 --- a/gpt_index/indices/query/query_transform/prompts.py +++ b/llama_index/indices/query/query_transform/prompts.py @@ -3,8 +3,8 @@ from typing import List -from gpt_index.prompts.base import Prompt -from gpt_index.prompts.prompt_type import PromptType +from llama_index.prompts.base import Prompt +from llama_index.prompts.prompt_type import PromptType class DecomposeQueryTransformPrompt(Prompt): diff --git a/gpt_index/indices/query/response_synthesis.py b/llama_index/indices/query/response_synthesis.py similarity index 93% rename from gpt_index/indices/query/response_synthesis.py rename to llama_index/indices/query/response_synthesis.py index 76bd6f0c44f87..79a9c5b9266a1 100644 --- a/gpt_index/indices/query/response_synthesis.py +++ b/llama_index/indices/query/response_synthesis.py @@ -8,27 +8,27 @@ Sequence, ) -from gpt_index.data_structs.node_v2 import Node, NodeWithScore -from gpt_index.indices.postprocessor.node import BaseNodePostprocessor -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.response.response_builder import ( +from llama_index.data_structs.node_v2 import Node, NodeWithScore +from llama_index.indices.postprocessor.node import BaseNodePostprocessor +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.response.response_builder import ( BaseResponseBuilder, ResponseMode, get_response_builder, ) -from gpt_index.indices.service_context import ServiceContext -from gpt_index.optimization.optimizer import BaseTokenUsageOptimizer -from gpt_index.prompts.prompts import ( +from llama_index.indices.service_context import ServiceContext +from llama_index.optimization.optimizer import BaseTokenUsageOptimizer +from llama_index.prompts.prompts import ( QuestionAnswerPrompt, RefinePrompt, SimpleInputPrompt, ) -from gpt_index.response.schema import ( +from llama_index.response.schema import ( RESPONSE_TYPE, Response, StreamingResponse, ) -from gpt_index.types import RESPONSE_TEXT_TYPE +from llama_index.types import RESPONSE_TEXT_TYPE logger = logging.getLogger(__name__) diff --git a/gpt_index/indices/query/schema.py b/llama_index/indices/query/schema.py similarity index 100% rename from gpt_index/indices/query/schema.py rename to llama_index/indices/query/schema.py diff --git a/gpt_index/indices/registry.py b/llama_index/indices/registry.py similarity index 57% rename from gpt_index/indices/registry.py rename to llama_index/indices/registry.py index c75f8842e589e..5207d6f42aa92 100644 --- a/gpt_index/indices/registry.py +++ b/llama_index/indices/registry.py @@ -2,7 +2,7 @@ from typing import Dict, Type -from gpt_index.data_structs.data_structs_v2 import ( +from llama_index.data_structs.data_structs_v2 import ( KG, EmptyIndex, IndexDict, @@ -11,17 +11,17 @@ KeywordTable, V2IndexStruct, ) -from gpt_index.data_structs.struct_type import IndexStructType -from gpt_index.data_structs.table_v2 import PandasStructTable, SQLStructTable -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.indices.empty.base import GPTEmptyIndex -from gpt_index.indices.keyword_table.base import GPTKeywordTableIndex -from gpt_index.indices.knowledge_graph.base import GPTKnowledgeGraphIndex -from gpt_index.indices.list.base import GPTListIndex -from gpt_index.indices.struct_store.pandas import GPTPandasIndex -from gpt_index.indices.struct_store.sql import GPTSQLStructStoreIndex -from gpt_index.indices.tree.base import GPTTreeIndex -from gpt_index.indices.vector_store.base import GPTVectorStoreIndex +from llama_index.data_structs.struct_type import IndexStructType +from llama_index.data_structs.table_v2 import PandasStructTable, SQLStructTable +from llama_index.indices.base import BaseGPTIndex +from llama_index.indices.empty.base import GPTEmptyIndex +from llama_index.indices.keyword_table.base import GPTKeywordTableIndex +from llama_index.indices.knowledge_graph.base import GPTKnowledgeGraphIndex +from llama_index.indices.list.base import GPTListIndex +from llama_index.indices.struct_store.pandas import GPTPandasIndex +from llama_index.indices.struct_store.sql import GPTSQLStructStoreIndex +from llama_index.indices.tree.base import GPTTreeIndex +from llama_index.indices.vector_store.base import GPTVectorStoreIndex INDEX_STRUCT_TYPE_TO_INDEX_STRUCT_CLASS: Dict[IndexStructType, Type[V2IndexStruct]] = { IndexStructType.TREE: IndexGraph, diff --git a/gpt_index/indices/response/__init__.py b/llama_index/indices/response/__init__.py similarity index 71% rename from gpt_index/indices/response/__init__.py rename to llama_index/indices/response/__init__.py index 88e8d602449b7..eafbbceb0eb1d 100644 --- a/gpt_index/indices/response/__init__.py +++ b/llama_index/indices/response/__init__.py @@ -1,7 +1,7 @@ """Init file.""" -from gpt_index.indices.response.type import ResponseMode -from gpt_index.indices.response.response_builder import ( +from llama_index.indices.response.type import ResponseMode +from llama_index.indices.response.response_builder import ( get_response_builder, Refine, SimpleSummarize, diff --git a/gpt_index/indices/response/response_builder.py b/llama_index/indices/response/response_builder.py similarity index 96% rename from gpt_index/indices/response/response_builder.py rename to llama_index/indices/response/response_builder.py index 3396e9523fa9c..0d422dbbf9a25 100644 --- a/gpt_index/indices/response/response_builder.py +++ b/llama_index/indices/response/response_builder.py @@ -11,29 +11,29 @@ import logging from typing import Any, Dict, Generator, List, Optional, Sequence, Tuple, cast -from gpt_index.callbacks.schema import CBEventType -from gpt_index.data_structs.data_structs_v2 import IndexGraph -from gpt_index.data_structs.node_v2 import Node -from gpt_index.storage.docstore.registry import get_default_docstore -from gpt_index.indices.common_tree.base import GPTTreeIndexBuilder -from gpt_index.indices.response.type import ResponseMode -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.utils import get_sorted_node_list, truncate_text -from gpt_index.prompts.default_prompt_selectors import DEFAULT_REFINE_PROMPT_SEL -from gpt_index.prompts.default_prompts import ( +from llama_index.callbacks.schema import CBEventType +from llama_index.data_structs.data_structs_v2 import IndexGraph +from llama_index.data_structs.node_v2 import Node +from llama_index.storage.docstore.registry import get_default_docstore +from llama_index.indices.common_tree.base import GPTTreeIndexBuilder +from llama_index.indices.response.type import ResponseMode +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.utils import get_sorted_node_list, truncate_text +from llama_index.prompts.default_prompt_selectors import DEFAULT_REFINE_PROMPT_SEL +from llama_index.prompts.default_prompts import ( DEFAULT_SIMPLE_INPUT_PROMPT, DEFAULT_TEXT_QA_PROMPT, ) -from gpt_index.prompts.prompts import ( +from llama_index.prompts.prompts import ( QuestionAnswerPrompt, RefinePrompt, SimpleInputPrompt, SummaryPrompt, ) -from gpt_index.response.utils import get_response_text -from gpt_index.token_counter.token_counter import llm_token_counter -from gpt_index.types import RESPONSE_TEXT_TYPE -from gpt_index.utils import temp_set_attrs +from llama_index.response.utils import get_response_text +from llama_index.token_counter.token_counter import llm_token_counter +from llama_index.types import RESPONSE_TEXT_TYPE +from llama_index.utils import temp_set_attrs logger = logging.getLogger(__name__) diff --git a/gpt_index/indices/response/type.py b/llama_index/indices/response/type.py similarity index 100% rename from gpt_index/indices/response/type.py rename to llama_index/indices/response/type.py diff --git a/gpt_index/indices/service_context.py b/llama_index/indices/service_context.py similarity index 85% rename from gpt_index/indices/service_context.py rename to llama_index/indices/service_context.py index 5ba3ab8e9e3d3..b58e74fc3a136 100644 --- a/gpt_index/indices/service_context.py +++ b/llama_index/indices/service_context.py @@ -1,15 +1,15 @@ from dataclasses import dataclass from typing import Optional -from gpt_index.callbacks.base import CallbackManager -from gpt_index.embeddings.base import BaseEmbedding -from gpt_index.embeddings.openai import OpenAIEmbedding -from gpt_index.indices.prompt_helper import PromptHelper -from gpt_index.langchain_helpers.chain_wrapper import LLMPredictor -from gpt_index.langchain_helpers.text_splitter import TokenTextSplitter -from gpt_index.logger import LlamaLogger -from gpt_index.node_parser.interface import NodeParser -from gpt_index.node_parser.simple import SimpleNodeParser +from llama_index.callbacks.base import CallbackManager +from llama_index.embeddings.base import BaseEmbedding +from llama_index.embeddings.openai import OpenAIEmbedding +from llama_index.indices.prompt_helper import PromptHelper +from llama_index.langchain_helpers.chain_wrapper import LLMPredictor +from llama_index.langchain_helpers.text_splitter import TokenTextSplitter +from llama_index.logger import LlamaLogger +from llama_index.node_parser.interface import NodeParser +from llama_index.node_parser.simple import SimpleNodeParser def _get_default_node_parser(chunk_size_limit: Optional[int] = None) -> NodeParser: diff --git a/gpt_index/indices/struct_store/__init__.py b/llama_index/indices/struct_store/__init__.py similarity index 58% rename from gpt_index/indices/struct_store/__init__.py rename to llama_index/indices/struct_store/__init__.py index e9a39e501de45..fe68f34c440e6 100644 --- a/gpt_index/indices/struct_store/__init__.py +++ b/llama_index/indices/struct_store/__init__.py @@ -1,12 +1,12 @@ """Structured store indices.""" -from gpt_index.indices.struct_store.pandas import GPTPandasIndex -from gpt_index.indices.struct_store.pandas_query import GPTNLPandasQueryEngine -from gpt_index.indices.struct_store.sql import ( +from llama_index.indices.struct_store.pandas import GPTPandasIndex +from llama_index.indices.struct_store.pandas_query import GPTNLPandasQueryEngine +from llama_index.indices.struct_store.sql import ( GPTSQLStructStoreIndex, SQLContextContainerBuilder, ) -from gpt_index.indices.struct_store.sql_query import ( +from llama_index.indices.struct_store.sql_query import ( GPTNLStructStoreQueryEngine, GPTSQLStructStoreQueryEngine, ) diff --git a/gpt_index/indices/struct_store/base.py b/llama_index/indices/struct_store/base.py similarity index 82% rename from gpt_index/indices/struct_store/base.py rename to llama_index/indices/struct_store/base.py index 62f66f4a136f3..6183ad9a1ce29 100644 --- a/gpt_index/indices/struct_store/base.py +++ b/llama_index/indices/struct_store/base.py @@ -3,12 +3,12 @@ import re from typing import Any, Callable, Dict, Generic, Optional, Sequence, TypeVar -from gpt_index.data_structs.node_v2 import Node -from gpt_index.data_structs.table_v2 import BaseStructTable -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.indices.service_context import ServiceContext -from gpt_index.prompts.default_prompts import DEFAULT_SCHEMA_EXTRACT_PROMPT -from gpt_index.prompts.prompts import SchemaExtractPrompt +from llama_index.data_structs.node_v2 import Node +from llama_index.data_structs.table_v2 import BaseStructTable +from llama_index.indices.base import BaseGPTIndex +from llama_index.indices.service_context import ServiceContext +from llama_index.prompts.default_prompts import DEFAULT_SCHEMA_EXTRACT_PROMPT +from llama_index.prompts.prompts import SchemaExtractPrompt BST = TypeVar("BST", bound=BaseStructTable) diff --git a/gpt_index/indices/struct_store/container_builder.py b/llama_index/indices/struct_store/container_builder.py similarity index 92% rename from gpt_index/indices/struct_store/container_builder.py rename to llama_index/indices/struct_store/container_builder.py index 4fcb7c2e5b802..dfdd87ede6ac8 100644 --- a/gpt_index/indices/struct_store/container_builder.py +++ b/llama_index/indices/struct_store/container_builder.py @@ -3,13 +3,13 @@ from typing import Any, Dict, List, Optional, Type -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.indices.common.struct_store.base import SQLDocumentContextBuilder -from gpt_index.indices.common.struct_store.schema import SQLContextContainer -from gpt_index.indices.query.schema import QueryType -from gpt_index.langchain_helpers.sql_wrapper import SQLDatabase -from gpt_index.readers.base import Document -from gpt_index.schema import BaseDocument +from llama_index.indices.base import BaseGPTIndex +from llama_index.indices.common.struct_store.base import SQLDocumentContextBuilder +from llama_index.indices.common.struct_store.schema import SQLContextContainer +from llama_index.indices.query.schema import QueryType +from llama_index.langchain_helpers.sql_wrapper import SQLDatabase +from llama_index.readers.base import Document +from llama_index.schema import BaseDocument DEFAULT_CONTEXT_QUERY_TMPL = ( "Please return the relevant tables (including the full schema) " diff --git a/gpt_index/indices/struct_store/pandas.py b/llama_index/indices/struct_store/pandas.py similarity index 82% rename from gpt_index/indices/struct_store/pandas.py rename to llama_index/indices/struct_store/pandas.py index 9382346dba0de..ddd91c6e01e0c 100644 --- a/gpt_index/indices/struct_store/pandas.py +++ b/llama_index/indices/struct_store/pandas.py @@ -2,11 +2,11 @@ from typing import Any, Optional, Sequence -from gpt_index.data_structs.node_v2 import Node -from gpt_index.data_structs.table_v2 import PandasStructTable -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.indices.struct_store.base import BaseGPTStructStoreIndex +from llama_index.data_structs.node_v2 import Node +from llama_index.data_structs.table_v2 import PandasStructTable +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.indices.struct_store.base import BaseGPTStructStoreIndex import pandas as pd @@ -52,7 +52,7 @@ def as_retriever(self, **kwargs: Any) -> BaseRetriever: def as_query_engine(self, **kwargs: Any) -> BaseQueryEngine: # NOTE: lazy import - from gpt_index.indices.struct_store.pandas_query import GPTNLPandasQueryEngine + from llama_index.indices.struct_store.pandas_query import GPTNLPandasQueryEngine return GPTNLPandasQueryEngine(self, **kwargs) diff --git a/gpt_index/indices/struct_store/pandas_query.py b/llama_index/indices/struct_store/pandas_query.py similarity index 92% rename from gpt_index/indices/struct_store/pandas_query.py rename to llama_index/indices/struct_store/pandas_query.py index 1059abe3b0ea9..f5f98621416fb 100644 --- a/gpt_index/indices/struct_store/pandas_query.py +++ b/llama_index/indices/struct_store/pandas_query.py @@ -6,13 +6,13 @@ import pandas as pd from langchain.input import print_text -from gpt_index.callbacks.schema import CBEventType -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.struct_store.pandas import GPTPandasIndex -from gpt_index.prompts.default_prompts import DEFAULT_PANDAS_PROMPT -from gpt_index.prompts.prompts import PandasPrompt -from gpt_index.response.schema import Response +from llama_index.callbacks.schema import CBEventType +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.struct_store.pandas import GPTPandasIndex +from llama_index.prompts.default_prompts import DEFAULT_PANDAS_PROMPT +from llama_index.prompts.prompts import PandasPrompt +from llama_index.response.schema import Response logger = logging.getLogger(__name__) diff --git a/gpt_index/indices/struct_store/sql.py b/llama_index/indices/struct_store/sql.py similarity index 87% rename from gpt_index/indices/struct_store/sql.py rename to llama_index/indices/struct_store/sql.py index dd23d2a6bce6b..fb7313ca77f25 100644 --- a/gpt_index/indices/struct_store/sql.py +++ b/llama_index/indices/struct_store/sql.py @@ -3,16 +3,18 @@ from typing import Any, Optional, Sequence, Union from collections import defaultdict -from gpt_index.data_structs.node_v2 import Node -from gpt_index.data_structs.table_v2 import SQLStructTable -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.common.struct_store.schema import SQLContextContainer -from gpt_index.indices.common.struct_store.sql import SQLStructDatapointExtractor -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.struct_store.base import BaseGPTStructStoreIndex -from gpt_index.indices.struct_store.container_builder import SQLContextContainerBuilder -from gpt_index.langchain_helpers.sql_wrapper import SQLDatabase +from llama_index.data_structs.node_v2 import Node +from llama_index.data_structs.table_v2 import SQLStructTable +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.common.struct_store.schema import SQLContextContainer +from llama_index.indices.common.struct_store.sql import SQLStructDatapointExtractor +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.struct_store.base import BaseGPTStructStoreIndex +from llama_index.indices.struct_store.container_builder import ( + SQLContextContainerBuilder, +) +from llama_index.langchain_helpers.sql_wrapper import SQLDatabase from sqlalchemy import Table @@ -140,7 +142,7 @@ def as_query_engine( self, query_mode: Union[str, SQLQueryMode] = SQLQueryMode.NL, **kwargs: Any ) -> BaseQueryEngine: # NOTE: lazy import - from gpt_index.indices.struct_store.sql_query import ( + from llama_index.indices.struct_store.sql_query import ( GPTNLStructStoreQueryEngine, GPTSQLStructStoreQueryEngine, ) diff --git a/gpt_index/indices/struct_store/sql_query.py b/llama_index/indices/struct_store/sql_query.py similarity index 91% rename from gpt_index/indices/struct_store/sql_query.py rename to llama_index/indices/struct_store/sql_query.py index 060ad34c45ab1..4919897fa8065 100644 --- a/gpt_index/indices/struct_store/sql_query.py +++ b/llama_index/indices/struct_store/sql_query.py @@ -2,15 +2,17 @@ import logging from typing import Any, Optional -from gpt_index.callbacks.schema import CBEventType -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.struct_store.container_builder import SQLContextContainerBuilder -from gpt_index.indices.struct_store.sql import GPTSQLStructStoreIndex -from gpt_index.prompts.default_prompts import DEFAULT_TEXT_TO_SQL_PROMPT -from gpt_index.prompts.prompts import TextToSQLPrompt -from gpt_index.response.schema import Response -from gpt_index.token_counter.token_counter import llm_token_counter +from llama_index.callbacks.schema import CBEventType +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.struct_store.container_builder import ( + SQLContextContainerBuilder, +) +from llama_index.indices.struct_store.sql import GPTSQLStructStoreIndex +from llama_index.prompts.default_prompts import DEFAULT_TEXT_TO_SQL_PROMPT +from llama_index.prompts.prompts import TextToSQLPrompt +from llama_index.response.schema import Response +from llama_index.token_counter.token_counter import llm_token_counter logger = logging.getLogger(__name__) diff --git a/gpt_index/indices/tree/README.md b/llama_index/indices/tree/README.md similarity index 97% rename from gpt_index/indices/tree/README.md rename to llama_index/indices/tree/README.md index bb317ce1fcd48..b557ea6a8c3b2 100644 --- a/gpt_index/indices/tree/README.md +++ b/llama_index/indices/tree/README.md @@ -21,7 +21,7 @@ Simply use the root nodes as context to synthesize an answer to the query. This ### Usage ```python -from gpt_index import GPTTreeIndex, SimpleDirectoryReader +from llama_index import GPTTreeIndex, SimpleDirectoryReader # build index documents = SimpleDirectoryReader('data').load_data() diff --git a/llama_index/indices/tree/__init__.py b/llama_index/indices/tree/__init__.py new file mode 100644 index 0000000000000..a751aec1620cb --- /dev/null +++ b/llama_index/indices/tree/__init__.py @@ -0,0 +1,18 @@ +"""Tree-structured Index Data Structures.""" + +# indices +from llama_index.indices.tree.base import GPTTreeIndex +from llama_index.indices.tree.select_leaf_embedding_retriever import ( + TreeSelectLeafEmbeddingRetriever, +) +from llama_index.indices.tree.select_leaf_retriever import TreeSelectLeafRetriever +from llama_index.indices.tree.all_leaf_retriever import TreeAllLeafRetriever +from llama_index.indices.tree.tree_root_retriever import TreeRootRetriever + +__all__ = [ + "GPTTreeIndex", + "TreeSelectLeafEmbeddingRetriever", + "TreeSelectLeafRetriever", + "TreeAllLeafRetriever", + "TreeRootRetriever", +] diff --git a/gpt_index/indices/tree/all_leaf_retriever.py b/llama_index/indices/tree/all_leaf_retriever.py similarity index 77% rename from gpt_index/indices/tree/all_leaf_retriever.py rename to llama_index/indices/tree/all_leaf_retriever.py index ee61ba114c369..80dcad2b4a050 100644 --- a/gpt_index/indices/tree/all_leaf_retriever.py +++ b/llama_index/indices/tree/all_leaf_retriever.py @@ -4,11 +4,11 @@ from typing import Any, List, cast -from gpt_index.data_structs.data_structs_v2 import IndexGraph -from gpt_index.data_structs.node_v2 import NodeWithScore -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.utils import get_sorted_node_list +from llama_index.data_structs.data_structs_v2 import IndexGraph +from llama_index.data_structs.node_v2 import NodeWithScore +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.utils import get_sorted_node_list logger = logging.getLogger(__name__) @@ -29,7 +29,7 @@ class TreeAllLeafRetriever(BaseRetriever): """ def __init__(self, index: Any): - from gpt_index.indices.tree.base import GPTTreeIndex + from llama_index.indices.tree.base import GPTTreeIndex assert isinstance(index, GPTTreeIndex) self._index = index diff --git a/gpt_index/indices/tree/base.py b/llama_index/indices/tree/base.py similarity index 83% rename from gpt_index/indices/tree/base.py rename to llama_index/indices/tree/base.py index 3ca8ab6d12443..8c80a019473f6 100644 --- a/gpt_index/indices/tree/base.py +++ b/llama_index/indices/tree/base.py @@ -3,19 +3,19 @@ from enum import Enum from typing import Any, Optional, Sequence, Union -# from gpt_index.data_structs.data_structs import IndexGraph -from gpt_index.data_structs.data_structs_v2 import IndexGraph -from gpt_index.data_structs.node_v2 import Node -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.common_tree.base import GPTTreeIndexBuilder -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.tree.inserter import GPTTreeIndexInserter -from gpt_index.prompts.default_prompts import ( +# from llama_index.data_structs.data_structs import IndexGraph +from llama_index.data_structs.data_structs_v2 import IndexGraph +from llama_index.data_structs.node_v2 import Node +from llama_index.indices.base import BaseGPTIndex +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.common_tree.base import GPTTreeIndexBuilder +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.tree.inserter import GPTTreeIndexInserter +from llama_index.prompts.default_prompts import ( DEFAULT_INSERT_PROMPT, DEFAULT_SUMMARY_PROMPT, ) -from gpt_index.prompts.prompts import SummaryPrompt, TreeInsertPrompt +from llama_index.prompts.prompts import SummaryPrompt, TreeInsertPrompt class TreeRetrieverMode(str, Enum): @@ -87,12 +87,14 @@ def as_retriever( **kwargs: Any, ) -> BaseRetriever: # NOTE: lazy import - from gpt_index.indices.tree.select_leaf_embedding_retriever import ( + from llama_index.indices.tree.select_leaf_embedding_retriever import ( TreeSelectLeafEmbeddingRetriever, ) - from gpt_index.indices.tree.select_leaf_retriever import TreeSelectLeafRetriever - from gpt_index.indices.tree.all_leaf_retriever import TreeAllLeafRetriever - from gpt_index.indices.tree.tree_root_retriever import TreeRootRetriever + from llama_index.indices.tree.select_leaf_retriever import ( + TreeSelectLeafRetriever, + ) + from llama_index.indices.tree.all_leaf_retriever import TreeAllLeafRetriever + from llama_index.indices.tree.tree_root_retriever import TreeRootRetriever self._validate_build_tree_required(TreeRetrieverMode(retriever_mode)) diff --git a/gpt_index/indices/tree/inserter.py b/llama_index/indices/tree/inserter.py similarity index 92% rename from gpt_index/indices/tree/inserter.py rename to llama_index/indices/tree/inserter.py index ac4cb166c5bbf..d44003ba80ecd 100644 --- a/gpt_index/indices/tree/inserter.py +++ b/llama_index/indices/tree/inserter.py @@ -2,14 +2,17 @@ from typing import Optional, Sequence -from gpt_index.data_structs.data_structs_v2 import IndexGraph -from gpt_index.data_structs.node_v2 import Node -from gpt_index.storage.docstore import BaseDocumentStore -from gpt_index.storage.docstore.registry import get_default_docstore -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.utils import extract_numbers_given_response, get_sorted_node_list -from gpt_index.prompts.base import Prompt -from gpt_index.prompts.default_prompts import ( +from llama_index.data_structs.data_structs_v2 import IndexGraph +from llama_index.data_structs.node_v2 import Node +from llama_index.storage.docstore import BaseDocumentStore +from llama_index.storage.docstore.registry import get_default_docstore +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.utils import ( + extract_numbers_given_response, + get_sorted_node_list, +) +from llama_index.prompts.base import Prompt +from llama_index.prompts.default_prompts import ( DEFAULT_INSERT_PROMPT, DEFAULT_SUMMARY_PROMPT, ) diff --git a/gpt_index/indices/tree/select_leaf_embedding_retriever.py b/llama_index/indices/tree/select_leaf_embedding_retriever.py similarity index 95% rename from gpt_index/indices/tree/select_leaf_embedding_retriever.py rename to llama_index/indices/tree/select_leaf_embedding_retriever.py index 5942dd0dcd26d..1316fbbf6bc74 100644 --- a/gpt_index/indices/tree/select_leaf_embedding_retriever.py +++ b/llama_index/indices/tree/select_leaf_embedding_retriever.py @@ -4,12 +4,12 @@ from typing import Dict, List, Tuple, cast -from gpt_index.data_structs.node_v2 import Node -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.tree.select_leaf_retriever import ( +from llama_index.data_structs.node_v2 import Node +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.tree.select_leaf_retriever import ( TreeSelectLeafRetriever, ) -from gpt_index.indices.utils import get_sorted_node_list +from llama_index.indices.utils import get_sorted_node_list logger = logging.getLogger(__name__) diff --git a/gpt_index/indices/tree/select_leaf_retriever.py b/llama_index/indices/tree/select_leaf_retriever.py similarity index 95% rename from gpt_index/indices/tree/select_leaf_retriever.py rename to llama_index/indices/tree/select_leaf_retriever.py index fff2f0eb5c553..3ae95de36250e 100644 --- a/gpt_index/indices/tree/select_leaf_retriever.py +++ b/llama_index/indices/tree/select_leaf_retriever.py @@ -5,27 +5,30 @@ from langchain.input import print_text -from gpt_index.data_structs.node_v2 import Node, NodeWithScore -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.response.response_builder import get_response_builder -from gpt_index.indices.tree.base import GPTTreeIndex -from gpt_index.indices.utils import extract_numbers_given_response, get_sorted_node_list -from gpt_index.prompts.default_prompt_selectors import DEFAULT_REFINE_PROMPT_SEL -from gpt_index.prompts.default_prompts import ( +from llama_index.data_structs.node_v2 import Node, NodeWithScore +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.response.response_builder import get_response_builder +from llama_index.indices.tree.base import GPTTreeIndex +from llama_index.indices.utils import ( + extract_numbers_given_response, + get_sorted_node_list, +) +from llama_index.prompts.default_prompt_selectors import DEFAULT_REFINE_PROMPT_SEL +from llama_index.prompts.default_prompts import ( DEFAULT_QUERY_PROMPT, DEFAULT_QUERY_PROMPT_MULTIPLE, DEFAULT_TEXT_QA_PROMPT, ) -from gpt_index.prompts.prompts import ( +from llama_index.prompts.prompts import ( QuestionAnswerPrompt, RefinePrompt, TreeSelectMultiplePrompt, TreeSelectPrompt, ) -from gpt_index.response.schema import Response -from gpt_index.token_counter.token_counter import llm_token_counter -from gpt_index.utils import truncate_text +from llama_index.response.schema import Response +from llama_index.token_counter.token_counter import llm_token_counter +from llama_index.utils import truncate_text logger = logging.getLogger(__name__) diff --git a/gpt_index/indices/tree/tree_root_retriever.py b/llama_index/indices/tree/tree_root_retriever.py similarity index 78% rename from gpt_index/indices/tree/tree_root_retriever.py rename to llama_index/indices/tree/tree_root_retriever.py index 4034127196e32..770b7cd4e0757 100644 --- a/gpt_index/indices/tree/tree_root_retriever.py +++ b/llama_index/indices/tree/tree_root_retriever.py @@ -2,10 +2,10 @@ import logging from typing import Any, List -from gpt_index.data_structs.node_v2 import NodeWithScore -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.utils import get_sorted_node_list +from llama_index.data_structs.node_v2 import NodeWithScore +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.utils import get_sorted_node_list logger = logging.getLogger(__name__) @@ -21,7 +21,7 @@ class TreeRootRetriever(BaseRetriever): """ def __init__(self, index: Any): - from gpt_index.indices.tree.base import GPTTreeIndex + from llama_index.indices.tree.base import GPTTreeIndex assert isinstance(index, GPTTreeIndex) diff --git a/gpt_index/indices/utils.py b/llama_index/indices/utils.py similarity index 91% rename from gpt_index/indices/utils.py rename to llama_index/indices/utils.py index d6c5e2e870ca8..9f1e237810e7c 100644 --- a/gpt_index/indices/utils.py +++ b/llama_index/indices/utils.py @@ -3,9 +3,9 @@ import re from typing import Dict, List, Optional, Set -from gpt_index.data_structs.node_v2 import Node -from gpt_index.utils import globals_helper, truncate_text -from gpt_index.vector_stores.types import VectorStoreQueryResult +from llama_index.data_structs.node_v2 import Node +from llama_index.utils import globals_helper, truncate_text +from llama_index.vector_stores.types import VectorStoreQueryResult _logger = logging.getLogger(__name__) diff --git a/llama_index/indices/vector_store/__init__.py b/llama_index/indices/vector_store/__init__.py new file mode 100644 index 0000000000000..8634ae4e83e19 --- /dev/null +++ b/llama_index/indices/vector_store/__init__.py @@ -0,0 +1,9 @@ +"""Vector-store based data structures.""" + +from llama_index.indices.vector_store.base import GPTVectorStoreIndex +from llama_index.indices.vector_store.retrievers import VectorIndexRetriever + +__all__ = [ + "GPTVectorStoreIndex", + "VectorIndexRetriever", +] diff --git a/gpt_index/indices/vector_store/base.py b/llama_index/indices/vector_store/base.py similarity index 92% rename from gpt_index/indices/vector_store/base.py rename to llama_index/indices/vector_store/base.py index 2f25c84acf8a5..0a9b3af9a8b4b 100644 --- a/gpt_index/indices/vector_store/base.py +++ b/llama_index/indices/vector_store/base.py @@ -6,16 +6,16 @@ from typing import Any, Dict, List, Optional, Sequence, Set, Tuple -from gpt_index.callbacks.schema import CBEventType -from gpt_index.async_utils import run_async_tasks -from gpt_index.data_structs.data_structs_v2 import IndexDict -from gpt_index.data_structs.node_v2 import ImageNode, IndexNode, Node -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.service_context import ServiceContext -from gpt_index.storage.storage_context import StorageContext -from gpt_index.token_counter.token_counter import llm_token_counter -from gpt_index.vector_stores.types import NodeEmbeddingResult, VectorStore +from llama_index.callbacks.schema import CBEventType +from llama_index.async_utils import run_async_tasks +from llama_index.data_structs.data_structs_v2 import IndexDict +from llama_index.data_structs.node_v2 import ImageNode, IndexNode, Node +from llama_index.indices.base import BaseGPTIndex +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.service_context import ServiceContext +from llama_index.storage.storage_context import StorageContext +from llama_index.token_counter.token_counter import llm_token_counter +from llama_index.vector_stores.types import NodeEmbeddingResult, VectorStore class GPTVectorStoreIndex(BaseGPTIndex[IndexDict]): @@ -52,7 +52,7 @@ def vector_store(self) -> VectorStore: def as_retriever(self, **kwargs: Any) -> BaseRetriever: # NOTE: lazy import - from gpt_index.indices.vector_store.retrievers import VectorIndexRetriever + from llama_index.indices.vector_store.retrievers import VectorIndexRetriever return VectorIndexRetriever(self, **kwargs) diff --git a/gpt_index/indices/vector_store/retrievers.py b/llama_index/indices/vector_store/retrievers.py similarity index 86% rename from gpt_index/indices/vector_store/retrievers.py rename to llama_index/indices/vector_store/retrievers.py index decb3457582e3..082fd5e0fbb2c 100644 --- a/gpt_index/indices/vector_store/retrievers.py +++ b/llama_index/indices/vector_store/retrievers.py @@ -2,17 +2,17 @@ from typing import Any, List, Optional -from gpt_index.constants import DEFAULT_SIMILARITY_TOP_K +from llama_index.constants import DEFAULT_SIMILARITY_TOP_K -from gpt_index.callbacks.schema import CBEventType -from gpt_index.data_structs.data_structs_v2 import IndexDict -from gpt_index.data_structs.node_v2 import NodeWithScore -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.utils import log_vector_store_query_result -from gpt_index.indices.vector_store.base import GPTVectorStoreIndex -from gpt_index.token_counter.token_counter import llm_token_counter -from gpt_index.vector_stores.types import ( +from llama_index.callbacks.schema import CBEventType +from llama_index.data_structs.data_structs_v2 import IndexDict +from llama_index.data_structs.node_v2 import NodeWithScore +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.utils import log_vector_store_query_result +from llama_index.indices.vector_store.base import GPTVectorStoreIndex +from llama_index.token_counter.token_counter import llm_token_counter +from llama_index.vector_stores.types import ( VectorStoreQuery, VectorStoreQueryMode, ) diff --git a/gpt_index/langchain_helpers/__init__.py b/llama_index/langchain_helpers/__init__.py similarity index 100% rename from gpt_index/langchain_helpers/__init__.py rename to llama_index/langchain_helpers/__init__.py diff --git a/gpt_index/langchain_helpers/agents/__init__.py b/llama_index/langchain_helpers/agents/__init__.py similarity index 63% rename from gpt_index/langchain_helpers/agents/__init__.py rename to llama_index/langchain_helpers/agents/__init__.py index c0e678c83e69d..f8ec6d65d6a04 100644 --- a/gpt_index/langchain_helpers/agents/__init__.py +++ b/llama_index/langchain_helpers/agents/__init__.py @@ -1,11 +1,11 @@ """Llama integration with Langchain agents.""" -from gpt_index.langchain_helpers.agents.agents import ( +from llama_index.langchain_helpers.agents.agents import ( create_llama_agent, create_llama_chat_agent, ) -from gpt_index.langchain_helpers.agents.toolkits import LlamaToolkit -from gpt_index.langchain_helpers.agents.tools import ( +from llama_index.langchain_helpers.agents.toolkits import LlamaToolkit +from llama_index.langchain_helpers.agents.tools import ( IndexToolConfig, LlamaIndexTool, ) diff --git a/gpt_index/langchain_helpers/agents/agents.py b/llama_index/langchain_helpers/agents/agents.py similarity index 97% rename from gpt_index/langchain_helpers/agents/agents.py rename to llama_index/langchain_helpers/agents/agents.py index b0775119787c4..2bc4b3b5c522e 100644 --- a/gpt_index/langchain_helpers/agents/agents.py +++ b/llama_index/langchain_helpers/agents/agents.py @@ -7,7 +7,7 @@ from langchain.llms.base import BaseLLM from langchain.agents.agent_types import AgentType -from gpt_index.langchain_helpers.agents.toolkits import LlamaToolkit +from llama_index.langchain_helpers.agents.toolkits import LlamaToolkit def create_llama_agent( diff --git a/gpt_index/langchain_helpers/agents/toolkits.py b/llama_index/langchain_helpers/agents/toolkits.py similarity index 93% rename from gpt_index/langchain_helpers/agents/toolkits.py rename to llama_index/langchain_helpers/agents/toolkits.py index 684a30d1e3b13..d821f9f53a0e9 100644 --- a/gpt_index/langchain_helpers/agents/toolkits.py +++ b/llama_index/langchain_helpers/agents/toolkits.py @@ -6,7 +6,7 @@ from langchain.tools import BaseTool from pydantic import Field -from gpt_index.langchain_helpers.agents.tools import ( +from llama_index.langchain_helpers.agents.tools import ( IndexToolConfig, LlamaIndexTool, ) diff --git a/gpt_index/langchain_helpers/agents/tools.py b/llama_index/langchain_helpers/agents/tools.py similarity index 94% rename from gpt_index/langchain_helpers/agents/tools.py rename to llama_index/langchain_helpers/agents/tools.py index 8e0a398d0f79e..c4c4f7f57ab6a 100644 --- a/gpt_index/langchain_helpers/agents/tools.py +++ b/llama_index/langchain_helpers/agents/tools.py @@ -5,8 +5,8 @@ from langchain.tools import BaseTool from pydantic import BaseModel, Field -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.response.schema import RESPONSE_TYPE +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.response.schema import RESPONSE_TYPE def _get_response_with_sources(response: RESPONSE_TYPE) -> str: diff --git a/gpt_index/langchain_helpers/chain_wrapper.py b/llama_index/langchain_helpers/chain_wrapper.py similarity index 56% rename from gpt_index/langchain_helpers/chain_wrapper.py rename to llama_index/langchain_helpers/chain_wrapper.py index a865ccaef75c1..ec3bd95ac707d 100644 --- a/gpt_index/langchain_helpers/chain_wrapper.py +++ b/llama_index/langchain_helpers/chain_wrapper.py @@ -1,9 +1,9 @@ """Wrapper functions around an LLM chain.""" -# NOTE: moved to gpt_index/llm_predictor/base.py +# NOTE: moved to llama_index/llm_predictor/base.py # NOTE: this is for backwards compatibility -from gpt_index.llm_predictor.base import ( # noqa: F401 +from llama_index.llm_predictor.base import ( # noqa: F401 LLMChain, LLMMetadata, LLMPredictor, diff --git a/gpt_index/langchain_helpers/memory_wrapper.py b/llama_index/langchain_helpers/memory_wrapper.py similarity index 98% rename from gpt_index/langchain_helpers/memory_wrapper.py rename to llama_index/langchain_helpers/memory_wrapper.py index 7f665a5953cd8..86f8ae3b87231 100644 --- a/gpt_index/langchain_helpers/memory_wrapper.py +++ b/llama_index/langchain_helpers/memory_wrapper.py @@ -8,9 +8,9 @@ from langchain.schema import BaseMessage, HumanMessage from pydantic import Field -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.readers.schema.base import Document -from gpt_index.utils import get_new_id +from llama_index.indices.base import BaseGPTIndex +from llama_index.readers.schema.base import Document +from llama_index.utils import get_new_id def get_prompt_input_key(inputs: Dict[str, Any], memory_variables: List[str]) -> str: diff --git a/gpt_index/langchain_helpers/sql_wrapper.py b/llama_index/langchain_helpers/sql_wrapper.py similarity index 100% rename from gpt_index/langchain_helpers/sql_wrapper.py rename to llama_index/langchain_helpers/sql_wrapper.py diff --git a/gpt_index/langchain_helpers/text_splitter.py b/llama_index/langchain_helpers/text_splitter.py similarity index 99% rename from gpt_index/langchain_helpers/text_splitter.py rename to llama_index/langchain_helpers/text_splitter.py index 21bd47c103f6d..777c23abb456c 100644 --- a/gpt_index/langchain_helpers/text_splitter.py +++ b/llama_index/langchain_helpers/text_splitter.py @@ -3,9 +3,9 @@ from typing import Callable, List, Optional from langchain.text_splitter import TextSplitter -from gpt_index.constants import DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE +from llama_index.constants import DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE -from gpt_index.utils import globals_helper +from llama_index.utils import globals_helper @dataclass diff --git a/llama_index/llm_predictor/__init__.py b/llama_index/llm_predictor/__init__.py new file mode 100644 index 0000000000000..f1306427b697b --- /dev/null +++ b/llama_index/llm_predictor/__init__.py @@ -0,0 +1,8 @@ +"""Init params.""" + +# TODO: move LLMPredictor to this folder +from llama_index.llm_predictor.base import LLMPredictor +from llama_index.llm_predictor.stable_lm import StableLMPredictor +from llama_index.llm_predictor.structured import StructuredLLMPredictor + +__all__ = ["LLMPredictor", "StructuredLLMPredictor", "StableLMPredictor"] diff --git a/gpt_index/llm_predictor/base.py b/llama_index/llm_predictor/base.py similarity index 98% rename from gpt_index/llm_predictor/base.py rename to llama_index/llm_predictor/base.py index 09f2fd39890b6..5f3691db2bd3e 100644 --- a/gpt_index/llm_predictor/base.py +++ b/llama_index/llm_predictor/base.py @@ -12,9 +12,9 @@ from langchain.llms import AI21 from langchain.base_language import BaseLanguageModel -from gpt_index.constants import MAX_CHUNK_SIZE, NUM_OUTPUTS -from gpt_index.prompts.base import Prompt -from gpt_index.utils import ( +from llama_index.constants import MAX_CHUNK_SIZE, NUM_OUTPUTS +from llama_index.prompts.base import Prompt +from llama_index.utils import ( ErrorToRetry, globals_helper, retry_on_exceptions_with_backoff, diff --git a/gpt_index/llm_predictor/chatgpt.py b/llama_index/llm_predictor/chatgpt.py similarity index 95% rename from gpt_index/llm_predictor/chatgpt.py rename to llama_index/llm_predictor/chatgpt.py index 63eed37c613ba..8d91f6d74f1b6 100644 --- a/gpt_index/llm_predictor/chatgpt.py +++ b/llama_index/llm_predictor/chatgpt.py @@ -15,9 +15,9 @@ from langchain.prompts.prompt import PromptTemplate from langchain.base_language import BaseLanguageModel, BaseMessage -from gpt_index.llm_predictor.base import LLMPredictor -from gpt_index.prompts.base import Prompt -from gpt_index.utils import ErrorToRetry, retry_on_exceptions_with_backoff +from llama_index.llm_predictor.base import LLMPredictor +from llama_index.prompts.base import Prompt +from llama_index.utils import ErrorToRetry, retry_on_exceptions_with_backoff logger = logging.getLogger(__name__) diff --git a/gpt_index/llm_predictor/stable_lm.py b/llama_index/llm_predictor/stable_lm.py similarity index 97% rename from gpt_index/llm_predictor/stable_lm.py rename to llama_index/llm_predictor/stable_lm.py index 9190a3176ef68..2d06bbba3c776 100644 --- a/gpt_index/llm_predictor/stable_lm.py +++ b/llama_index/llm_predictor/stable_lm.py @@ -6,8 +6,8 @@ """ from typing import Any, Generator, Optional, Tuple -from gpt_index.llm_predictor.base import BaseLLMPredictor, LLMMetadata -from gpt_index.prompts.base import Prompt +from llama_index.llm_predictor.base import BaseLLMPredictor, LLMMetadata +from llama_index.prompts.base import Prompt DEFAULT_SYSTEM_PROMPT = """<|SYSTEM|># StableLM Tuned (Alpha version) - StableLM is a helpful and harmless open-source AI language model developed by StabilityAI. diff --git a/gpt_index/llm_predictor/structured.py b/llama_index/llm_predictor/structured.py similarity index 95% rename from gpt_index/llm_predictor/structured.py rename to llama_index/llm_predictor/structured.py index 048fa0e078254..9df8b24e6d066 100644 --- a/gpt_index/llm_predictor/structured.py +++ b/llama_index/llm_predictor/structured.py @@ -4,8 +4,8 @@ import logging from typing import Any, Generator, Tuple -from gpt_index.llm_predictor.base import LLMPredictor -from gpt_index.prompts.base import Prompt +from llama_index.llm_predictor.base import LLMPredictor +from llama_index.prompts.base import Prompt logger = logging.getLogger(__name__) diff --git a/llama_index/logger/__init__.py b/llama_index/logger/__init__.py new file mode 100644 index 0000000000000..eb8e959cb97d6 --- /dev/null +++ b/llama_index/logger/__init__.py @@ -0,0 +1,5 @@ +"""Init params.""" + +from llama_index.logger.base import LlamaLogger + +__all__ = ["LlamaLogger"] diff --git a/gpt_index/logger/base.py b/llama_index/logger/base.py similarity index 100% rename from gpt_index/logger/base.py rename to llama_index/logger/base.py diff --git a/llama_index/node_parser/__init__.py b/llama_index/node_parser/__init__.py new file mode 100644 index 0000000000000..b33740e7f2610 --- /dev/null +++ b/llama_index/node_parser/__init__.py @@ -0,0 +1,6 @@ +"""Node parsers.""" + +from llama_index.node_parser.simple import SimpleNodeParser +from llama_index.node_parser.interface import NodeParser + +__all__ = ["SimpleNodeParser", "NodeParser"] diff --git a/gpt_index/node_parser/interface.py b/llama_index/node_parser/interface.py similarity index 80% rename from gpt_index/node_parser/interface.py rename to llama_index/node_parser/interface.py index 41b197db77449..af0eb841d3f73 100644 --- a/gpt_index/node_parser/interface.py +++ b/llama_index/node_parser/interface.py @@ -3,8 +3,8 @@ from abc import ABC, abstractmethod -from gpt_index.data_structs.node_v2 import Node -from gpt_index.readers.schema.base import Document +from llama_index.data_structs.node_v2 import Node +from llama_index.readers.schema.base import Document class NodeParser(ABC): diff --git a/gpt_index/node_parser/node_utils.py b/llama_index/node_parser/node_utils.py similarity index 91% rename from gpt_index/node_parser/node_utils.py rename to llama_index/node_parser/node_utils.py index 6a96c945c21de..7c4f8b2b6eb46 100644 --- a/gpt_index/node_parser/node_utils.py +++ b/llama_index/node_parser/node_utils.py @@ -4,15 +4,15 @@ import logging from typing import List -from gpt_index.data_structs.node_v2 import DocumentRelationship, ImageNode, Node -from gpt_index.langchain_helpers.text_splitter import ( +from llama_index.data_structs.node_v2 import DocumentRelationship, ImageNode, Node +from llama_index.langchain_helpers.text_splitter import ( TextSplit, TextSplitter, TokenTextSplitter, ) -from gpt_index.readers.schema.base import ImageDocument -from gpt_index.schema import BaseDocument -from gpt_index.utils import truncate_text +from llama_index.readers.schema.base import ImageDocument +from llama_index.schema import BaseDocument +from llama_index.utils import truncate_text logger = logging.getLogger(__name__) diff --git a/gpt_index/node_parser/simple.py b/llama_index/node_parser/simple.py similarity index 82% rename from gpt_index/node_parser/simple.py rename to llama_index/node_parser/simple.py index 11910ec1a243a..b2e2738416700 100644 --- a/gpt_index/node_parser/simple.py +++ b/llama_index/node_parser/simple.py @@ -1,11 +1,11 @@ """Simple node parser.""" from typing import List, Optional, Sequence -from gpt_index.data_structs.node_v2 import Node -from gpt_index.langchain_helpers.text_splitter import TextSplitter, TokenTextSplitter -from gpt_index.node_parser.node_utils import get_nodes_from_document -from gpt_index.readers.schema.base import Document -from gpt_index.node_parser.interface import NodeParser +from llama_index.data_structs.node_v2 import Node +from llama_index.langchain_helpers.text_splitter import TextSplitter, TokenTextSplitter +from llama_index.node_parser.node_utils import get_nodes_from_document +from llama_index.readers.schema.base import Document +from llama_index.node_parser.interface import NodeParser class SimpleNodeParser(NodeParser): diff --git a/llama_index/optimization/__init__.py b/llama_index/optimization/__init__.py new file mode 100644 index 0000000000000..0f98bad484f87 --- /dev/null +++ b/llama_index/optimization/__init__.py @@ -0,0 +1,7 @@ +"""Optimization.""" + +from llama_index.optimization.optimizer import SentenceEmbeddingOptimizer + +__all__ = [ + "SentenceEmbeddingOptimizer", +] diff --git a/gpt_index/optimization/optimizer.py b/llama_index/optimization/optimizer.py similarity index 92% rename from gpt_index/optimization/optimizer.py rename to llama_index/optimization/optimizer.py index 6e2c0cf88207b..1d9ba6a65dfde 100644 --- a/gpt_index/optimization/optimizer.py +++ b/llama_index/optimization/optimizer.py @@ -3,10 +3,10 @@ from abc import abstractmethod from typing import Callable, List, Optional -from gpt_index.embeddings.base import BaseEmbedding -from gpt_index.embeddings.openai import OpenAIEmbedding -from gpt_index.indices.query.embedding_utils import get_top_k_embeddings -from gpt_index.indices.query.schema import QueryBundle +from llama_index.embeddings.base import BaseEmbedding +from llama_index.embeddings.openai import OpenAIEmbedding +from llama_index.indices.query.embedding_utils import get_top_k_embeddings +from llama_index.indices.query.schema import QueryBundle logger = logging.getLogger(__name__) @@ -35,7 +35,7 @@ def __init__( Should be set like this: .. code-block:: python - from gpt_index.optimization.optimizer import Optimizer + from llama_index.optimization.optimizer import Optimizer optimizer = SentenceEmbeddingOptimizer( percentile_cutoff=0.5 this means that the top 50% of sentences will be used. diff --git a/llama_index/output_parsers/__init__.py b/llama_index/output_parsers/__init__.py new file mode 100644 index 0000000000000..a2cd9497225d4 --- /dev/null +++ b/llama_index/output_parsers/__init__.py @@ -0,0 +1,6 @@ +"""Output parsers.""" + +from llama_index.output_parsers.guardrails import GuardrailsOutputParser +from llama_index.output_parsers.langchain import LangchainOutputParser + +__all__ = ["GuardrailsOutputParser", "LangchainOutputParser"] diff --git a/gpt_index/output_parsers/base.py b/llama_index/output_parsers/base.py similarity index 100% rename from gpt_index/output_parsers/base.py rename to llama_index/output_parsers/base.py diff --git a/gpt_index/output_parsers/guardrails.py b/llama_index/output_parsers/guardrails.py similarity index 97% rename from gpt_index/output_parsers/guardrails.py rename to llama_index/output_parsers/guardrails.py index c5eb4c7b9f96d..94d0f9d29129d 100644 --- a/gpt_index/output_parsers/guardrails.py +++ b/llama_index/output_parsers/guardrails.py @@ -14,7 +14,7 @@ from langchain.llms.base import BaseLLM -from gpt_index.output_parsers.base import BaseOutputParser +from llama_index.output_parsers.base import BaseOutputParser def get_callable(llm: Optional[BaseLLM]) -> Optional[Callable]: diff --git a/gpt_index/output_parsers/langchain.py b/llama_index/output_parsers/langchain.py similarity index 96% rename from gpt_index/output_parsers/langchain.py rename to llama_index/output_parsers/langchain.py index 10224e0e7d05f..c63414bde9a1f 100644 --- a/gpt_index/output_parsers/langchain.py +++ b/llama_index/output_parsers/langchain.py @@ -5,7 +5,7 @@ from langchain.schema import BaseOutputParser as LCOutputParser -from gpt_index.output_parsers.base import BaseOutputParser +from llama_index.output_parsers.base import BaseOutputParser class LangchainOutputParser(BaseOutputParser): diff --git a/gpt_index/output_parsers/selection.py b/llama_index/output_parsers/selection.py similarity index 94% rename from gpt_index/output_parsers/selection.py rename to llama_index/output_parsers/selection.py index 540bf807cbb0b..54c784d000085 100644 --- a/gpt_index/output_parsers/selection.py +++ b/llama_index/output_parsers/selection.py @@ -3,7 +3,7 @@ from typing import Any from dataclasses_json import DataClassJsonMixin -from gpt_index.output_parsers.base import BaseOutputParser, StructuredOutput +from llama_index.output_parsers.base import BaseOutputParser, StructuredOutput def _escape_curly_braces(input_string: str) -> str: diff --git a/gpt_index/playground/__init__.py b/llama_index/playground/__init__.py similarity index 55% rename from gpt_index/playground/__init__.py rename to llama_index/playground/__init__.py index ca58907f20e42..d9f0b534b6681 100644 --- a/gpt_index/playground/__init__.py +++ b/llama_index/playground/__init__.py @@ -1,6 +1,6 @@ """Init file of Playground.""" # playground -from gpt_index.playground.base import DEFAULT_INDEX_CLASSES, DEFAULT_MODES, Playground +from llama_index.playground.base import DEFAULT_INDEX_CLASSES, DEFAULT_MODES, Playground __all__ = ["Playground", "DEFAULT_INDEX_CLASSES", "DEFAULT_MODES"] diff --git a/gpt_index/playground/base.py b/llama_index/playground/base.py similarity index 95% rename from gpt_index/playground/base.py rename to llama_index/playground/base.py index 647e914483a2a..98c244ed0c783 100644 --- a/gpt_index/playground/base.py +++ b/llama_index/playground/base.py @@ -7,11 +7,11 @@ import pandas as pd from langchain.input import get_color_mapping, print_text -from gpt_index.indices.base import BaseGPTIndex -from gpt_index.indices.list.base import GPTListIndex, ListRetrieverMode -from gpt_index.indices.tree.base import GPTTreeIndex, TreeRetrieverMode -from gpt_index.indices.vector_store import GPTVectorStoreIndex -from gpt_index.readers.schema.base import Document +from llama_index.indices.base import BaseGPTIndex +from llama_index.indices.list.base import GPTListIndex, ListRetrieverMode +from llama_index.indices.tree.base import GPTTreeIndex, TreeRetrieverMode +from llama_index.indices.vector_store import GPTVectorStoreIndex +from llama_index.readers.schema.base import Document DEFAULT_INDEX_CLASSES: List[Type[BaseGPTIndex]] = [ GPTVectorStoreIndex, diff --git a/llama_index/prompts/__init__.py b/llama_index/prompts/__init__.py new file mode 100644 index 0000000000000..872453c72eace --- /dev/null +++ b/llama_index/prompts/__init__.py @@ -0,0 +1,5 @@ +"""Prompt class.""" + +from llama_index.prompts.base import Prompt + +__all__ = ["Prompt"] diff --git a/gpt_index/prompts/base.py b/llama_index/prompts/base.py similarity index 98% rename from gpt_index/prompts/base.py rename to llama_index/prompts/base.py index 13b6154ace262..ffaa42481e5d6 100644 --- a/gpt_index/prompts/base.py +++ b/llama_index/prompts/base.py @@ -8,8 +8,8 @@ from langchain.chains.prompt_selector import ConditionalPromptSelector from langchain.base_language import BaseLanguageModel -from gpt_index.output_parsers.base import BaseOutputParser -from gpt_index.prompts.prompt_type import PromptType +from llama_index.output_parsers.base import BaseOutputParser +from llama_index.prompts.prompt_type import PromptType PMT = TypeVar("PMT", bound="Prompt") diff --git a/gpt_index/prompts/chat_prompts.py b/llama_index/prompts/chat_prompts.py similarity index 95% rename from gpt_index/prompts/chat_prompts.py rename to llama_index/prompts/chat_prompts.py index 3ce552e916d9d..8986850679e97 100644 --- a/gpt_index/prompts/chat_prompts.py +++ b/llama_index/prompts/chat_prompts.py @@ -6,7 +6,7 @@ HumanMessagePromptTemplate, ) -from gpt_index.prompts.prompts import RefinePrompt, RefineTableContextPrompt +from llama_index.prompts.prompts import RefinePrompt, RefineTableContextPrompt # Refine Prompt CHAT_REFINE_PROMPT_TMPL_MSGS = [ diff --git a/gpt_index/prompts/default_prompt_selectors.py b/llama_index/prompts/default_prompt_selectors.py similarity index 84% rename from gpt_index/prompts/default_prompt_selectors.py rename to llama_index/prompts/default_prompt_selectors.py index 0dd463da79987..c3e96fe17c1e5 100644 --- a/gpt_index/prompts/default_prompt_selectors.py +++ b/llama_index/prompts/default_prompt_selectors.py @@ -1,15 +1,15 @@ """Prompt selectors.""" from langchain.chains.prompt_selector import ConditionalPromptSelector, is_chat_model -from gpt_index.prompts.chat_prompts import ( +from llama_index.prompts.chat_prompts import ( CHAT_REFINE_PROMPT, CHAT_REFINE_TABLE_CONTEXT_PROMPT, ) -from gpt_index.prompts.default_prompts import ( +from llama_index.prompts.default_prompts import ( DEFAULT_REFINE_PROMPT, DEFAULT_REFINE_TABLE_CONTEXT_PROMPT, ) -from gpt_index.prompts.prompts import RefinePrompt, RefineTableContextPrompt +from llama_index.prompts.prompts import RefinePrompt, RefineTableContextPrompt DEFAULT_REFINE_PROMPT_SEL_LC = ConditionalPromptSelector( default_prompt=DEFAULT_REFINE_PROMPT.get_langchain_prompt(), diff --git a/gpt_index/prompts/default_prompts.py b/llama_index/prompts/default_prompts.py similarity index 99% rename from gpt_index/prompts/default_prompts.py rename to llama_index/prompts/default_prompts.py index 507f40b3c8689..c3861fa57d97e 100644 --- a/gpt_index/prompts/default_prompts.py +++ b/llama_index/prompts/default_prompts.py @@ -1,6 +1,6 @@ """Set of default prompts.""" -from gpt_index.prompts.prompts import ( +from llama_index.prompts.prompts import ( KeywordExtractPrompt, KnowledgeGraphPrompt, PandasPrompt, diff --git a/gpt_index/prompts/prompt_type.py b/llama_index/prompts/prompt_type.py similarity index 100% rename from gpt_index/prompts/prompt_type.py rename to llama_index/prompts/prompt_type.py diff --git a/gpt_index/prompts/prompts.py b/llama_index/prompts/prompts.py similarity index 98% rename from gpt_index/prompts/prompts.py rename to llama_index/prompts/prompts.py index 653c88807e34e..205b1d49ecf33 100644 --- a/gpt_index/prompts/prompts.py +++ b/llama_index/prompts/prompts.py @@ -1,8 +1,8 @@ """Subclasses from base prompt.""" from typing import List -from gpt_index.prompts.base import Prompt -from gpt_index.prompts.prompt_type import PromptType +from llama_index.prompts.base import Prompt +from llama_index.prompts.prompt_type import PromptType class SummaryPrompt(Prompt): diff --git a/gpt_index/py.typed b/llama_index/py.typed similarity index 100% rename from gpt_index/py.typed rename to llama_index/py.typed diff --git a/llama_index/query_engine/__init__.py b/llama_index/query_engine/__init__.py new file mode 100644 index 0000000000000..44922191c581d --- /dev/null +++ b/llama_index/query_engine/__init__.py @@ -0,0 +1,14 @@ +from llama_index.query_engine.graph_query_engine import ComposableGraphQueryEngine +from llama_index.query_engine.retriever_query_engine import RetrieverQueryEngine +from llama_index.query_engine.transform_query_engine import TransformQueryEngine +from llama_index.query_engine.multistep_query_engine import MultiStepQueryEngine +from llama_index.query_engine.router_query_engine import RouterQueryEngine + + +__all__ = [ + "ComposableGraphQueryEngine", + "RetrieverQueryEngine", + "TransformQueryEngine", + "MultiStepQueryEngine", + "RouterQueryEngine", +] diff --git a/gpt_index/query_engine/graph_query_engine.py b/llama_index/query_engine/graph_query_engine.py similarity index 91% rename from gpt_index/query_engine/graph_query_engine.py rename to llama_index/query_engine/graph_query_engine.py index 891f5a0468234..0e2b12e71a3d5 100644 --- a/gpt_index/query_engine/graph_query_engine.py +++ b/llama_index/query_engine/graph_query_engine.py @@ -1,10 +1,10 @@ from typing import Dict, List, Optional, Tuple -from gpt_index.data_structs.node_v2 import IndexNode, Node, NodeWithScore -from gpt_index.indices.composability.graph import ComposableGraph -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.response.schema import RESPONSE_TYPE +from llama_index.data_structs.node_v2 import IndexNode, Node, NodeWithScore +from llama_index.indices.composability.graph import ComposableGraph +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.indices.query.schema import QueryBundle +from llama_index.response.schema import RESPONSE_TYPE class ComposableGraphQueryEngine(BaseQueryEngine): diff --git a/gpt_index/query_engine/multistep_query_engine.py b/llama_index/query_engine/multistep_query_engine.py similarity index 93% rename from gpt_index/query_engine/multistep_query_engine.py rename to llama_index/query_engine/multistep_query_engine.py index 74b28a5c815fd..76855621e9ca3 100644 --- a/gpt_index/query_engine/multistep_query_engine.py +++ b/llama_index/query_engine/multistep_query_engine.py @@ -1,10 +1,10 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, cast -from gpt_index.data_structs.node_v2 import Node, NodeWithScore -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.indices.query.query_transform.base import StepDecomposeQueryTransform -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.query.response_synthesis import ResponseSynthesizer -from gpt_index.response.schema import RESPONSE_TYPE +from llama_index.data_structs.node_v2 import Node, NodeWithScore +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.indices.query.query_transform.base import StepDecomposeQueryTransform +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.query.response_synthesis import ResponseSynthesizer +from llama_index.response.schema import RESPONSE_TYPE def default_stop_fn(stop_dict: Dict) -> bool: diff --git a/gpt_index/query_engine/retriever_query_engine.py b/llama_index/query_engine/retriever_query_engine.py similarity index 88% rename from gpt_index/query_engine/retriever_query_engine.py rename to llama_index/query_engine/retriever_query_engine.py index c03cf3e676660..4f671997d8949 100644 --- a/gpt_index/query_engine/retriever_query_engine.py +++ b/llama_index/query_engine/retriever_query_engine.py @@ -1,22 +1,22 @@ from typing import Any, Dict, List, Optional, Sequence -from gpt_index.callbacks.base import CallbackManager -from gpt_index.callbacks.schema import CBEventType -from gpt_index.data_structs.node_v2 import NodeWithScore -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.postprocessor.node import BaseNodePostprocessor -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.query.response_synthesis import ResponseSynthesizer -from gpt_index.indices.response.type import ResponseMode -from gpt_index.indices.service_context import ServiceContext -from gpt_index.optimization.optimizer import BaseTokenUsageOptimizer -from gpt_index.prompts.prompts import ( +from llama_index.callbacks.base import CallbackManager +from llama_index.callbacks.schema import CBEventType +from llama_index.data_structs.node_v2 import NodeWithScore +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.postprocessor.node import BaseNodePostprocessor +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.query.response_synthesis import ResponseSynthesizer +from llama_index.indices.response.type import ResponseMode +from llama_index.indices.service_context import ServiceContext +from llama_index.optimization.optimizer import BaseTokenUsageOptimizer +from llama_index.prompts.prompts import ( QuestionAnswerPrompt, RefinePrompt, SimpleInputPrompt, ) -from gpt_index.response.schema import RESPONSE_TYPE +from llama_index.response.schema import RESPONSE_TYPE class RetrieverQueryEngine(BaseQueryEngine): diff --git a/gpt_index/query_engine/router_query_engine.py b/llama_index/query_engine/router_query_engine.py similarity index 85% rename from gpt_index/query_engine/router_query_engine.py rename to llama_index/query_engine/router_query_engine.py index 30c69ca199f52..d0a4a20bae54c 100644 --- a/gpt_index/query_engine/router_query_engine.py +++ b/llama_index/query_engine/router_query_engine.py @@ -1,11 +1,11 @@ import logging from typing import Optional, Sequence -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.response.schema import RESPONSE_TYPE -from gpt_index.selectors.llm_selectors import LLMSingleSelector -from gpt_index.selectors.types import BaseSelector -from gpt_index.tools.query_engine import QueryEngineTool +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.indices.query.schema import QueryBundle +from llama_index.response.schema import RESPONSE_TYPE +from llama_index.selectors.llm_selectors import LLMSingleSelector +from llama_index.selectors.types import BaseSelector +from llama_index.tools.query_engine import QueryEngineTool logger = logging.getLogger(__name__) diff --git a/gpt_index/query_engine/transform_query_engine.py b/llama_index/query_engine/transform_query_engine.py similarity index 89% rename from gpt_index/query_engine/transform_query_engine.py rename to llama_index/query_engine/transform_query_engine.py index 9b4a5d2829933..67c78c6c0df8d 100644 --- a/gpt_index/query_engine/transform_query_engine.py +++ b/llama_index/query_engine/transform_query_engine.py @@ -1,9 +1,9 @@ from typing import List, Optional, Sequence -from gpt_index.data_structs.node_v2 import NodeWithScore -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.indices.query.query_transform.base import BaseQueryTransform -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.response.schema import RESPONSE_TYPE +from llama_index.data_structs.node_v2 import NodeWithScore +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.indices.query.query_transform.base import BaseQueryTransform +from llama_index.indices.query.schema import QueryBundle +from llama_index.response.schema import RESPONSE_TYPE class TransformQueryEngine(BaseQueryEngine): diff --git a/llama_index/readers/__init__.py b/llama_index/readers/__init__.py new file mode 100644 index 0000000000000..ed98a003918f1 --- /dev/null +++ b/llama_index/readers/__init__.py @@ -0,0 +1,83 @@ +"""Data Connectors for LlamaIndex. + +This module contains the data connectors for LlamaIndex. Each connector inherits +from a `BaseReader` class, connects to a data source, and loads Document objects +from that data source. + +You may also choose to construct Document objects manually, for instance +in our `Insert How-To Guide <../how_to/insert.html>`_. See below for the API +definition of a Document - the bare minimum is a `text` property. + +""" + +from llama_index.readers.chatgpt_plugin import ChatGPTRetrievalPluginReader +from llama_index.readers.chroma import ChromaReader +from llama_index.readers.deeplake import DeepLakeReader +from llama_index.readers.discord_reader import DiscordReader +from llama_index.readers.elasticsearch import ElasticsearchReader +from llama_index.readers.faiss import FaissReader + +# readers +from llama_index.readers.file.base import SimpleDirectoryReader +from llama_index.readers.github_readers.github_repository_reader import ( + GithubRepositoryReader, +) +from llama_index.readers.google_readers.gdocs import GoogleDocsReader +from llama_index.readers.json import JSONReader +from llama_index.readers.make_com.wrapper import MakeWrapper +from llama_index.readers.mbox import MboxReader +from llama_index.readers.milvus import MilvusReader +from llama_index.readers.mongo import SimpleMongoReader +from llama_index.readers.myscale import MyScaleReader +from llama_index.readers.notion import NotionPageReader +from llama_index.readers.obsidian import ObsidianReader +from llama_index.readers.pinecone import PineconeReader +from llama_index.readers.qdrant import QdrantReader +from llama_index.readers.schema.base import Document +from llama_index.readers.slack import SlackReader +from llama_index.readers.steamship.file_reader import SteamshipFileReader +from llama_index.readers.string_iterable import StringIterableReader +from llama_index.readers.twitter import TwitterTweetReader +from llama_index.readers.weaviate.reader import WeaviateReader +from llama_index.readers.web import ( + BeautifulSoupWebReader, + RssReader, + SimpleWebPageReader, + TrafilaturaWebReader, +) +from llama_index.readers.wikipedia import WikipediaReader +from llama_index.readers.youtube_transcript import YoutubeTranscriptReader + +__all__ = [ + "WikipediaReader", + "YoutubeTranscriptReader", + "SimpleDirectoryReader", + "JSONReader", + "SimpleMongoReader", + "NotionPageReader", + "GoogleDocsReader", + "DiscordReader", + "SlackReader", + "WeaviateReader", + "PineconeReader", + "QdrantReader", + "MilvusReader", + "ChromaReader", + "DeepLakeReader", + "FaissReader", + "MyScaleReader", + "Document", + "StringIterableReader", + "SimpleWebPageReader", + "BeautifulSoupWebReader", + "TrafilaturaWebReader", + "RssReader", + "MakeWrapper", + "TwitterTweetReader", + "ObsidianReader", + "GithubRepositoryReader", + "MboxReader", + "ElasticsearchReader", + "SteamshipFileReader", + "ChatGPTRetrievalPluginReader", +] diff --git a/gpt_index/readers/base.py b/llama_index/readers/base.py similarity index 91% rename from gpt_index/readers/base.py rename to llama_index/readers/base.py index f5cc30de3365f..a7056e69b3483 100644 --- a/gpt_index/readers/base.py +++ b/llama_index/readers/base.py @@ -4,7 +4,7 @@ from langchain.docstore.document import Document as LCDocument -from gpt_index.readers.schema.base import Document +from llama_index.readers.schema.base import Document class BaseReader: diff --git a/llama_index/readers/chatgpt_plugin/__init__.py b/llama_index/readers/chatgpt_plugin/__init__.py new file mode 100644 index 0000000000000..f0d906d47af95 --- /dev/null +++ b/llama_index/readers/chatgpt_plugin/__init__.py @@ -0,0 +1,5 @@ +"""Init params.""" + +from llama_index.readers.chatgpt_plugin.base import ChatGPTRetrievalPluginReader + +__all__ = ["ChatGPTRetrievalPluginReader"] diff --git a/gpt_index/readers/chatgpt_plugin/base.py b/llama_index/readers/chatgpt_plugin/base.py similarity index 95% rename from gpt_index/readers/chatgpt_plugin/base.py rename to llama_index/readers/chatgpt_plugin/base.py index c8ad600a514a0..c85f36fb66e99 100644 --- a/gpt_index/readers/chatgpt_plugin/base.py +++ b/llama_index/readers/chatgpt_plugin/base.py @@ -6,8 +6,8 @@ import requests from requests.adapters import HTTPAdapter, Retry -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class ChatGPTRetrievalPluginReader(BaseReader): diff --git a/gpt_index/readers/chroma.py b/llama_index/readers/chroma.py similarity index 97% rename from gpt_index/readers/chroma.py rename to llama_index/readers/chroma.py index 188814f46b6d3..8a5ef493b6ac4 100644 --- a/gpt_index/readers/chroma.py +++ b/llama_index/readers/chroma.py @@ -2,8 +2,8 @@ from typing import Any, List, Optional, Union -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class ChromaReader(BaseReader): diff --git a/gpt_index/readers/database.py b/llama_index/readers/database.py similarity index 94% rename from gpt_index/readers/database.py rename to llama_index/readers/database.py index 336fc520f5fee..c28b9ffc62396 100644 --- a/gpt_index/readers/database.py +++ b/llama_index/readers/database.py @@ -5,9 +5,9 @@ from sqlalchemy import text from sqlalchemy.engine import Engine -from gpt_index.langchain_helpers.sql_wrapper import SQLDatabase -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.langchain_helpers.sql_wrapper import SQLDatabase +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class DatabaseReader(BaseReader): diff --git a/gpt_index/readers/deeplake.py b/llama_index/readers/deeplake.py similarity index 97% rename from gpt_index/readers/deeplake.py rename to llama_index/readers/deeplake.py index 7df035cdb0851..2a6a02a5a9a91 100644 --- a/gpt_index/readers/deeplake.py +++ b/llama_index/readers/deeplake.py @@ -2,8 +2,8 @@ from typing import List, Optional, Union import numpy as np -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document distance_metric_map = { "l2": lambda a, b: np.linalg.norm(a - b, axis=1, ord=2), diff --git a/gpt_index/readers/discord_reader.py b/llama_index/readers/discord_reader.py similarity index 97% rename from gpt_index/readers/discord_reader.py rename to llama_index/readers/discord_reader.py index 35c96d5f325f6..9d24fc9bd1e89 100644 --- a/gpt_index/readers/discord_reader.py +++ b/llama_index/readers/discord_reader.py @@ -10,8 +10,8 @@ import os from typing import List, Optional -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document logger = logging.getLogger(__name__) diff --git a/gpt_index/readers/download.py b/llama_index/readers/download.py similarity index 97% rename from gpt_index/readers/download.py rename to llama_index/readers/download.py index 60053b4284072..b78bac4f98eb3 100644 --- a/gpt_index/readers/download.py +++ b/llama_index/readers/download.py @@ -12,7 +12,7 @@ import requests from pkg_resources import DistributionNotFound -from gpt_index.readers.base import BaseReader +from llama_index.readers.base import BaseReader LLAMA_HUB_CONTENTS_URL = "https://raw.githubusercontent.com/emptycrown/loader-hub/main" LOADER_HUB_PATH = "/loader_hub" @@ -94,7 +94,7 @@ def download_loader( refresh_cache: If true, the local cache will be skipped and the loader will be fetched directly from the remote repo. use_gpt_index_import: If true, the loader files will use - gpt_index as the base dependency. By default (False), + llama_index as the base dependency. By default (False), the loader files use llama_index as the base dependency. NOTE: this is a temporary workaround while we fully migrate all usages to llama_index. @@ -153,10 +153,10 @@ def download_loader( ) if use_gpt_index_import: basepy_raw_content = basepy_raw_content.replace( - "import llama_index", "import gpt_index" + "import llama_index", "import llama_index" ) basepy_raw_content = basepy_raw_content.replace( - "from llama_index", "from gpt_index" + "from llama_index", "from llama_index" ) with open(f"{loader_path}/base.py", "w") as f: diff --git a/gpt_index/readers/elasticsearch.py b/llama_index/readers/elasticsearch.py similarity index 95% rename from gpt_index/readers/elasticsearch.py rename to llama_index/readers/elasticsearch.py index 98f17a5462be5..e2951f4d4c7b7 100644 --- a/gpt_index/readers/elasticsearch.py +++ b/llama_index/readers/elasticsearch.py @@ -7,8 +7,8 @@ from typing import List, Optional -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class ElasticsearchReader(BaseReader): diff --git a/gpt_index/readers/faiss.py b/llama_index/readers/faiss.py similarity index 95% rename from gpt_index/readers/faiss.py rename to llama_index/readers/faiss.py index 0c966a038a46a..eebd05ae3cd60 100644 --- a/gpt_index/readers/faiss.py +++ b/llama_index/readers/faiss.py @@ -4,8 +4,8 @@ import numpy as np -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class FaissReader(BaseReader): diff --git a/gpt_index/readers/file/__init__.py b/llama_index/readers/file/__init__.py similarity index 100% rename from gpt_index/readers/file/__init__.py rename to llama_index/readers/file/__init__.py diff --git a/gpt_index/readers/file/base.py b/llama_index/readers/file/base.py similarity index 90% rename from gpt_index/readers/file/base.py rename to llama_index/readers/file/base.py index ed55c6e5362dd..19d9c0ebdac4d 100644 --- a/gpt_index/readers/file/base.py +++ b/llama_index/readers/file/base.py @@ -4,18 +4,18 @@ from pathlib import Path from typing import Callable, Dict, Generator, List, Optional, Union, cast -from gpt_index.readers.base import BaseReader -from gpt_index.readers.file.base_parser import BaseParser, ImageParserOutput -from gpt_index.readers.file.docs_parser import DocxParser, PDFParser -from gpt_index.readers.file.epub_parser import EpubParser -from gpt_index.readers.file.image_parser import ImageParser -from gpt_index.readers.file.markdown_parser import MarkdownParser -from gpt_index.readers.file.mbox_parser import MboxParser -from gpt_index.readers.file.slides_parser import PptxParser -from gpt_index.readers.file.tabular_parser import PandasCSVParser -from gpt_index.readers.file.video_audio import VideoAudioParser -from gpt_index.readers.file.ipynb_parser import IPYNBParser -from gpt_index.readers.schema.base import Document, ImageDocument +from llama_index.readers.base import BaseReader +from llama_index.readers.file.base_parser import BaseParser, ImageParserOutput +from llama_index.readers.file.docs_parser import DocxParser, PDFParser +from llama_index.readers.file.epub_parser import EpubParser +from llama_index.readers.file.image_parser import ImageParser +from llama_index.readers.file.markdown_parser import MarkdownParser +from llama_index.readers.file.mbox_parser import MboxParser +from llama_index.readers.file.slides_parser import PptxParser +from llama_index.readers.file.tabular_parser import PandasCSVParser +from llama_index.readers.file.video_audio import VideoAudioParser +from llama_index.readers.file.ipynb_parser import IPYNBParser +from llama_index.readers.schema.base import Document, ImageDocument DEFAULT_FILE_EXTRACTOR: Dict[str, BaseParser] = { ".pdf": PDFParser(), diff --git a/gpt_index/readers/file/base_parser.py b/llama_index/readers/file/base_parser.py similarity index 100% rename from gpt_index/readers/file/base_parser.py rename to llama_index/readers/file/base_parser.py diff --git a/gpt_index/readers/file/docs_parser.py b/llama_index/readers/file/docs_parser.py similarity index 96% rename from gpt_index/readers/file/docs_parser.py rename to llama_index/readers/file/docs_parser.py index ea8e57f922f95..a1615955f4ccf 100644 --- a/gpt_index/readers/file/docs_parser.py +++ b/llama_index/readers/file/docs_parser.py @@ -6,7 +6,7 @@ from pathlib import Path from typing import Dict -from gpt_index.readers.file.base_parser import BaseParser +from llama_index.readers.file.base_parser import BaseParser class PDFParser(BaseParser): diff --git a/gpt_index/readers/file/epub_parser.py b/llama_index/readers/file/epub_parser.py similarity index 95% rename from gpt_index/readers/file/epub_parser.py rename to llama_index/readers/file/epub_parser.py index cbf15b09dd92d..20d0cddc5c88d 100644 --- a/gpt_index/readers/file/epub_parser.py +++ b/llama_index/readers/file/epub_parser.py @@ -6,7 +6,7 @@ from pathlib import Path from typing import Dict -from gpt_index.readers.file.base_parser import BaseParser +from llama_index.readers.file.base_parser import BaseParser class EpubParser(BaseParser): diff --git a/gpt_index/readers/file/image_caption_parser.py b/llama_index/readers/file/image_caption_parser.py similarity index 95% rename from gpt_index/readers/file/image_caption_parser.py rename to llama_index/readers/file/image_caption_parser.py index 520701ca41909..846ec73b843f6 100644 --- a/gpt_index/readers/file/image_caption_parser.py +++ b/llama_index/readers/file/image_caption_parser.py @@ -1,7 +1,7 @@ from pathlib import Path from typing import Dict, Optional -from gpt_index.readers.file.base_parser import BaseParser, ImageParserOutput +from llama_index.readers.file.base_parser import BaseParser, ImageParserOutput class ImageCaptionParser(BaseParser): @@ -72,7 +72,7 @@ def parse_file(self, file: Path, errors: str = "ignore") -> ImageParserOutput: """Parse file.""" from PIL import Image - from gpt_index.img_utils import img_2_b64 + from llama_index.img_utils import img_2_b64 # load document image image = Image.open(file) diff --git a/gpt_index/readers/file/image_parser.py b/llama_index/readers/file/image_parser.py similarity index 96% rename from gpt_index/readers/file/image_parser.py rename to llama_index/readers/file/image_parser.py index 44f55fccff612..87eae4e4a0aaf 100644 --- a/gpt_index/readers/file/image_parser.py +++ b/llama_index/readers/file/image_parser.py @@ -8,7 +8,7 @@ from pathlib import Path from typing import Dict, Optional -from gpt_index.readers.file.base_parser import BaseParser, ImageParserOutput +from llama_index.readers.file.base_parser import BaseParser, ImageParserOutput class ImageParser(BaseParser): @@ -73,7 +73,7 @@ def parse_file(self, file: Path, errors: str = "ignore") -> ImageParserOutput: """Parse file.""" from PIL import Image - from gpt_index.img_utils import img_2_b64 + from llama_index.img_utils import img_2_b64 # load document image image = Image.open(file) diff --git a/gpt_index/readers/file/image_vision_llm_parser.py b/llama_index/readers/file/image_vision_llm_parser.py similarity index 95% rename from gpt_index/readers/file/image_vision_llm_parser.py rename to llama_index/readers/file/image_vision_llm_parser.py index ebb3d0e7a2304..ac0ea8c35b419 100644 --- a/gpt_index/readers/file/image_vision_llm_parser.py +++ b/llama_index/readers/file/image_vision_llm_parser.py @@ -1,7 +1,7 @@ from pathlib import Path from typing import Dict, Optional -from gpt_index.readers.file.base_parser import BaseParser, ImageParserOutput +from llama_index.readers.file.base_parser import BaseParser, ImageParserOutput class ImageVisionLLMParser(BaseParser): @@ -68,7 +68,7 @@ def parse_file(self, file: Path, errors: str = "ignore") -> ImageParserOutput: """Parse file.""" from PIL import Image - from gpt_index.img_utils import img_2_b64 + from llama_index.img_utils import img_2_b64 # load document image image = Image.open(file) diff --git a/gpt_index/readers/file/ipynb_parser.py b/llama_index/readers/file/ipynb_parser.py similarity index 94% rename from gpt_index/readers/file/ipynb_parser.py rename to llama_index/readers/file/ipynb_parser.py index a492cd82dacc1..4ff2f6bc9dd62 100644 --- a/gpt_index/readers/file/ipynb_parser.py +++ b/llama_index/readers/file/ipynb_parser.py @@ -2,7 +2,7 @@ from pathlib import Path from typing import Dict, Optional, List -from gpt_index.readers.file.base_parser import BaseParser +from llama_index.readers.file.base_parser import BaseParser class IPYNBParser(BaseParser): diff --git a/gpt_index/readers/file/markdown_parser.py b/llama_index/readers/file/markdown_parser.py similarity index 98% rename from gpt_index/readers/file/markdown_parser.py rename to llama_index/readers/file/markdown_parser.py index cdc5c8c0497eb..99b6c4e30cd78 100644 --- a/gpt_index/readers/file/markdown_parser.py +++ b/llama_index/readers/file/markdown_parser.py @@ -7,7 +7,7 @@ from pathlib import Path from typing import Any, Dict, List, Optional, Tuple, Union, cast -from gpt_index.readers.file.base_parser import BaseParser +from llama_index.readers.file.base_parser import BaseParser class MarkdownParser(BaseParser): diff --git a/gpt_index/readers/file/mbox_parser.py b/llama_index/readers/file/mbox_parser.py similarity index 98% rename from gpt_index/readers/file/mbox_parser.py rename to llama_index/readers/file/mbox_parser.py index 82dfb584e28b4..09086d1ea3246 100644 --- a/gpt_index/readers/file/mbox_parser.py +++ b/llama_index/readers/file/mbox_parser.py @@ -6,7 +6,7 @@ from pathlib import Path from typing import Any, Dict, List -from gpt_index.readers.file.base_parser import BaseParser +from llama_index.readers.file.base_parser import BaseParser class MboxParser(BaseParser): diff --git a/gpt_index/readers/file/slides_parser.py b/llama_index/readers/file/slides_parser.py similarity index 98% rename from gpt_index/readers/file/slides_parser.py rename to llama_index/readers/file/slides_parser.py index 743ec43583a07..19895fc5fdb33 100644 --- a/gpt_index/readers/file/slides_parser.py +++ b/llama_index/readers/file/slides_parser.py @@ -8,7 +8,7 @@ from pathlib import Path from typing import Dict -from gpt_index.readers.file.base_parser import BaseParser +from llama_index.readers.file.base_parser import BaseParser class PptxParser(BaseParser): diff --git a/gpt_index/readers/file/tabular_parser.py b/llama_index/readers/file/tabular_parser.py similarity index 98% rename from gpt_index/readers/file/tabular_parser.py rename to llama_index/readers/file/tabular_parser.py index 4236c0242d3a5..ab55ecba706ec 100644 --- a/gpt_index/readers/file/tabular_parser.py +++ b/llama_index/readers/file/tabular_parser.py @@ -8,7 +8,7 @@ import pandas as pd -from gpt_index.readers.file.base_parser import BaseParser +from llama_index.readers.file.base_parser import BaseParser class CSVParser(BaseParser): diff --git a/gpt_index/readers/file/video_audio.py b/llama_index/readers/file/video_audio.py similarity index 96% rename from gpt_index/readers/file/video_audio.py rename to llama_index/readers/file/video_audio.py index d0d3742e82912..d957ae53d7dac 100644 --- a/gpt_index/readers/file/video_audio.py +++ b/llama_index/readers/file/video_audio.py @@ -6,7 +6,7 @@ from pathlib import Path from typing import Any, Dict, cast -from gpt_index.readers.file.base_parser import BaseParser +from llama_index.readers.file.base_parser import BaseParser class VideoAudioParser(BaseParser): diff --git a/gpt_index/readers/github_readers/__init__.py b/llama_index/readers/github_readers/__init__.py similarity index 100% rename from gpt_index/readers/github_readers/__init__.py rename to llama_index/readers/github_readers/__init__.py diff --git a/gpt_index/readers/github_readers/github_api_client.py b/llama_index/readers/github_readers/github_api_client.py similarity index 100% rename from gpt_index/readers/github_readers/github_api_client.py rename to llama_index/readers/github_readers/github_api_client.py diff --git a/gpt_index/readers/github_readers/github_repository_reader.py b/llama_index/readers/github_readers/github_repository_reader.py similarity index 97% rename from gpt_index/readers/github_readers/github_repository_reader.py rename to llama_index/readers/github_readers/github_repository_reader.py index b239221dc3d84..d8eafeb2e8cdb 100644 --- a/gpt_index/readers/github_readers/github_repository_reader.py +++ b/llama_index/readers/github_readers/github_repository_reader.py @@ -15,21 +15,21 @@ import tempfile from typing import Any, Callable, List, Optional, Tuple -from gpt_index.readers.base import BaseReader -from gpt_index.readers.file.base import DEFAULT_FILE_EXTRACTOR -from gpt_index.readers.file.base_parser import ImageParserOutput -from gpt_index.readers.github_readers.github_api_client import ( +from llama_index.readers.base import BaseReader +from llama_index.readers.file.base import DEFAULT_FILE_EXTRACTOR +from llama_index.readers.file.base_parser import ImageParserOutput +from llama_index.readers.github_readers.github_api_client import ( GitBranchResponseModel, GitCommitResponseModel, GithubClient, GitTreeResponseModel, ) -from gpt_index.readers.github_readers.utils import ( +from llama_index.readers.github_readers.utils import ( BufferedGitBlobDataIterator, get_file_extension, print_if_verbose, ) -from gpt_index.readers.schema.base import Document +from llama_index.readers.schema.base import Document logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) @@ -405,7 +405,7 @@ def wrapper(*args: Any, **kwargs: Any) -> None: reader1 = GithubRepositoryReader( github_token=os.environ["GITHUB_TOKEN"], owner="jerryjliu", - repo="gpt_index", + repo="llama_index", use_parser=False, verbose=True, ignore_directories=["examples"], diff --git a/gpt_index/readers/github_readers/utils.py b/llama_index/readers/github_readers/utils.py similarity index 98% rename from gpt_index/readers/github_readers/utils.py rename to llama_index/readers/github_readers/utils.py index 98449e52eda3d..0fee1386e79dc 100644 --- a/gpt_index/readers/github_readers/utils.py +++ b/llama_index/readers/github_readers/utils.py @@ -9,7 +9,7 @@ from abc import ABC, abstractmethod from typing import List, Tuple -from gpt_index.readers.github_readers.github_api_client import ( +from llama_index.readers.github_readers.github_api_client import ( GitBlobResponseModel, GithubClient, GitTreeResponseModel, diff --git a/gpt_index/readers/google_readers/__init__.py b/llama_index/readers/google_readers/__init__.py similarity index 100% rename from gpt_index/readers/google_readers/__init__.py rename to llama_index/readers/google_readers/__init__.py diff --git a/gpt_index/readers/google_readers/gdocs.py b/llama_index/readers/google_readers/gdocs.py similarity index 98% rename from gpt_index/readers/google_readers/gdocs.py rename to llama_index/readers/google_readers/gdocs.py index 673123801adca..3732fabcad426 100644 --- a/gpt_index/readers/google_readers/gdocs.py +++ b/llama_index/readers/google_readers/gdocs.py @@ -4,8 +4,8 @@ import os from typing import Any, List -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document SCOPES = ["https://www.googleapis.com/auth/documents.readonly"] diff --git a/gpt_index/readers/google_readers/gsheets.py b/llama_index/readers/google_readers/gsheets.py similarity index 97% rename from gpt_index/readers/google_readers/gsheets.py rename to llama_index/readers/google_readers/gsheets.py index 0363cc425d94d..14092534d823f 100644 --- a/gpt_index/readers/google_readers/gsheets.py +++ b/llama_index/readers/google_readers/gsheets.py @@ -4,8 +4,8 @@ import os from typing import Any, List -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document SCOPES = ["https://www.googleapis.com/auth/spreadsheets.readonly"] diff --git a/gpt_index/readers/json.py b/llama_index/readers/json.py similarity index 97% rename from gpt_index/readers/json.py rename to llama_index/readers/json.py index b85344bf2686d..96275ab83313e 100644 --- a/gpt_index/readers/json.py +++ b/llama_index/readers/json.py @@ -4,8 +4,8 @@ import re from typing import Any, Generator, List, Optional -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document def _depth_first_yield( diff --git a/gpt_index/readers/make_com/__init__.py b/llama_index/readers/make_com/__init__.py similarity index 100% rename from gpt_index/readers/make_com/__init__.py rename to llama_index/readers/make_com/__init__.py diff --git a/gpt_index/readers/make_com/wrapper.py b/llama_index/readers/make_com/wrapper.py similarity index 87% rename from gpt_index/readers/make_com/wrapper.py rename to llama_index/readers/make_com/wrapper.py index 58ba01b77222b..126e7146ec6de 100644 --- a/gpt_index/readers/make_com/wrapper.py +++ b/llama_index/readers/make_com/wrapper.py @@ -7,11 +7,11 @@ from typing import Any, List, Optional import requests -from gpt_index.data_structs.node_v2 import Node, NodeWithScore +from llama_index.data_structs.node_v2 import Node, NodeWithScore -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document -from gpt_index.response.schema import Response +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document +from llama_index.response.schema import Response class MakeWrapper(BaseReader): diff --git a/gpt_index/readers/mbox.py b/llama_index/readers/mbox.py similarity index 87% rename from gpt_index/readers/mbox.py rename to llama_index/readers/mbox.py index 83bf7d213a7de..5be949280bbdb 100644 --- a/gpt_index/readers/mbox.py +++ b/llama_index/readers/mbox.py @@ -3,9 +3,9 @@ from pathlib import Path from typing import Any, List -from gpt_index.readers.base import BaseReader -from gpt_index.readers.file.mbox_parser import MboxParser -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.file.mbox_parser import MboxParser +from llama_index.readers.schema.base import Document class MboxReader(BaseReader): diff --git a/gpt_index/readers/milvus.py b/llama_index/readers/milvus.py similarity index 97% rename from gpt_index/readers/milvus.py rename to llama_index/readers/milvus.py index 96c5e8d827a9b..c5d360c7fe77b 100644 --- a/gpt_index/readers/milvus.py +++ b/llama_index/readers/milvus.py @@ -3,8 +3,8 @@ from typing import Any, Dict, List, Optional from uuid import uuid4 -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class MilvusReader(BaseReader): diff --git a/gpt_index/readers/mongo.py b/llama_index/readers/mongo.py similarity index 96% rename from gpt_index/readers/mongo.py rename to llama_index/readers/mongo.py index 23a71ce7e8792..7eced17dfbe85 100644 --- a/gpt_index/readers/mongo.py +++ b/llama_index/readers/mongo.py @@ -2,8 +2,8 @@ from typing import Dict, List, Optional -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class SimpleMongoReader(BaseReader): diff --git a/gpt_index/readers/myscale.py b/llama_index/readers/myscale.py similarity index 98% rename from gpt_index/readers/myscale.py rename to llama_index/readers/myscale.py index 3adb3cf675072..5006b717ea80f 100644 --- a/gpt_index/readers/myscale.py +++ b/llama_index/readers/myscale.py @@ -2,8 +2,8 @@ import logging from typing import Any, List, Optional -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document logger = logging.getLogger(__name__) diff --git a/gpt_index/readers/notion.py b/llama_index/readers/notion.py similarity index 98% rename from gpt_index/readers/notion.py rename to llama_index/readers/notion.py index 405830458e12c..496d2bcac8747 100644 --- a/gpt_index/readers/notion.py +++ b/llama_index/readers/notion.py @@ -5,8 +5,8 @@ import requests # type: ignore -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document INTEGRATION_TOKEN_NAME = "NOTION_INTEGRATION_TOKEN" BLOCK_CHILD_URL_TMPL = "https://api.notion.com/v1/blocks/{block_id}/children" diff --git a/gpt_index/readers/obsidian.py b/llama_index/readers/obsidian.py similarity index 89% rename from gpt_index/readers/obsidian.py rename to llama_index/readers/obsidian.py index 1404005433f2a..57e2a34308edf 100644 --- a/gpt_index/readers/obsidian.py +++ b/llama_index/readers/obsidian.py @@ -11,9 +11,9 @@ from langchain.docstore.document import Document as LCDocument -from gpt_index.readers.base import BaseReader -from gpt_index.readers.file.markdown_parser import MarkdownParser -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.file.markdown_parser import MarkdownParser +from llama_index.readers.schema.base import Document class ObsidianReader(BaseReader): diff --git a/gpt_index/readers/pinecone.py b/llama_index/readers/pinecone.py similarity index 96% rename from gpt_index/readers/pinecone.py rename to llama_index/readers/pinecone.py index daf3022ccfd97..d498d7a01bbcf 100644 --- a/gpt_index/readers/pinecone.py +++ b/llama_index/readers/pinecone.py @@ -2,8 +2,8 @@ from typing import Any, Dict, List, Optional -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class PineconeReader(BaseReader): diff --git a/gpt_index/readers/qdrant.py b/llama_index/readers/qdrant.py similarity index 97% rename from gpt_index/readers/qdrant.py rename to llama_index/readers/qdrant.py index b6a76e4236e4b..0d52dae88c1cb 100644 --- a/gpt_index/readers/qdrant.py +++ b/llama_index/readers/qdrant.py @@ -2,8 +2,8 @@ from typing import List, Optional, cast -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class QdrantReader(BaseReader): diff --git a/gpt_index/readers/schema/__init__.py b/llama_index/readers/schema/__init__.py similarity index 100% rename from gpt_index/readers/schema/__init__.py rename to llama_index/readers/schema/__init__.py diff --git a/gpt_index/readers/schema/base.py b/llama_index/readers/schema/base.py similarity index 96% rename from gpt_index/readers/schema/base.py rename to llama_index/readers/schema/base.py index 077d5b39476f1..64445701817c4 100644 --- a/gpt_index/readers/schema/base.py +++ b/llama_index/readers/schema/base.py @@ -4,7 +4,7 @@ from langchain.docstore.document import Document as LCDocument -from gpt_index.schema import BaseDocument +from llama_index.schema import BaseDocument @dataclass diff --git a/gpt_index/readers/slack.py b/llama_index/readers/slack.py similarity index 98% rename from gpt_index/readers/slack.py rename to llama_index/readers/slack.py index 79a47db10f921..faa750236c5fa 100644 --- a/gpt_index/readers/slack.py +++ b/llama_index/readers/slack.py @@ -6,8 +6,8 @@ from ssl import SSLContext from typing import List, Optional -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document logger = logging.getLogger(__name__) diff --git a/gpt_index/readers/steamship/__init__.py b/llama_index/readers/steamship/__init__.py similarity index 100% rename from gpt_index/readers/steamship/__init__.py rename to llama_index/readers/steamship/__init__.py diff --git a/gpt_index/readers/steamship/file_reader.py b/llama_index/readers/steamship/file_reader.py similarity index 97% rename from gpt_index/readers/steamship/file_reader.py rename to llama_index/readers/steamship/file_reader.py index b9c4185f166fd..f59f75fda7853 100644 --- a/gpt_index/readers/steamship/file_reader.py +++ b/llama_index/readers/steamship/file_reader.py @@ -1,8 +1,8 @@ """Load Documents from a set of persistent Steamship Files.""" from typing import List, Optional -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class SteamshipFileReader(BaseReader): diff --git a/gpt_index/readers/string_iterable.py b/llama_index/readers/string_iterable.py similarity index 83% rename from gpt_index/readers/string_iterable.py rename to llama_index/readers/string_iterable.py index 00c81d4285ecf..0963b90ff3b1f 100644 --- a/gpt_index/readers/string_iterable.py +++ b/llama_index/readers/string_iterable.py @@ -1,8 +1,8 @@ """Simple reader that turns an iterable of strings into a list of Documents.""" from typing import List -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class StringIterableReader(BaseReader): @@ -13,7 +13,7 @@ class StringIterableReader(BaseReader): Example: .. code-block:: python - from gpt_index import StringIterableReader, GPTTreeIndex + from llama_index import StringIterableReader, GPTTreeIndex documents = StringIterableReader().load_data( texts=["I went to the store", "I bought an apple"]) diff --git a/gpt_index/readers/twitter.py b/llama_index/readers/twitter.py similarity index 94% rename from gpt_index/readers/twitter.py rename to llama_index/readers/twitter.py index 423a9147511d8..0ef9b3f735a8f 100644 --- a/gpt_index/readers/twitter.py +++ b/llama_index/readers/twitter.py @@ -1,8 +1,8 @@ """Simple reader that reads tweets of a twitter handle.""" from typing import Any, List, Optional -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class TwitterTweetReader(BaseReader): diff --git a/gpt_index/readers/weaviate/__init__.py b/llama_index/readers/weaviate/__init__.py similarity index 100% rename from gpt_index/readers/weaviate/__init__.py rename to llama_index/readers/weaviate/__init__.py diff --git a/gpt_index/readers/weaviate/client.py b/llama_index/readers/weaviate/client.py similarity index 96% rename from gpt_index/readers/weaviate/client.py rename to llama_index/readers/weaviate/client.py index 7b8325251cc21..415943dd060df 100644 --- a/gpt_index/readers/weaviate/client.py +++ b/llama_index/readers/weaviate/client.py @@ -8,15 +8,15 @@ from dataclasses import field from typing import Any, Dict, List, Optional, cast -from gpt_index.data_structs.data_structs_v2 import Node -from gpt_index.data_structs.node_v2 import DocumentRelationship -from gpt_index.readers.weaviate.utils import ( +from llama_index.data_structs.data_structs_v2 import Node +from llama_index.data_structs.node_v2 import DocumentRelationship +from llama_index.readers.weaviate.utils import ( get_by_id, parse_get_response, validate_client, ) -from gpt_index.utils import get_new_id -from gpt_index.vector_stores.types import VectorStoreQuery, VectorStoreQueryMode +from llama_index.utils import get_new_id +from llama_index.vector_stores.types import VectorStoreQuery, VectorStoreQueryMode import logging diff --git a/gpt_index/readers/weaviate/reader.py b/llama_index/readers/weaviate/reader.py similarity index 97% rename from gpt_index/readers/weaviate/reader.py rename to llama_index/readers/weaviate/reader.py index 6bb93bca3bdbc..7cd155d200a98 100644 --- a/gpt_index/readers/weaviate/reader.py +++ b/llama_index/readers/weaviate/reader.py @@ -2,8 +2,8 @@ from typing import Any, List, Optional -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class WeaviateReader(BaseReader): diff --git a/gpt_index/readers/weaviate/utils.py b/llama_index/readers/weaviate/utils.py similarity index 97% rename from gpt_index/readers/weaviate/utils.py rename to llama_index/readers/weaviate/utils.py index 2842423eabc9e..551a7ff18bd9f 100644 --- a/gpt_index/readers/weaviate/utils.py +++ b/llama_index/readers/weaviate/utils.py @@ -2,7 +2,7 @@ from typing import Any, Dict, List, Set, cast -from gpt_index.utils import get_new_int_id +from llama_index.utils import get_new_int_id DEFAULT_CLASS_PREFIX_STUB = "Gpt_Index" diff --git a/gpt_index/readers/web.py b/llama_index/readers/web.py similarity index 98% rename from gpt_index/readers/web.py rename to llama_index/readers/web.py index f8f43cb935654..4eb305824de7c 100644 --- a/gpt_index/readers/web.py +++ b/llama_index/readers/web.py @@ -4,8 +4,8 @@ import requests -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document logger = logging.getLogger(__name__) diff --git a/gpt_index/readers/wikipedia.py b/llama_index/readers/wikipedia.py similarity index 89% rename from gpt_index/readers/wikipedia.py rename to llama_index/readers/wikipedia.py index ff84e43b11be1..1e664fda399a3 100644 --- a/gpt_index/readers/wikipedia.py +++ b/llama_index/readers/wikipedia.py @@ -1,8 +1,8 @@ """Simple reader that reads wikipedia.""" from typing import Any, List -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class WikipediaReader(BaseReader): diff --git a/gpt_index/readers/youtube_transcript.py b/llama_index/readers/youtube_transcript.py similarity index 91% rename from gpt_index/readers/youtube_transcript.py rename to llama_index/readers/youtube_transcript.py index a67e9f96fb57a..aa351080e134a 100644 --- a/gpt_index/readers/youtube_transcript.py +++ b/llama_index/readers/youtube_transcript.py @@ -1,8 +1,8 @@ """Simple Reader that reads transcript of youtube video.""" from typing import Any, List -from gpt_index.readers.base import BaseReader -from gpt_index.readers.schema.base import Document +from llama_index.readers.base import BaseReader +from llama_index.readers.schema.base import Document class YoutubeTranscriptReader(BaseReader): diff --git a/gpt_index/response/__init__.py b/llama_index/response/__init__.py similarity index 100% rename from gpt_index/response/__init__.py rename to llama_index/response/__init__.py diff --git a/gpt_index/response/notebook_utils.py b/llama_index/response/notebook_utils.py similarity index 89% rename from gpt_index/response/notebook_utils.py rename to llama_index/response/notebook_utils.py index 0484e0849e74f..49da84e9f1897 100644 --- a/gpt_index/response/notebook_utils.py +++ b/llama_index/response/notebook_utils.py @@ -2,11 +2,11 @@ from typing import Any, Dict, Tuple from IPython.display import Markdown, display -from gpt_index.data_structs.node_v2 import ImageNode, NodeWithScore +from llama_index.data_structs.node_v2 import ImageNode, NodeWithScore -from gpt_index.img_utils import b64_2_img -from gpt_index.response.schema import Response -from gpt_index.utils import truncate_text +from llama_index.img_utils import b64_2_img +from llama_index.response.schema import Response +from llama_index.utils import truncate_text DEFAULT_THUMBNAIL_SIZE = (512, 512) diff --git a/gpt_index/response/schema.py b/llama_index/response/schema.py similarity index 96% rename from gpt_index/response/schema.py rename to llama_index/response/schema.py index 9b93eddebc5a0..a325470857f39 100644 --- a/gpt_index/response/schema.py +++ b/llama_index/response/schema.py @@ -3,8 +3,8 @@ from dataclasses import dataclass, field from typing import Any, Dict, Generator, List, Optional, Union -from gpt_index.data_structs.node_v2 import NodeWithScore -from gpt_index.utils import truncate_text +from llama_index.data_structs.node_v2 import NodeWithScore +from llama_index.utils import truncate_text @dataclass diff --git a/gpt_index/response/utils.py b/llama_index/response/utils.py similarity index 100% rename from gpt_index/response/utils.py rename to llama_index/response/utils.py diff --git a/llama_index/retrievers/__init__.py b/llama_index/retrievers/__init__.py new file mode 100644 index 0000000000000..a98a4d7ed161d --- /dev/null +++ b/llama_index/retrievers/__init__.py @@ -0,0 +1,31 @@ +from llama_index.indices.vector_store.retrievers import VectorIndexRetriever +from llama_index.indices.list.retrievers import ( + ListIndexEmbeddingRetriever, + ListIndexRetriever, +) +from llama_index.indices.knowledge_graph.retrievers import KGTableRetriever +from llama_index.indices.empty.retrievers import EmptyIndexRetriever +from llama_index.indices.tree.all_leaf_retriever import TreeAllLeafRetriever +from llama_index.indices.tree.select_leaf_embedding_retriever import ( + TreeSelectLeafEmbeddingRetriever, +) +from llama_index.indices.tree.select_leaf_retriever import TreeSelectLeafRetriever +from llama_index.indices.tree.tree_root_retriever import TreeRootRetriever +from llama_index.retrievers.transform_retriever import TransformRetriever +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.keyword_table.retrievers import KeywordTableSimpleRetriever + +__all__ = [ + "VectorIndexRetriever", + "ListIndexEmbeddingRetriever", + "ListIndexRetriever", + "KGTableRetriever", + "EmptyIndexRetriever", + "TreeAllLeafRetriever", + "TreeSelectLeafEmbeddingRetriever", + "TreeSelectLeafRetriever", + "TreeRootRetriever", + "TransformRetriever", + "KeywordTableSimpleRetriever", + "BaseRetriever", +] diff --git a/gpt_index/retrievers/transform_retriever.py b/llama_index/retrievers/transform_retriever.py similarity index 76% rename from gpt_index/retrievers/transform_retriever.py rename to llama_index/retrievers/transform_retriever.py index 325aace8c30bb..8c4ce5c4cee99 100644 --- a/gpt_index/retrievers/transform_retriever.py +++ b/llama_index/retrievers/transform_retriever.py @@ -1,8 +1,8 @@ from typing import List, Optional -from gpt_index.data_structs.node_v2 import NodeWithScore -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.query.query_transform.base import BaseQueryTransform -from gpt_index.indices.query.schema import QueryBundle +from llama_index.data_structs.node_v2 import NodeWithScore +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.query.query_transform.base import BaseQueryTransform +from llama_index.indices.query.schema import QueryBundle class TransformRetriever(BaseRetriever): diff --git a/gpt_index/schema.py b/llama_index/schema.py similarity index 98% rename from gpt_index/schema.py rename to llama_index/schema.py index c2ebd28e95e3f..6c1793f31939b 100644 --- a/gpt_index/schema.py +++ b/llama_index/schema.py @@ -6,7 +6,7 @@ from dataclasses_json import DataClassJsonMixin -from gpt_index.utils import get_new_id +from llama_index.utils import get_new_id @dataclass diff --git a/llama_index/selectors/__init__.py b/llama_index/selectors/__init__.py new file mode 100644 index 0000000000000..288b7ace482d5 --- /dev/null +++ b/llama_index/selectors/__init__.py @@ -0,0 +1,9 @@ +from llama_index.selectors.types import BaseSelector, SelectorResult +from llama_index.selectors.llm_selectors import LLMSingleSelector, LLMMultiSelector + +__all__ = [ + "BaseSelector", + "SelectorResult", + "LLMSingleSelector", + "LLMMultiSelector", +] diff --git a/gpt_index/selectors/llm_selectors.py b/llama_index/selectors/llm_selectors.py similarity index 93% rename from gpt_index/selectors/llm_selectors.py rename to llama_index/selectors/llm_selectors.py index 79fc10a003a58..c3a780a7c2ba7 100644 --- a/gpt_index/selectors/llm_selectors.py +++ b/llama_index/selectors/llm_selectors.py @@ -1,22 +1,22 @@ from typing import Any, List, Optional, Sequence, cast -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.service_context import ServiceContext +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.service_context import ServiceContext -from gpt_index.llm_predictor.base import LLMPredictor -from gpt_index.output_parsers.base import BaseOutputParser, StructuredOutput -from gpt_index.output_parsers.selection import ( +from llama_index.llm_predictor.base import LLMPredictor +from llama_index.output_parsers.base import BaseOutputParser, StructuredOutput +from llama_index.output_parsers.selection import ( Answer, SelectionOutputParser, ) -from gpt_index.selectors.prompts import ( +from llama_index.selectors.prompts import ( DEFAULT_MULTI_SELECT_PROMPT_TMPL, DEFAULT_SINGLE_SELECT_PROMPT_TMPL, MultiSelectPrompt, SingleSelectPrompt, ) -from gpt_index.selectors.types import BaseSelector, SelectorResult -from gpt_index.tools.types import ToolMetadata +from llama_index.selectors.types import BaseSelector, SelectorResult +from llama_index.tools.types import ToolMetadata def _build_choices_text(choices: Sequence[ToolMetadata]) -> str: diff --git a/gpt_index/selectors/prompts.py b/llama_index/selectors/prompts.py similarity index 95% rename from gpt_index/selectors/prompts.py rename to llama_index/selectors/prompts.py index 0c8c945b9b3ae..0501d1dfbca52 100644 --- a/gpt_index/selectors/prompts.py +++ b/llama_index/selectors/prompts.py @@ -1,6 +1,6 @@ from typing import List -from gpt_index.prompts.base import Prompt -from gpt_index.prompts.prompt_type import PromptType +from llama_index.prompts.base import Prompt +from llama_index.prompts.prompt_type import PromptType class SingleSelectPrompt(Prompt): diff --git a/gpt_index/selectors/types.py b/llama_index/selectors/types.py similarity index 94% rename from gpt_index/selectors/types.py rename to llama_index/selectors/types.py index 3d1de0cd0405c..9e47d5a00bd5c 100644 --- a/gpt_index/selectors/types.py +++ b/llama_index/selectors/types.py @@ -2,8 +2,8 @@ from dataclasses import dataclass from typing import List, Sequence, Union -from gpt_index.indices.query.schema import QueryBundle, QueryType -from gpt_index.tools.types import ToolMetadata +from llama_index.indices.query.schema import QueryBundle, QueryType +from llama_index.tools.types import ToolMetadata MetadataType = Union[str, ToolMetadata] diff --git a/llama_index/storage/__init__.py b/llama_index/storage/__init__.py new file mode 100644 index 0000000000000..2acc43c6125fd --- /dev/null +++ b/llama_index/storage/__init__.py @@ -0,0 +1,7 @@ +"""Storage classes.""" + +from llama_index.storage.storage_context import StorageContext + +__all__ = [ + "StorageContext", +] diff --git a/llama_index/storage/docstore/__init__.py b/llama_index/storage/docstore/__init__.py new file mode 100644 index 0000000000000..b623ba31ca882 --- /dev/null +++ b/llama_index/storage/docstore/__init__.py @@ -0,0 +1,16 @@ +from llama_index.storage.docstore.types import BaseDocumentStore +from llama_index.storage.docstore.simple_docstore import SimpleDocumentStore +from llama_index.storage.docstore.mongo_docstore import MongoDocumentStore +from llama_index.storage.docstore.keyval_docstore import KVDocumentStore + +# alias for backwards compatibility +from llama_index.storage.docstore.simple_docstore import DocumentStore + + +__all__ = [ + "BaseDocumentStore", + "DocumentStore", + "SimpleDocumentStore", + "MongoDocumentStore", + "KVDocumentStore", +] diff --git a/gpt_index/storage/docstore/keyval_docstore.py b/llama_index/storage/docstore/keyval_docstore.py similarity index 95% rename from gpt_index/storage/docstore/keyval_docstore.py rename to llama_index/storage/docstore/keyval_docstore.py index c999f93b1b2e5..6f444339fd75d 100644 --- a/gpt_index/storage/docstore/keyval_docstore.py +++ b/llama_index/storage/docstore/keyval_docstore.py @@ -2,10 +2,10 @@ from typing import Dict, Optional, Sequence -from gpt_index.storage.docstore.types import BaseDocumentStore -from gpt_index.storage.docstore.utils import doc_to_json, json_to_doc -from gpt_index.schema import BaseDocument -from gpt_index.storage.kvstore.types import ( +from llama_index.storage.docstore.types import BaseDocumentStore +from llama_index.storage.docstore.utils import doc_to_json, json_to_doc +from llama_index.schema import BaseDocument +from llama_index.storage.kvstore.types import ( BaseKVStore, ) diff --git a/gpt_index/storage/docstore/mongo_docstore.py b/llama_index/storage/docstore/mongo_docstore.py similarity index 89% rename from gpt_index/storage/docstore/mongo_docstore.py rename to llama_index/storage/docstore/mongo_docstore.py index 8771983e569e1..a94b5aeb054f5 100644 --- a/gpt_index/storage/docstore/mongo_docstore.py +++ b/llama_index/storage/docstore/mongo_docstore.py @@ -1,6 +1,6 @@ from typing import Optional -from gpt_index.storage.docstore.keyval_docstore import KVDocumentStore -from gpt_index.storage.kvstore.mongodb_kvstore import MongoDBKVStore +from llama_index.storage.docstore.keyval_docstore import KVDocumentStore +from llama_index.storage.kvstore.mongodb_kvstore import MongoDBKVStore class MongoDocumentStore(KVDocumentStore): diff --git a/gpt_index/storage/docstore/registry.py b/llama_index/storage/docstore/registry.py similarity index 72% rename from gpt_index/storage/docstore/registry.py rename to llama_index/storage/docstore/registry.py index 12b0bef104c3f..bc8eca137c0aa 100644 --- a/gpt_index/storage/docstore/registry.py +++ b/llama_index/storage/docstore/registry.py @@ -1,9 +1,9 @@ from enum import Enum from typing import Dict, Type -from gpt_index.storage.docstore.simple_docstore import SimpleDocumentStore -from gpt_index.storage.docstore.mongo_docstore import MongoDocumentStore -from gpt_index.storage.docstore.types import BaseDocumentStore +from llama_index.storage.docstore.simple_docstore import SimpleDocumentStore +from llama_index.storage.docstore.mongo_docstore import MongoDocumentStore +from llama_index.storage.docstore.types import BaseDocumentStore class DocumentStoreType(str, Enum): diff --git a/gpt_index/storage/docstore/simple_docstore.py b/llama_index/storage/docstore/simple_docstore.py similarity index 88% rename from gpt_index/storage/docstore/simple_docstore.py rename to llama_index/storage/docstore/simple_docstore.py index b83c34e609705..4b0ba5b497256 100644 --- a/gpt_index/storage/docstore/simple_docstore.py +++ b/llama_index/storage/docstore/simple_docstore.py @@ -1,9 +1,9 @@ import os from typing import Optional -from gpt_index.storage.docstore.keyval_docstore import KVDocumentStore -from gpt_index.storage.kvstore.simple_kvstore import SimpleKVStore -from gpt_index.storage.kvstore.types import BaseInMemoryKVStore -from gpt_index.storage.docstore.types import ( +from llama_index.storage.docstore.keyval_docstore import KVDocumentStore +from llama_index.storage.kvstore.simple_kvstore import SimpleKVStore +from llama_index.storage.kvstore.types import BaseInMemoryKVStore +from llama_index.storage.docstore.types import ( DEFAULT_PERSIST_PATH, DEFAULT_PERSIST_DIR, DEFAULT_PERSIST_FNAME, diff --git a/gpt_index/storage/docstore/types.py b/llama_index/storage/docstore/types.py similarity index 96% rename from gpt_index/storage/docstore/types.py rename to llama_index/storage/docstore/types.py index 690551462f1d3..a43842e49783a 100644 --- a/gpt_index/storage/docstore/types.py +++ b/llama_index/storage/docstore/types.py @@ -1,8 +1,8 @@ from abc import ABC, abstractmethod from typing import Dict, List, Optional, Sequence -from gpt_index.data_structs.node_v2 import Node +from llama_index.data_structs.node_v2 import Node -from gpt_index.schema import BaseDocument +from llama_index.schema import BaseDocument import os diff --git a/gpt_index/storage/docstore/utils.py b/llama_index/storage/docstore/utils.py similarity index 75% rename from gpt_index/storage/docstore/utils.py rename to llama_index/storage/docstore/utils.py index 6dd4f0f490f4e..ad430cb6366de 100644 --- a/gpt_index/storage/docstore/utils.py +++ b/llama_index/storage/docstore/utils.py @@ -1,7 +1,7 @@ -from gpt_index.constants import DATA_KEY, TYPE_KEY -from gpt_index.data_structs.node_v2 import ImageNode, IndexNode, Node -from gpt_index.readers.schema.base import Document -from gpt_index.schema import BaseDocument +from llama_index.constants import DATA_KEY, TYPE_KEY +from llama_index.data_structs.node_v2 import ImageNode, IndexNode, Node +from llama_index.readers.schema.base import Document +from llama_index.schema import BaseDocument def doc_to_json(doc: BaseDocument) -> dict: diff --git a/llama_index/storage/index_store/__init__.py b/llama_index/storage/index_store/__init__.py new file mode 100644 index 0000000000000..c92f3fb88ac35 --- /dev/null +++ b/llama_index/storage/index_store/__init__.py @@ -0,0 +1,5 @@ +from llama_index.storage.index_store.keyval_index_store import KVIndexStore +from llama_index.storage.index_store.simple_index_store import SimpleIndexStore +from llama_index.storage.index_store.mongo_index_store import MongoIndexStore + +__all__ = ["KVIndexStore", "SimpleIndexStore", "MongoIndexStore"] diff --git a/gpt_index/storage/index_store/keyval_index_store.py b/llama_index/storage/index_store/keyval_index_store.py similarity index 89% rename from gpt_index/storage/index_store/keyval_index_store.py rename to llama_index/storage/index_store/keyval_index_store.py index c9449665e26ff..714f8ed384b64 100644 --- a/gpt_index/storage/index_store/keyval_index_store.py +++ b/llama_index/storage/index_store/keyval_index_store.py @@ -1,11 +1,11 @@ from typing import List, Optional -from gpt_index.data_structs.data_structs_v2 import V2IndexStruct -from gpt_index.storage.index_store.types import BaseIndexStore -from gpt_index.storage.index_store.utils import ( +from llama_index.data_structs.data_structs_v2 import V2IndexStruct +from llama_index.storage.index_store.types import BaseIndexStore +from llama_index.storage.index_store.utils import ( index_struct_to_json, json_to_index_struct, ) -from gpt_index.storage.kvstore.types import BaseKVStore +from llama_index.storage.kvstore.types import BaseKVStore DEFAULT_NAMESPACE = "index_store" diff --git a/gpt_index/storage/index_store/mongo_index_store.py b/llama_index/storage/index_store/mongo_index_store.py similarity index 89% rename from gpt_index/storage/index_store/mongo_index_store.py rename to llama_index/storage/index_store/mongo_index_store.py index 6e4106d97c1af..aca10aeb9c0c0 100644 --- a/gpt_index/storage/index_store/mongo_index_store.py +++ b/llama_index/storage/index_store/mongo_index_store.py @@ -1,6 +1,6 @@ from typing import Optional -from gpt_index.storage.index_store.keyval_index_store import KVIndexStore -from gpt_index.storage.kvstore.mongodb_kvstore import MongoDBKVStore +from llama_index.storage.index_store.keyval_index_store import KVIndexStore +from llama_index.storage.kvstore.mongodb_kvstore import MongoDBKVStore class MongoIndexStore(KVIndexStore): diff --git a/gpt_index/storage/index_store/simple_index_store.py b/llama_index/storage/index_store/simple_index_store.py similarity index 82% rename from gpt_index/storage/index_store/simple_index_store.py rename to llama_index/storage/index_store/simple_index_store.py index a92314c144fbf..49e388a439dab 100644 --- a/gpt_index/storage/index_store/simple_index_store.py +++ b/llama_index/storage/index_store/simple_index_store.py @@ -1,9 +1,9 @@ import os from typing import Optional -from gpt_index.storage.index_store.keyval_index_store import KVIndexStore -from gpt_index.storage.kvstore.simple_kvstore import SimpleKVStore -from gpt_index.storage.kvstore.types import BaseInMemoryKVStore -from gpt_index.storage.index_store.types import ( +from llama_index.storage.index_store.keyval_index_store import KVIndexStore +from llama_index.storage.kvstore.simple_kvstore import SimpleKVStore +from llama_index.storage.kvstore.types import BaseInMemoryKVStore +from llama_index.storage.index_store.types import ( DEFAULT_PERSIST_DIR, DEFAULT_PERSIST_FNAME, DEFAULT_PERSIST_PATH, diff --git a/gpt_index/storage/index_store/types.py b/llama_index/storage/index_store/types.py similarity index 92% rename from gpt_index/storage/index_store/types.py rename to llama_index/storage/index_store/types.py index e1adeb624e34e..24d9f0727e2ff 100644 --- a/gpt_index/storage/index_store/types.py +++ b/llama_index/storage/index_store/types.py @@ -1,7 +1,7 @@ from abc import ABC, abstractmethod from typing import List, Optional -from gpt_index.data_structs.data_structs_v2 import V2IndexStruct +from llama_index.data_structs.data_structs_v2 import V2IndexStruct import os DEFAULT_PERSIST_DIR = "./storage" diff --git a/gpt_index/storage/index_store/utils.py b/llama_index/storage/index_store/utils.py similarity index 68% rename from gpt_index/storage/index_store/utils.py rename to llama_index/storage/index_store/utils.py index 6216e124718c7..706bcd91c5259 100644 --- a/gpt_index/storage/index_store/utils.py +++ b/llama_index/storage/index_store/utils.py @@ -1,6 +1,6 @@ -from gpt_index.constants import DATA_KEY, TYPE_KEY -from gpt_index.data_structs.data_structs_v2 import V2IndexStruct -from gpt_index.data_structs.registry import INDEX_STRUCT_TYPE_TO_INDEX_STRUCT_CLASS +from llama_index.constants import DATA_KEY, TYPE_KEY +from llama_index.data_structs.data_structs_v2 import V2IndexStruct +from llama_index.data_structs.registry import INDEX_STRUCT_TYPE_TO_INDEX_STRUCT_CLASS def index_struct_to_json(index_struct: V2IndexStruct) -> dict: diff --git a/llama_index/storage/kvstore/__init__.py b/llama_index/storage/kvstore/__init__.py new file mode 100644 index 0000000000000..9bf154c1074a7 --- /dev/null +++ b/llama_index/storage/kvstore/__init__.py @@ -0,0 +1,4 @@ +from llama_index.storage.kvstore.simple_kvstore import SimpleKVStore +from llama_index.storage.kvstore.mongodb_kvstore import MongoDBKVStore + +__all__ = ["SimpleKVStore", "MongoDBKVStore"] diff --git a/gpt_index/storage/kvstore/mongodb_kvstore.py b/llama_index/storage/kvstore/mongodb_kvstore.py similarity index 98% rename from gpt_index/storage/kvstore/mongodb_kvstore.py rename to llama_index/storage/kvstore/mongodb_kvstore.py index 865354b92f019..9caa85819e73e 100644 --- a/gpt_index/storage/kvstore/mongodb_kvstore.py +++ b/llama_index/storage/kvstore/mongodb_kvstore.py @@ -1,5 +1,5 @@ from typing import Any, Dict, Optional, cast -from gpt_index.storage.kvstore.types import DEFAULT_COLLECTION, BaseKVStore +from llama_index.storage.kvstore.types import DEFAULT_COLLECTION, BaseKVStore IMPORT_ERROR_MSG = "`pymongo` package not found, please run `pip install pymongo`" diff --git a/gpt_index/storage/kvstore/simple_kvstore.py b/llama_index/storage/kvstore/simple_kvstore.py similarity index 97% rename from gpt_index/storage/kvstore/simple_kvstore.py rename to llama_index/storage/kvstore/simple_kvstore.py index 8b820b39b0967..bf67bebb8c0ef 100644 --- a/gpt_index/storage/kvstore/simple_kvstore.py +++ b/llama_index/storage/kvstore/simple_kvstore.py @@ -3,7 +3,7 @@ from typing import Dict, Optional import logging -from gpt_index.storage.kvstore.types import ( +from llama_index.storage.kvstore.types import ( DEFAULT_COLLECTION, BaseInMemoryKVStore, ) diff --git a/gpt_index/storage/kvstore/types.py b/llama_index/storage/kvstore/types.py similarity index 100% rename from gpt_index/storage/kvstore/types.py rename to llama_index/storage/kvstore/types.py diff --git a/gpt_index/storage/storage_context.py b/llama_index/storage/storage_context.py similarity index 79% rename from gpt_index/storage/storage_context.py rename to llama_index/storage/storage_context.py index 564bf2c7b35e2..6ba5d565e6f6e 100644 --- a/gpt_index/storage/storage_context.py +++ b/llama_index/storage/storage_context.py @@ -1,18 +1,18 @@ from dataclasses import dataclass from typing import Optional from pathlib import Path -from gpt_index.storage.docstore.simple_docstore import SimpleDocumentStore -from gpt_index.storage.docstore.types import BaseDocumentStore -from gpt_index.storage.docstore.types import DEFAULT_PERSIST_FNAME as DOCSTORE_FNAME -from gpt_index.storage.index_store.types import ( +from llama_index.storage.docstore.simple_docstore import SimpleDocumentStore +from llama_index.storage.docstore.types import BaseDocumentStore +from llama_index.storage.docstore.types import DEFAULT_PERSIST_FNAME as DOCSTORE_FNAME +from llama_index.storage.index_store.types import ( DEFAULT_PERSIST_FNAME as INDEX_STORE_FNAME, ) -from gpt_index.vector_stores.simple import DEFAULT_PERSIST_FNAME as VECTOR_STORE_FNAME +from llama_index.vector_stores.simple import DEFAULT_PERSIST_FNAME as VECTOR_STORE_FNAME -from gpt_index.storage.index_store.simple_index_store import SimpleIndexStore -from gpt_index.storage.index_store.types import BaseIndexStore -from gpt_index.vector_stores.simple import SimpleVectorStore -from gpt_index.vector_stores.types import VectorStore +from llama_index.storage.index_store.simple_index_store import SimpleIndexStore +from llama_index.storage.index_store.types import BaseIndexStore +from llama_index.vector_stores.simple import SimpleVectorStore +from llama_index.vector_stores.types import VectorStore DEFAULT_PERSIST_DIR = "./storage" diff --git a/gpt_index/token_counter/__init__.py b/llama_index/token_counter/__init__.py similarity index 100% rename from gpt_index/token_counter/__init__.py rename to llama_index/token_counter/__init__.py diff --git a/gpt_index/token_counter/mock_chain_wrapper.py b/llama_index/token_counter/mock_chain_wrapper.py similarity index 93% rename from gpt_index/token_counter/mock_chain_wrapper.py rename to llama_index/token_counter/mock_chain_wrapper.py index 87ffa2673240a..0503f48d3de76 100644 --- a/gpt_index/token_counter/mock_chain_wrapper.py +++ b/llama_index/token_counter/mock_chain_wrapper.py @@ -4,15 +4,15 @@ from langchain.llms.base import BaseLLM -from gpt_index.constants import NUM_OUTPUTS -from gpt_index.langchain_helpers.chain_wrapper import LLMPredictor -from gpt_index.prompts.base import Prompt -from gpt_index.prompts.prompt_type import PromptType -from gpt_index.token_counter.utils import ( +from llama_index.constants import NUM_OUTPUTS +from llama_index.langchain_helpers.chain_wrapper import LLMPredictor +from llama_index.prompts.base import Prompt +from llama_index.prompts.prompt_type import PromptType +from llama_index.token_counter.utils import ( mock_extract_keywords_response, mock_extract_kg_triplets_response, ) -from gpt_index.utils import globals_helper +from llama_index.utils import globals_helper # TODO: consolidate with unit tests in tests/mock_utils/mock_predict.py diff --git a/gpt_index/token_counter/mock_embed_model.py b/llama_index/token_counter/mock_embed_model.py similarity index 92% rename from gpt_index/token_counter/mock_embed_model.py rename to llama_index/token_counter/mock_embed_model.py index 9ac4e9006efa3..2f13b031f5179 100644 --- a/gpt_index/token_counter/mock_embed_model.py +++ b/llama_index/token_counter/mock_embed_model.py @@ -2,7 +2,7 @@ from typing import Any, List -from gpt_index.embeddings.base import BaseEmbedding +from llama_index.embeddings.base import BaseEmbedding class MockEmbedding(BaseEmbedding): diff --git a/gpt_index/token_counter/token_counter.py b/llama_index/token_counter/token_counter.py similarity index 97% rename from gpt_index/token_counter/token_counter.py rename to llama_index/token_counter/token_counter.py index cc32da3556578..c818fbcde05b6 100644 --- a/gpt_index/token_counter/token_counter.py +++ b/llama_index/token_counter/token_counter.py @@ -5,7 +5,7 @@ from contextlib import contextmanager from typing import Any, Callable -from gpt_index.indices.service_context import ServiceContext +from llama_index.indices.service_context import ServiceContext logger = logging.getLogger(__name__) diff --git a/gpt_index/token_counter/utils.py b/llama_index/token_counter/utils.py similarity index 91% rename from gpt_index/token_counter/utils.py rename to llama_index/token_counter/utils.py index 4269a70797e60..ef76a040ff49d 100644 --- a/gpt_index/token_counter/utils.py +++ b/llama_index/token_counter/utils.py @@ -1,7 +1,7 @@ """Token predictor utils.""" from typing import Optional -from gpt_index.indices.keyword_table.utils import simple_extract_keywords +from llama_index.indices.keyword_table.utils import simple_extract_keywords def mock_extract_keywords_response( diff --git a/llama_index/tools/__init__.py b/llama_index/tools/__init__.py new file mode 100644 index 0000000000000..28b9db5c2d8ef --- /dev/null +++ b/llama_index/tools/__init__.py @@ -0,0 +1,7 @@ +"""Tools.""" + +from llama_index.tools.types import BaseTool +from llama_index.tools.query_engine import QueryEngineTool + + +__all__ = ["BaseTool", "QueryEngineTool"] diff --git a/gpt_index/tools/query_engine.py b/llama_index/tools/query_engine.py similarity index 92% rename from gpt_index/tools/query_engine.py rename to llama_index/tools/query_engine.py index ff48fa0d4bd47..bf4c7091f2e77 100644 --- a/gpt_index/tools/query_engine.py +++ b/llama_index/tools/query_engine.py @@ -1,6 +1,6 @@ from typing import Any, Optional, cast -from gpt_index.indices.query.base import BaseQueryEngine -from gpt_index.tools.types import BaseTool, ToolMetadata +from llama_index.indices.query.base import BaseQueryEngine +from llama_index.tools.types import BaseTool, ToolMetadata DEFAULT_NAME = "Query Engine Tool" diff --git a/gpt_index/tools/types.py b/llama_index/tools/types.py similarity index 100% rename from gpt_index/tools/types.py rename to llama_index/tools/types.py diff --git a/llama_index/tts/__init__.py b/llama_index/tts/__init__.py new file mode 100644 index 0000000000000..4766a894e0f98 --- /dev/null +++ b/llama_index/tts/__init__.py @@ -0,0 +1,6 @@ +"""TTS modules.""" + +from llama_index.tts.bark import BarkTTS +from llama_index.tts.elevenlabs import ElevenLabsTTS + +__all__ = ["BarkTTS", "ElevenLabsTTS"] diff --git a/gpt_index/tts/bark.py b/llama_index/tts/bark.py similarity index 98% rename from gpt_index/tts/bark.py rename to llama_index/tts/bark.py index d651bb71795db..062f83e9a6a79 100644 --- a/gpt_index/tts/bark.py +++ b/llama_index/tts/bark.py @@ -4,7 +4,7 @@ import tempfile import os import numpy as np -from gpt_index.tts.base import BaseTTS +from llama_index.tts.base import BaseTTS # text to be chunked into chunks of 10 words diff --git a/gpt_index/tts/base.py b/llama_index/tts/base.py similarity index 100% rename from gpt_index/tts/base.py rename to llama_index/tts/base.py diff --git a/gpt_index/tts/elevenlabs.py b/llama_index/tts/elevenlabs.py similarity index 96% rename from gpt_index/tts/elevenlabs.py rename to llama_index/tts/elevenlabs.py index 28e3a8cecca8c..fbe985b468ec5 100644 --- a/gpt_index/tts/elevenlabs.py +++ b/llama_index/tts/elevenlabs.py @@ -1,7 +1,7 @@ """ElevenLabs TTS.""" from typing import Optional, Any -from gpt_index.tts.base import BaseTTS +from llama_index.tts.base import BaseTTS class ElevenLabsTTS(BaseTTS): diff --git a/gpt_index/types.py b/llama_index/types.py similarity index 100% rename from gpt_index/types.py rename to llama_index/types.py diff --git a/gpt_index/utils.py b/llama_index/utils.py similarity index 100% rename from gpt_index/utils.py rename to llama_index/utils.py diff --git a/llama_index/vector_stores/__init__.py b/llama_index/vector_stores/__init__.py new file mode 100644 index 0000000000000..d24d6e4cdf604 --- /dev/null +++ b/llama_index/vector_stores/__init__.py @@ -0,0 +1,31 @@ +"""Vector stores.""" + +from llama_index.vector_stores.chatgpt_plugin import ChatGPTRetrievalPluginClient +from llama_index.vector_stores.chroma import ChromaVectorStore +from llama_index.vector_stores.deeplake import DeepLakeVectorStore +from llama_index.vector_stores.faiss import FaissVectorStore +from llama_index.vector_stores.milvus import MilvusVectorStore +from llama_index.vector_stores.myscale import MyScaleVectorStore +from llama_index.vector_stores.opensearch import ( + OpensearchVectorClient, + OpensearchVectorStore, +) +from llama_index.vector_stores.pinecone import PineconeVectorStore +from llama_index.vector_stores.qdrant import QdrantVectorStore +from llama_index.vector_stores.simple import SimpleVectorStore +from llama_index.vector_stores.weaviate import WeaviateVectorStore + +__all__ = [ + "SimpleVectorStore", + "FaissVectorStore", + "PineconeVectorStore", + "WeaviateVectorStore", + "QdrantVectorStore", + "ChromaVectorStore", + "OpensearchVectorStore", + "OpensearchVectorClient", + "ChatGPTRetrievalPluginClient", + "MilvusVectorStore", + "DeepLakeVectorStore", + "MyScaleVectorStore", +] diff --git a/gpt_index/vector_stores/chatgpt_plugin.py b/llama_index/vector_stores/chatgpt_plugin.py similarity index 97% rename from gpt_index/vector_stores/chatgpt_plugin.py rename to llama_index/vector_stores/chatgpt_plugin.py index 04db29fb50b58..e1097e2637e21 100644 --- a/gpt_index/vector_stores/chatgpt_plugin.py +++ b/llama_index/vector_stores/chatgpt_plugin.py @@ -7,8 +7,8 @@ from requests.adapters import HTTPAdapter, Retry from tqdm.auto import tqdm -from gpt_index.data_structs.node_v2 import Node, DocumentRelationship -from gpt_index.vector_stores.types import ( +from llama_index.data_structs.node_v2 import Node, DocumentRelationship +from llama_index.vector_stores.types import ( NodeEmbeddingResult, VectorStore, VectorStoreQueryResult, diff --git a/gpt_index/vector_stores/chroma.py b/llama_index/vector_stores/chroma.py similarity index 95% rename from gpt_index/vector_stores/chroma.py rename to llama_index/vector_stores/chroma.py index 6f9763db2f8a8..cf13636b91acc 100644 --- a/gpt_index/vector_stores/chroma.py +++ b/llama_index/vector_stores/chroma.py @@ -3,9 +3,9 @@ import math from typing import Any, List, cast -from gpt_index.data_structs.node_v2 import DocumentRelationship, Node -from gpt_index.utils import truncate_text -from gpt_index.vector_stores.types import ( +from llama_index.data_structs.node_v2 import DocumentRelationship, Node +from llama_index.utils import truncate_text +from llama_index.vector_stores.types import ( NodeEmbeddingResult, VectorStore, VectorStoreQuery, diff --git a/gpt_index/vector_stores/deeplake.py b/llama_index/vector_stores/deeplake.py similarity index 98% rename from gpt_index/vector_stores/deeplake.py rename to llama_index/vector_stores/deeplake.py index bd018470d1432..b8f82edf20910 100644 --- a/gpt_index/vector_stores/deeplake.py +++ b/llama_index/vector_stores/deeplake.py @@ -7,8 +7,8 @@ from typing import Any, Dict, List, Optional, cast import numpy as np -from gpt_index.indices.query.embedding_utils import get_top_k_embeddings -from gpt_index.vector_stores.types import ( +from llama_index.indices.query.embedding_utils import get_top_k_embeddings +from llama_index.vector_stores.types import ( NodeEmbeddingResult, VectorStore, VectorStoreQuery, diff --git a/gpt_index/vector_stores/faiss.py b/llama_index/vector_stores/faiss.py similarity index 98% rename from gpt_index/vector_stores/faiss.py rename to llama_index/vector_stores/faiss.py index c2bfe19f69a43..465adbe3ac4e4 100644 --- a/gpt_index/vector_stores/faiss.py +++ b/llama_index/vector_stores/faiss.py @@ -9,7 +9,7 @@ import numpy as np -from gpt_index.vector_stores.types import ( +from llama_index.vector_stores.types import ( DEFAULT_PERSIST_DIR, DEFAULT_PERSIST_FNAME, NodeEmbeddingResult, diff --git a/gpt_index/vector_stores/milvus.py b/llama_index/vector_stores/milvus.py similarity index 99% rename from gpt_index/vector_stores/milvus.py rename to llama_index/vector_stores/milvus.py index 85f6c40bf8e25..bdda2a07b3cce 100644 --- a/gpt_index/vector_stores/milvus.py +++ b/llama_index/vector_stores/milvus.py @@ -7,8 +7,8 @@ from typing import Any, List, Optional from uuid import uuid4 -from gpt_index.data_structs.node_v2 import DocumentRelationship, Node -from gpt_index.vector_stores.types import ( +from llama_index.data_structs.node_v2 import DocumentRelationship, Node +from llama_index.vector_stores.types import ( NodeEmbeddingResult, VectorStore, VectorStoreQuery, diff --git a/gpt_index/vector_stores/myscale.py b/llama_index/vector_stores/myscale.py similarity index 96% rename from gpt_index/vector_stores/myscale.py rename to llama_index/vector_stores/myscale.py index c381ac0820d4c..d2edb636f888e 100644 --- a/gpt_index/vector_stores/myscale.py +++ b/llama_index/vector_stores/myscale.py @@ -7,11 +7,15 @@ import logging from typing import Any, Dict, List, Optional, cast -from gpt_index.data_structs.node_v2 import DocumentRelationship, Node -from gpt_index.indices.service_context import ServiceContext -from gpt_index.readers.myscale import MyScaleSettings, escape_str, format_list_to_string -from gpt_index.utils import iter_batch -from gpt_index.vector_stores.types import ( +from llama_index.data_structs.node_v2 import DocumentRelationship, Node +from llama_index.indices.service_context import ServiceContext +from llama_index.readers.myscale import ( + MyScaleSettings, + escape_str, + format_list_to_string, +) +from llama_index.utils import iter_batch +from llama_index.vector_stores.types import ( NodeEmbeddingResult, VectorStore, VectorStoreQuery, diff --git a/gpt_index/vector_stores/opensearch.py b/llama_index/vector_stores/opensearch.py similarity index 98% rename from gpt_index/vector_stores/opensearch.py rename to llama_index/vector_stores/opensearch.py index 1bbc2b874b170..11b6d2367a970 100644 --- a/gpt_index/vector_stores/opensearch.py +++ b/llama_index/vector_stores/opensearch.py @@ -2,8 +2,8 @@ import json from typing import Any, Dict, List, Optional, cast -from gpt_index.data_structs import Node -from gpt_index.vector_stores.types import ( +from llama_index.data_structs import Node +from llama_index.vector_stores.types import ( NodeEmbeddingResult, VectorStore, VectorStoreQueryResult, diff --git a/gpt_index/vector_stores/pinecone.py b/llama_index/vector_stores/pinecone.py similarity index 98% rename from gpt_index/vector_stores/pinecone.py rename to llama_index/vector_stores/pinecone.py index 152ae9d162aba..b75763ac1741c 100644 --- a/gpt_index/vector_stores/pinecone.py +++ b/llama_index/vector_stores/pinecone.py @@ -10,8 +10,8 @@ from functools import partial from typing import Any, Callable, Dict, List, Optional, cast -from gpt_index.data_structs.node_v2 import DocumentRelationship, Node -from gpt_index.vector_stores.types import ( +from llama_index.data_structs.node_v2 import DocumentRelationship, Node +from llama_index.vector_stores.types import ( NodeEmbeddingResult, VectorStore, VectorStoreQuery, diff --git a/gpt_index/vector_stores/qdrant.py b/llama_index/vector_stores/qdrant.py similarity index 97% rename from gpt_index/vector_stores/qdrant.py rename to llama_index/vector_stores/qdrant.py index 7fc65216e9d8f..2a08305b046e7 100644 --- a/gpt_index/vector_stores/qdrant.py +++ b/llama_index/vector_stores/qdrant.py @@ -6,9 +6,9 @@ import logging from typing import Any, List, Optional, cast -from gpt_index.data_structs.node_v2 import DocumentRelationship, Node -from gpt_index.utils import iter_batch -from gpt_index.vector_stores.types import ( +from llama_index.data_structs.node_v2 import DocumentRelationship, Node +from llama_index.utils import iter_batch +from llama_index.vector_stores.types import ( NodeEmbeddingResult, VectorStore, VectorStoreQueryResult, diff --git a/gpt_index/vector_stores/registry.py b/llama_index/vector_stores/registry.py similarity index 60% rename from gpt_index/vector_stores/registry.py rename to llama_index/vector_stores/registry.py index 878819b66e4ef..54f7e2e23ce25 100644 --- a/gpt_index/vector_stores/registry.py +++ b/llama_index/vector_stores/registry.py @@ -1,18 +1,18 @@ from enum import Enum from typing import Dict, Type -from gpt_index.vector_stores.chatgpt_plugin import ChatGPTRetrievalPluginClient -from gpt_index.vector_stores.chroma import ChromaVectorStore -from gpt_index.vector_stores.deeplake import DeepLakeVectorStore -from gpt_index.vector_stores.faiss import FaissVectorStore -from gpt_index.vector_stores.milvus import MilvusVectorStore -from gpt_index.vector_stores.myscale import MyScaleVectorStore -from gpt_index.vector_stores.opensearch import OpensearchVectorStore -from gpt_index.vector_stores.pinecone import PineconeVectorStore -from gpt_index.vector_stores.qdrant import QdrantVectorStore -from gpt_index.vector_stores.simple import SimpleVectorStore -from gpt_index.vector_stores.types import VectorStore -from gpt_index.vector_stores.weaviate import WeaviateVectorStore +from llama_index.vector_stores.chatgpt_plugin import ChatGPTRetrievalPluginClient +from llama_index.vector_stores.chroma import ChromaVectorStore +from llama_index.vector_stores.deeplake import DeepLakeVectorStore +from llama_index.vector_stores.faiss import FaissVectorStore +from llama_index.vector_stores.milvus import MilvusVectorStore +from llama_index.vector_stores.myscale import MyScaleVectorStore +from llama_index.vector_stores.opensearch import OpensearchVectorStore +from llama_index.vector_stores.pinecone import PineconeVectorStore +from llama_index.vector_stores.qdrant import QdrantVectorStore +from llama_index.vector_stores.simple import SimpleVectorStore +from llama_index.vector_stores.types import VectorStore +from llama_index.vector_stores.weaviate import WeaviateVectorStore class VectorStoreType(str, Enum): diff --git a/gpt_index/vector_stores/simple.py b/llama_index/vector_stores/simple.py similarity index 97% rename from gpt_index/vector_stores/simple.py rename to llama_index/vector_stores/simple.py index a9a60561f4ffc..7748e333e21ad 100644 --- a/gpt_index/vector_stores/simple.py +++ b/llama_index/vector_stores/simple.py @@ -7,11 +7,11 @@ from dataclasses_json import DataClassJsonMixin -from gpt_index.indices.query.embedding_utils import ( +from llama_index.indices.query.embedding_utils import ( get_top_k_embeddings, get_top_k_embeddings_learner, ) -from gpt_index.vector_stores.types import ( +from llama_index.vector_stores.types import ( DEFAULT_PERSIST_DIR, DEFAULT_PERSIST_FNAME, NodeEmbeddingResult, diff --git a/gpt_index/vector_stores/types.py b/llama_index/vector_stores/types.py similarity index 97% rename from gpt_index/vector_stores/types.py rename to llama_index/vector_stores/types.py index 8204f40654141..87bb6e874dc51 100644 --- a/gpt_index/vector_stores/types.py +++ b/llama_index/vector_stores/types.py @@ -5,7 +5,7 @@ from typing import Any, List, Optional, Protocol, runtime_checkable from enum import Enum -from gpt_index.data_structs.node_v2 import Node +from llama_index.data_structs.node_v2 import Node DEFAULT_PERSIST_DIR = "./storage" diff --git a/gpt_index/vector_stores/weaviate.py b/llama_index/vector_stores/weaviate.py similarity index 95% rename from gpt_index/vector_stores/weaviate.py rename to llama_index/vector_stores/weaviate.py index ba01ad00f5f41..5db29827c90d5 100644 --- a/gpt_index/vector_stores/weaviate.py +++ b/llama_index/vector_stores/weaviate.py @@ -6,14 +6,14 @@ from typing import Any, List, Optional, cast -from gpt_index.readers.weaviate.client import ( +from llama_index.readers.weaviate.client import ( add_nodes, create_schema, delete_document, weaviate_query, ) -from gpt_index.readers.weaviate.utils import get_default_class_prefix -from gpt_index.vector_stores.types import ( +from llama_index.readers.weaviate.utils import get_default_class_prefix +from llama_index.vector_stores.types import ( NodeEmbeddingResult, VectorStore, VectorStoreQueryResult, diff --git a/scripts/create_llama_package.sh b/scripts/create_llama_package.sh deleted file mode 100644 index 17e0d6249e16d..0000000000000 --- a/scripts/create_llama_package.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# create llama_index package - -if [[ -n "$LLAMA_INDEX_DIR" ]]; then - echo "LLAMA_INDEX_DIR is set to $LLAMA_INDEX_DIR" -else - echo "LLAMA_INDEX_DIR is not set" - exit 1 -fi - -if [[ -n "$GPT_INDEX_DIR" ]]; then - echo "GPT_INDEX_DIR is set to $GPT_INDEX_DIR" -else - echo "GPT_INDEX_DIR is not set" - exit 1 -fi - -rm -rf $LLAMA_INDEX_DIR -mkdir -p $LLAMA_INDEX_DIR -# copy files from gpt_index dir -cp -r $GPT_INDEX_DIR/gpt_index $LLAMA_INDEX_DIR/llama_index -cp $GPT_INDEX_DIR/setup_llama.py $LLAMA_INDEX_DIR/setup.py -cp $GPT_INDEX_DIR/README.md $LLAMA_INDEX_DIR/README.md -cp $GPT_INDEX_DIR/LICENSE $LLAMA_INDEX_DIR/LICENSE -cp $GPT_INDEX_DIR/MANIFEST_llama.in $LLAMA_INDEX_DIR/MANIFEST.in -cd $LLAMA_INDEX_DIR -# replace all usages of gpt_index with llama_index -find llama_index/. -type f -name '*.py' -print0 | xargs -0 sed -i '' "s/gpt_index/llama_index/g" -# build package -python setup.py sdist \ No newline at end of file diff --git a/scripts/publish_gpt_index_package.sh b/scripts/publish_gpt_index_package.sh new file mode 100644 index 0000000000000..fc5220090181a --- /dev/null +++ b/scripts/publish_gpt_index_package.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# build package +PACKAGE_NAME_OVERRIDE=gpt_index python setup.py sdist bdist_wheel + +# publish gpt_index package +twine upload dist/* + +# NOTE: use this to test +# twine upload -r testpypi dist/* + +# cleanup +rm -rf build dist *.egg-info + diff --git a/scripts/publish_llama_package.sh b/scripts/publish_llama_package.sh deleted file mode 100644 index 756dcb8aa4f11..0000000000000 --- a/scripts/publish_llama_package.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# publish llama_index package -if [[ -n "$LLAMA_INDEX_DIR" ]]; then - echo "LLAMA_INDEX_DIR is set to $LLAMA_INDEX_DIR" -else - echo "LLAMA_INDEX_DIR is not set" - exit 1 -fi - -if [[ -n "$GPT_INDEX_DIR" ]]; then - echo "GPT_INDEX_DIR is set to $GPT_INDEX_DIR" -else - echo "GPT_INDEX_DIR is not set" - exit 1 -fi - -if [[ -n "$PYPI_USERNAME" ]]; then - echo "PYPI_USERNAME is set to $PYPI_USERNAME" -else - echo "PYPI_USERNAME is not set" - exit 1 -fi - -if [[ -n "$PYPI_PASSWORD" ]]; then - echo "PYPI_PASSWORD is set to $PYPI_PASSWORD" -else - echo "PYPI_PASSWORD is not set" - exit 1 -fi - -LLAMA_INDEX_DIR=$LLAMA_INDEX_DIR GPT_INDEX_DIR=$GPT_INDEX_DIR sh $GPT_INDEX_DIR/scripts/create_llama_package.sh - -# publish llama_index package -twine upload $LLAMA_INDEX_DIR/dist/* -u $PYPI_USERNAME -p $PYPI_PASSWORD - diff --git a/setup.py b/setup.py index 326628b0ba266..eb13bf9ecff65 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,13 @@ """Set up the package.""" import sys from pathlib import Path - +import os from setuptools import find_packages, setup -with open(Path(__file__).absolute().parents[0] / "gpt_index" / "VERSION") as _f: +DEFAULT_PACKAGE_NAME = "llama_index" +PACKAGE_NAME = os.environ.get("PACKAGE_NAME_OVERRIDE", DEFAULT_PACKAGE_NAME) + +with open(Path(__file__).absolute().parents[0] / "llama_index" / "VERSION") as _f: __version__ = _f.read().strip() with open("README.md", "r", encoding="utf-8") as f: @@ -27,14 +30,14 @@ install_requires.extend(["transformers"]) setup( - name="gpt_index", + name=PACKAGE_NAME, version=__version__, packages=find_packages(), description="Interface between LLMs and your data", install_requires=install_requires, long_description=long_description, license="MIT", - url="https://github.com/jerryjliu/gpt_index", + url="https://github.com/jerryjliu/llama_index", include_package_data=True, long_description_content_type="text/markdown", ) diff --git a/setup_llama.py b/setup_llama.py deleted file mode 100644 index 75406929eb97d..0000000000000 --- a/setup_llama.py +++ /dev/null @@ -1,42 +0,0 @@ -"""Set up the package.""" -import sys -from pathlib import Path - -from setuptools import find_packages, setup - -with open(Path(__file__).absolute().parents[0] / "llama_index" / "VERSION") as _f: - __version__ = _f.read().strip() - -with open("README.md", "r", encoding="utf-8") as f: - long_description = f.read() - -install_requires = [ - "dataclasses_json", - "langchain>=0.0.152", - "numpy", - "tenacity>=8.2.0,<9.0.0", - "openai>=0.26.4", - "pandas", -] - -# NOTE: if python version >= 3.9, install tiktoken -# else install transformers -if sys.version_info >= (3, 9): - install_requires.extend(["tiktoken"]) -else: - install_requires.extend(["transformers"]) - -# upload duplicate package to pypi -setup( - name="llama_index", - version=__version__, - # packages=find_packages(), - packages=find_packages(include=["llama*"]), - description="Interface between LLMs and your data.", - install_requires=install_requires, - long_description=long_description, - license="MIT", - url="https://github.com/jerryjliu/gpt_index", - include_package_data=True, - long_description_content_type="text/markdown", -) diff --git a/tests/callbacks/test_llama_debug.py b/tests/callbacks/test_llama_debug.py index da995fd42b56c..4d24707243426 100644 --- a/tests/callbacks/test_llama_debug.py +++ b/tests/callbacks/test_llama_debug.py @@ -1,8 +1,8 @@ """Embeddings.""" -from gpt_index.callbacks.schema import CBEventType -from gpt_index.callbacks.base import CallbackManager -from gpt_index.callbacks.llama_debug import LlamaDebugHandler +from llama_index.callbacks.schema import CBEventType +from llama_index.callbacks.base import CallbackManager +from llama_index.callbacks.llama_debug import LlamaDebugHandler TEST_PAYLOAD = {"one": 1, "two": 2} diff --git a/tests/conftest.py b/tests/conftest.py index d261466dad137..56f550a1a88b7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,9 +3,9 @@ from typing import Any import pytest -from gpt_index.indices.service_context import ServiceContext -from gpt_index.langchain_helpers.text_splitter import TokenTextSplitter -from gpt_index.llm_predictor.base import LLMPredictor +from llama_index.indices.service_context import ServiceContext +from llama_index.langchain_helpers.text_splitter import TokenTextSplitter +from llama_index.llm_predictor.base import LLMPredictor from tests.indices.vector_store.mock_services import MockEmbedding diff --git a/tests/embeddings/test_base.py b/tests/embeddings/test_base.py index 51b6a89aaabd6..76f233b08277d 100644 --- a/tests/embeddings/test_base.py +++ b/tests/embeddings/test_base.py @@ -1,9 +1,9 @@ """Embeddings.""" from typing import Any, List from unittest.mock import patch -from gpt_index.embeddings.base import mean_agg +from llama_index.embeddings.base import mean_agg -from gpt_index.embeddings.openai import OpenAIEmbedding +from llama_index.embeddings.openai import OpenAIEmbedding def mock_get_text_embedding(text: str) -> List[float]: diff --git a/tests/indices/composability/test_utils.py b/tests/indices/composability/test_utils.py index f4c0f1eebb337..ac1d523161bf6 100644 --- a/tests/indices/composability/test_utils.py +++ b/tests/indices/composability/test_utils.py @@ -1,6 +1,6 @@ from typing import Any, Dict, List, Optional -from gpt_index.vector_stores.types import ( +from llama_index.vector_stores.types import ( NodeEmbeddingResult, VectorStore, VectorStoreQueryResult, diff --git a/tests/indices/conftest.py b/tests/indices/conftest.py index 6141ee6d1bf35..3ff9225025f9b 100644 --- a/tests/indices/conftest.py +++ b/tests/indices/conftest.py @@ -1,8 +1,8 @@ from typing import List import pytest -from gpt_index.data_structs.node_v2 import DocumentRelationship, Node +from llama_index.data_structs.node_v2 import DocumentRelationship, Node -from gpt_index.readers.schema.base import Document +from llama_index.readers.schema.base import Document @pytest.fixture diff --git a/tests/indices/empty/test_base.py b/tests/indices/empty/test_base.py index 1506ad0513df9..d2170df7bbe9e 100644 --- a/tests/indices/empty/test_base.py +++ b/tests/indices/empty/test_base.py @@ -1,8 +1,8 @@ """Test empty index.""" -from gpt_index.data_structs.data_structs_v2 import EmptyIndex -from gpt_index.indices.empty.base import GPTEmptyIndex -from gpt_index.indices.service_context import ServiceContext +from llama_index.data_structs.data_structs_v2 import EmptyIndex +from llama_index.indices.empty.base import GPTEmptyIndex +from llama_index.indices.service_context import ServiceContext def test_empty( diff --git a/tests/indices/keyword_table/test_base.py b/tests/indices/keyword_table/test_base.py index 09903178c5f65..acb369dbb9e79 100644 --- a/tests/indices/keyword_table/test_base.py +++ b/tests/indices/keyword_table/test_base.py @@ -5,9 +5,9 @@ import pytest -from gpt_index.indices.keyword_table.simple_base import GPTSimpleKeywordTableIndex -from gpt_index.indices.service_context import ServiceContext -from gpt_index.readers.schema.base import Document +from llama_index.indices.keyword_table.simple_base import GPTSimpleKeywordTableIndex +from llama_index.indices.service_context import ServiceContext +from llama_index.readers.schema.base import Document from tests.mock_utils.mock_utils import mock_extract_keywords @@ -25,7 +25,7 @@ def documents() -> List[Document]: @patch( - "gpt_index.indices.keyword_table.simple_base.simple_extract_keywords", + "llama_index.indices.keyword_table.simple_base.simple_extract_keywords", mock_extract_keywords, ) def test_build_table( @@ -62,7 +62,7 @@ def test_build_table( @patch( - "gpt_index.indices.keyword_table.simple_base.simple_extract_keywords", + "llama_index.indices.keyword_table.simple_base.simple_extract_keywords", mock_extract_keywords, ) def test_build_table_async( @@ -101,7 +101,7 @@ def test_build_table_async( @patch( - "gpt_index.indices.keyword_table.simple_base.simple_extract_keywords", + "llama_index.indices.keyword_table.simple_base.simple_extract_keywords", mock_extract_keywords, ) def test_insert( @@ -152,7 +152,7 @@ def test_insert( @patch( - "gpt_index.indices.keyword_table.simple_base.simple_extract_keywords", + "llama_index.indices.keyword_table.simple_base.simple_extract_keywords", mock_extract_keywords, ) def test_delete( diff --git a/tests/indices/keyword_table/test_retrievers.py b/tests/indices/keyword_table/test_retrievers.py index 7e0142b955cfc..dd3e29d84a4a9 100644 --- a/tests/indices/keyword_table/test_retrievers.py +++ b/tests/indices/keyword_table/test_retrievers.py @@ -1,18 +1,18 @@ from typing import List from unittest.mock import patch -from gpt_index.indices.keyword_table.simple_base import GPTSimpleKeywordTableIndex -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.service_context import ServiceContext -from gpt_index.readers.schema.base import Document +from llama_index.indices.keyword_table.simple_base import GPTSimpleKeywordTableIndex +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.service_context import ServiceContext +from llama_index.readers.schema.base import Document from tests.mock_utils.mock_utils import mock_extract_keywords @patch( - "gpt_index.indices.keyword_table.simple_base.simple_extract_keywords", + "llama_index.indices.keyword_table.simple_base.simple_extract_keywords", mock_extract_keywords, ) @patch( - "gpt_index.indices.keyword_table.retrievers.simple_extract_keywords", + "llama_index.indices.keyword_table.retrievers.simple_extract_keywords", mock_extract_keywords, ) def test_retrieve( diff --git a/tests/indices/keyword_table/test_utils.py b/tests/indices/keyword_table/test_utils.py index a565c5ede9769..7de9baa8682ae 100644 --- a/tests/indices/keyword_table/test_utils.py +++ b/tests/indices/keyword_table/test_utils.py @@ -1,6 +1,6 @@ """Test utils.""" -from gpt_index.indices.keyword_table.utils import extract_keywords_given_response +from llama_index.indices.keyword_table.utils import extract_keywords_given_response def test_expand_tokens_with_subtokens() -> None: diff --git a/tests/indices/knowledge_graph/conftest.py b/tests/indices/knowledge_graph/conftest.py index 8dda4d1c2cdcd..5e0a07895501d 100644 --- a/tests/indices/knowledge_graph/conftest.py +++ b/tests/indices/knowledge_graph/conftest.py @@ -1,7 +1,7 @@ from typing import List import pytest -from gpt_index.readers.schema.base import Document +from llama_index.readers.schema.base import Document @pytest.fixture diff --git a/tests/indices/knowledge_graph/test_base.py b/tests/indices/knowledge_graph/test_base.py index e96af230a7f55..eff7a2d018c29 100644 --- a/tests/indices/knowledge_graph/test_base.py +++ b/tests/indices/knowledge_graph/test_base.py @@ -4,11 +4,11 @@ from unittest.mock import patch import pytest -from gpt_index.data_structs.node_v2 import Node -from gpt_index.embeddings.base import BaseEmbedding -from gpt_index.indices.knowledge_graph.base import GPTKnowledgeGraphIndex -from gpt_index.indices.service_context import ServiceContext -from gpt_index.readers.schema.base import Document +from llama_index.data_structs.node_v2 import Node +from llama_index.embeddings.base import BaseEmbedding +from llama_index.indices.knowledge_graph.base import GPTKnowledgeGraphIndex +from llama_index.indices.service_context import ServiceContext +from llama_index.readers.schema.base import Document from tests.mock_utils.mock_prompts import ( MOCK_KG_TRIPLET_EXTRACT_PROMPT, MOCK_QUERY_KEYWORD_EXTRACT_PROMPT, diff --git a/tests/indices/knowledge_graph/test_retrievers.py b/tests/indices/knowledge_graph/test_retrievers.py index 5d32d0b59126f..438a6e7867980 100644 --- a/tests/indices/knowledge_graph/test_retrievers.py +++ b/tests/indices/knowledge_graph/test_retrievers.py @@ -1,10 +1,10 @@ from typing import Any, List from unittest.mock import patch -from gpt_index.indices.knowledge_graph.base import GPTKnowledgeGraphIndex -from gpt_index.indices.knowledge_graph.retrievers import KGTableRetriever -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.service_context import ServiceContext -from gpt_index.readers.schema.base import Document +from llama_index.indices.knowledge_graph.base import GPTKnowledgeGraphIndex +from llama_index.indices.knowledge_graph.retrievers import KGTableRetriever +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.service_context import ServiceContext +from llama_index.readers.schema.base import Document from tests.indices.knowledge_graph.test_base import ( MockEmbedding, mock_extract_triplets, diff --git a/tests/indices/list/test_index.py b/tests/indices/list/test_index.py index b7275337b783d..4c75711fd0a49 100644 --- a/tests/indices/list/test_index.py +++ b/tests/indices/list/test_index.py @@ -2,11 +2,11 @@ from typing import Dict, List, Tuple -from gpt_index.data_structs.node_v2 import Node -from gpt_index.indices.base_retriever import BaseRetriever -from gpt_index.indices.list.base import GPTListIndex, ListRetrieverMode -from gpt_index.indices.service_context import ServiceContext -from gpt_index.readers.schema.base import Document +from llama_index.data_structs.node_v2 import Node +from llama_index.indices.base_retriever import BaseRetriever +from llama_index.indices.list.base import GPTListIndex, ListRetrieverMode +from llama_index.indices.service_context import ServiceContext +from llama_index.readers.schema.base import Document def test_build_list( diff --git a/tests/indices/list/test_retrievers.py b/tests/indices/list/test_retrievers.py index d573fade6a02e..0502f12af173a 100644 --- a/tests/indices/list/test_retrievers.py +++ b/tests/indices/list/test_retrievers.py @@ -1,9 +1,9 @@ from typing import Any, List from unittest.mock import patch -from gpt_index.indices.list.base import GPTListIndex -from gpt_index.indices.list.retrievers import ListIndexEmbeddingRetriever -from gpt_index.indices.service_context import ServiceContext -from gpt_index.readers.schema.base import Document +from llama_index.indices.list.base import GPTListIndex +from llama_index.indices.list.retrievers import ListIndexEmbeddingRetriever +from llama_index.indices.service_context import ServiceContext +from llama_index.readers.schema.base import Document from tests.indices.list.test_index import _get_embeddings diff --git a/tests/indices/postprocessor/test_base.py b/tests/indices/postprocessor/test_base.py index 4c1667da78420..fe2c88f9f9ba3 100644 --- a/tests/indices/postprocessor/test_base.py +++ b/tests/indices/postprocessor/test_base.py @@ -2,24 +2,24 @@ from pathlib import Path import pytest -from gpt_index.storage.docstore.simple_docstore import SimpleDocumentStore +from llama_index.storage.docstore.simple_docstore import SimpleDocumentStore -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.prompts.prompts import Prompt, SimpleInputPrompt -from gpt_index.indices.service_context import ServiceContext -from gpt_index.data_structs.node_v2 import Node, DocumentRelationship, NodeWithScore -from gpt_index.indices.postprocessor.node import ( +from llama_index.indices.query.schema import QueryBundle +from llama_index.prompts.prompts import Prompt, SimpleInputPrompt +from llama_index.indices.service_context import ServiceContext +from llama_index.data_structs.node_v2 import Node, DocumentRelationship, NodeWithScore +from llama_index.indices.postprocessor.node import ( PrevNextNodePostprocessor, KeywordNodePostprocessor, ) -from gpt_index.indices.postprocessor.node_recency import ( +from llama_index.indices.postprocessor.node_recency import ( FixedRecencyPostprocessor, EmbeddingRecencyPostprocessor, TimeWeightedPostprocessor, ) -from gpt_index.llm_predictor import LLMPredictor +from llama_index.llm_predictor import LLMPredictor from unittest.mock import patch -from gpt_index.embeddings.openai import OpenAIEmbedding +from llama_index.embeddings.openai import OpenAIEmbedding from typing import List, Any, Tuple, cast, Dict diff --git a/tests/indices/query/conftest.py b/tests/indices/query/conftest.py index 9a5d0e258ce27..8debd72bb5141 100644 --- a/tests/indices/query/conftest.py +++ b/tests/indices/query/conftest.py @@ -1,8 +1,8 @@ from typing import Dict, List import pytest -from gpt_index.data_structs.struct_type import IndexStructType -from gpt_index.readers.schema.base import Document +from llama_index.data_structs.struct_type import IndexStructType +from llama_index.readers.schema.base import Document from tests.mock_utils.mock_prompts import ( MOCK_INSERT_PROMPT, diff --git a/tests/indices/query/query_transform/mock_utils.py b/tests/indices/query/query_transform/mock_utils.py index c232bf6d19299..fe499224e0e2b 100644 --- a/tests/indices/query/query_transform/mock_utils.py +++ b/tests/indices/query/query_transform/mock_utils.py @@ -1,6 +1,6 @@ """Mock utils for query transform.""" -from gpt_index.indices.query.query_transform.prompts import ( +from llama_index.indices.query.query_transform.prompts import ( DecomposeQueryTransformPrompt, ) diff --git a/tests/indices/query/query_transform/test_base.py b/tests/indices/query/query_transform/test_base.py index 55d97e3efa2f3..6e8fcaa4a6372 100644 --- a/tests/indices/query/query_transform/test_base.py +++ b/tests/indices/query/query_transform/test_base.py @@ -1,8 +1,8 @@ """Test query transform.""" -from gpt_index.indices.query.query_transform.base import DecomposeQueryTransform -from gpt_index.indices.service_context import ServiceContext +from llama_index.indices.query.query_transform.base import DecomposeQueryTransform +from llama_index.indices.service_context import ServiceContext from tests.indices.query.query_transform.mock_utils import MOCK_DECOMPOSE_PROMPT diff --git a/tests/indices/query/test_compose.py b/tests/indices/query/test_compose.py index e4ebfc435214a..5d3b9d512c7eb 100644 --- a/tests/indices/query/test_compose.py +++ b/tests/indices/query/test_compose.py @@ -2,12 +2,12 @@ from typing import Dict, List -from gpt_index.indices.composability.graph import ComposableGraph -from gpt_index.indices.keyword_table.simple_base import GPTSimpleKeywordTableIndex -from gpt_index.indices.list.base import GPTListIndex -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.tree.base import GPTTreeIndex -from gpt_index.readers.schema.base import Document +from llama_index.indices.composability.graph import ComposableGraph +from llama_index.indices.keyword_table.simple_base import GPTSimpleKeywordTableIndex +from llama_index.indices.list.base import GPTListIndex +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.tree.base import GPTTreeIndex +from llama_index.readers.schema.base import Document def test_recursive_query_list_tree( diff --git a/tests/indices/query/test_compose_vector.py b/tests/indices/query/test_compose_vector.py index 65fe68f9eba5c..8966e2614e648 100644 --- a/tests/indices/query/test_compose_vector.py +++ b/tests/indices/query/test_compose_vector.py @@ -7,15 +7,15 @@ import pytest -from gpt_index.data_structs.data_structs_v2 import V2IndexStruct -from gpt_index.embeddings.base import BaseEmbedding -from gpt_index.indices.composability.graph import ComposableGraph -from gpt_index.indices.keyword_table.simple_base import GPTSimpleKeywordTableIndex -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.vector_store.base import GPTVectorStoreIndex -from gpt_index.readers.schema.base import Document -from gpt_index.storage.storage_context import StorageContext -from gpt_index.vector_stores.pinecone import PineconeVectorStore +from llama_index.data_structs.data_structs_v2 import V2IndexStruct +from llama_index.embeddings.base import BaseEmbedding +from llama_index.indices.composability.graph import ComposableGraph +from llama_index.indices.keyword_table.simple_base import GPTSimpleKeywordTableIndex +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.vector_store.base import GPTVectorStoreIndex +from llama_index.readers.schema.base import Document +from llama_index.storage.storage_context import StorageContext +from llama_index.vector_stores.pinecone import PineconeVectorStore from tests.indices.vector_store.utils import MockPineconeIndex from tests.mock_utils.mock_prompts import ( MOCK_QUERY_KEYWORD_EXTRACT_PROMPT, diff --git a/tests/indices/query/test_query_bundle.py b/tests/indices/query/test_query_bundle.py index 3205c4fbc6e54..f56c15e38f706 100644 --- a/tests/indices/query/test_query_bundle.py +++ b/tests/indices/query/test_query_bundle.py @@ -3,12 +3,12 @@ from typing import Dict, List import pytest -from gpt_index.embeddings.base import BaseEmbedding +from llama_index.embeddings.base import BaseEmbedding -from gpt_index.indices.list.base import GPTListIndex -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.service_context import ServiceContext -from gpt_index.readers.schema.base import Document +from llama_index.indices.list.base import GPTListIndex +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.service_context import ServiceContext +from llama_index.readers.schema.base import Document @pytest.fixture diff --git a/tests/indices/response/test_response_builder.py b/tests/indices/response/test_response_builder.py index b9cfa31efd938..cef8cb56057bd 100644 --- a/tests/indices/response/test_response_builder.py +++ b/tests/indices/response/test_response_builder.py @@ -2,15 +2,15 @@ from typing import List -from gpt_index.constants import MAX_CHUNK_OVERLAP, MAX_CHUNK_SIZE, NUM_OUTPUTS -from gpt_index.indices.prompt_helper import PromptHelper -from gpt_index.indices.response.response_builder import ( +from llama_index.constants import MAX_CHUNK_OVERLAP, MAX_CHUNK_SIZE, NUM_OUTPUTS +from llama_index.indices.prompt_helper import PromptHelper +from llama_index.indices.response.response_builder import ( ResponseMode, get_response_builder, ) -from gpt_index.indices.service_context import ServiceContext -from gpt_index.prompts.prompts import QuestionAnswerPrompt, RefinePrompt -from gpt_index.readers.schema.base import Document +from llama_index.indices.service_context import ServiceContext +from llama_index.prompts.prompts import QuestionAnswerPrompt, RefinePrompt +from llama_index.readers.schema.base import Document from tests.mock_utils.mock_prompts import MOCK_REFINE_PROMPT, MOCK_TEXT_QA_PROMPT diff --git a/tests/indices/struct_store/test_base.py b/tests/indices/struct_store/test_base.py index 5b4d38885b5ee..48be9ac3d38f2 100644 --- a/tests/indices/struct_store/test_base.py +++ b/tests/indices/struct_store/test_base.py @@ -14,21 +14,21 @@ select, ) -from gpt_index.indices.list.base import GPTListIndex -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.struct_store.sql import ( +from llama_index.indices.list.base import GPTListIndex +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.struct_store.sql import ( GPTSQLStructStoreIndex, SQLContextContainerBuilder, ) -from gpt_index.indices.struct_store.sql_query import GPTNLStructStoreQueryEngine -from gpt_index.langchain_helpers.sql_wrapper import SQLDatabase -from gpt_index.readers.schema.base import Document -from gpt_index.schema import BaseDocument +from llama_index.indices.struct_store.sql_query import GPTNLStructStoreQueryEngine +from llama_index.langchain_helpers.sql_wrapper import SQLDatabase +from llama_index.readers.schema.base import Document +from llama_index.schema import BaseDocument from tests.mock_utils.mock_prompts import ( MOCK_TABLE_CONTEXT_PROMPT, ) -from gpt_index.data_structs.node_v2 import Node, DocumentRelationship +from llama_index.data_structs.node_v2 import Node, DocumentRelationship def _delete_table_items(engine: Any, table: Table) -> None: diff --git a/tests/indices/struct_store/test_pandas.py b/tests/indices/struct_store/test_pandas.py index 80101c88b25bc..992d6f7c34ea6 100644 --- a/tests/indices/struct_store/test_pandas.py +++ b/tests/indices/struct_store/test_pandas.py @@ -3,11 +3,11 @@ from typing import Any, Dict, cast import pandas as pd -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.service_context import ServiceContext +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.service_context import ServiceContext -from gpt_index.indices.struct_store.pandas import GPTPandasIndex -from gpt_index.indices.struct_store.pandas_query import GPTNLPandasQueryEngine +from llama_index.indices.struct_store.pandas import GPTPandasIndex +from llama_index.indices.struct_store.pandas_query import GPTNLPandasQueryEngine def test_pandas_index(mock_service_context: ServiceContext) -> None: diff --git a/tests/indices/struct_store/test_sql_query.py b/tests/indices/struct_store/test_sql_query.py index 041eb0d109788..82ed178db7db0 100644 --- a/tests/indices/struct_store/test_sql_query.py +++ b/tests/indices/struct_store/test_sql_query.py @@ -2,15 +2,15 @@ from typing import Any, Dict, Tuple from sqlalchemy import Column, Integer, MetaData, String, Table, create_engine -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.struct_store.base import default_output_parser -from gpt_index.indices.struct_store.sql import GPTSQLStructStoreIndex -from gpt_index.indices.struct_store.sql_query import ( +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.struct_store.base import default_output_parser +from llama_index.indices.struct_store.sql import GPTSQLStructStoreIndex +from llama_index.indices.struct_store.sql_query import ( GPTNLStructStoreQueryEngine, GPTSQLStructStoreQueryEngine, ) -from gpt_index.langchain_helpers.sql_wrapper import SQLDatabase -from gpt_index.readers.schema.base import Document +from llama_index.langchain_helpers.sql_wrapper import SQLDatabase +from llama_index.readers.schema.base import Document def test_sql_index_query( diff --git a/tests/indices/test_loading.py b/tests/indices/test_loading.py index e0d3d32e5e4fd..be0614d90aeea 100644 --- a/tests/indices/test_loading.py +++ b/tests/indices/test_loading.py @@ -2,16 +2,19 @@ from pathlib import Path from typing import List import pytest -from gpt_index.data_structs.node_v2 import Node -from gpt_index.indices.list.base import GPTListIndex -from gpt_index.indices.loading import load_index_from_storage, load_indices_from_storage -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.vector_store.base import GPTVectorStoreIndex -from gpt_index.readers.schema.base import Document -from gpt_index.storage.docstore.simple_docstore import SimpleDocumentStore -from gpt_index.storage.index_store.simple_index_store import SimpleIndexStore -from gpt_index.storage.storage_context import StorageContext -from gpt_index.vector_stores.faiss import FaissVectorStore +from llama_index.data_structs.node_v2 import Node +from llama_index.indices.list.base import GPTListIndex +from llama_index.indices.loading import ( + load_index_from_storage, + load_indices_from_storage, +) +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.vector_store.base import GPTVectorStoreIndex +from llama_index.readers.schema.base import Document +from llama_index.storage.docstore.simple_docstore import SimpleDocumentStore +from llama_index.storage.index_store.simple_index_store import SimpleIndexStore +from llama_index.storage.storage_context import StorageContext +from llama_index.vector_stores.faiss import FaissVectorStore def test_load_index_from_storage_simple( diff --git a/tests/indices/test_loading_graph.py b/tests/indices/test_loading_graph.py index d45af24aedc8c..8b496a772d50a 100644 --- a/tests/indices/test_loading_graph.py +++ b/tests/indices/test_loading_graph.py @@ -1,13 +1,13 @@ from pathlib import Path from typing import List -from gpt_index.indices.composability.graph import ComposableGraph -from gpt_index.indices.list.base import GPTListIndex -from gpt_index.indices.loading import load_graph_from_storage -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.vector_store.base import GPTVectorStoreIndex - -from gpt_index.readers.schema.base import Document -from gpt_index.storage.storage_context import StorageContext +from llama_index.indices.composability.graph import ComposableGraph +from llama_index.indices.list.base import GPTListIndex +from llama_index.indices.loading import load_graph_from_storage +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.vector_store.base import GPTVectorStoreIndex + +from llama_index.readers.schema.base import Document +from llama_index.storage.storage_context import StorageContext def test_load_graph_from_storage_simple( diff --git a/tests/indices/test_node_utils.py b/tests/indices/test_node_utils.py index a0c2ace964999..88b8d0be50bb0 100644 --- a/tests/indices/test_node_utils.py +++ b/tests/indices/test_node_utils.py @@ -4,9 +4,9 @@ import pytest -from gpt_index.langchain_helpers.text_splitter import TokenTextSplitter -from gpt_index.node_parser.node_utils import get_nodes_from_document -from gpt_index.readers.schema.base import Document +from llama_index.langchain_helpers.text_splitter import TokenTextSplitter +from llama_index.node_parser.node_utils import get_nodes_from_document +from llama_index.readers.schema.base import Document @pytest.fixture diff --git a/tests/indices/test_prompt_helper.py b/tests/indices/test_prompt_helper.py index 506d3fda67b59..f0ec503c33036 100644 --- a/tests/indices/test_prompt_helper.py +++ b/tests/indices/test_prompt_helper.py @@ -3,9 +3,9 @@ from langchain import PromptTemplate as LangchainPrompt -from gpt_index.data_structs.node_v2 import Node -from gpt_index.indices.prompt_helper import PromptHelper -from gpt_index.prompts.base import Prompt +from llama_index.data_structs.node_v2 import Node +from llama_index.indices.prompt_helper import PromptHelper +from llama_index.prompts.base import Prompt from tests.mock_utils.mock_utils import mock_tokenizer diff --git a/tests/indices/test_utils.py b/tests/indices/test_utils.py index 8027ba56fe884..07d8760be7d51 100644 --- a/tests/indices/test_utils.py +++ b/tests/indices/test_utils.py @@ -1,5 +1,5 @@ """Test indices/utils.py.""" -from gpt_index.indices.utils import expand_tokens_with_subtokens +from llama_index.indices.utils import expand_tokens_with_subtokens def test_expand_tokens_with_subtokens() -> None: diff --git a/tests/indices/tree/conftest.py b/tests/indices/tree/conftest.py index 10d6e8e91ad96..ed521ad865e82 100644 --- a/tests/indices/tree/conftest.py +++ b/tests/indices/tree/conftest.py @@ -1,7 +1,7 @@ from typing import Dict, List, Tuple import pytest -from gpt_index.readers.schema.base import Document +from llama_index.readers.schema.base import Document from tests.mock_utils.mock_prompts import ( MOCK_INSERT_PROMPT, MOCK_QUERY_PROMPT, diff --git a/tests/indices/tree/test_embedding_retriever.py b/tests/indices/tree/test_embedding_retriever.py index 884f961a2a6c1..a4e79407fdf51 100644 --- a/tests/indices/tree/test_embedding_retriever.py +++ b/tests/indices/tree/test_embedding_retriever.py @@ -6,20 +6,20 @@ import pytest -from gpt_index.data_structs.node_v2 import Node -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.tree.select_leaf_embedding_retriever import ( +from llama_index.data_structs.node_v2 import Node +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.tree.select_leaf_embedding_retriever import ( TreeSelectLeafEmbeddingRetriever, ) -from gpt_index.indices.tree.base import GPTTreeIndex -from gpt_index.langchain_helpers.chain_wrapper import ( +from llama_index.indices.tree.base import GPTTreeIndex +from llama_index.langchain_helpers.chain_wrapper import ( LLMChain, LLMMetadata, LLMPredictor, ) -from gpt_index.langchain_helpers.text_splitter import TokenTextSplitter -from gpt_index.readers.schema.base import Document +from llama_index.langchain_helpers.text_splitter import TokenTextSplitter +from llama_index.readers.schema.base import Document from tests.mock_utils.mock_predict import mock_llmchain_predict from tests.mock_utils.mock_prompts import ( MOCK_INSERT_PROMPT, @@ -99,7 +99,7 @@ def _mock_tokenizer(text: str) -> int: @patch.object(LLMChain, "predict", side_effect=mock_llmchain_predict) -@patch("gpt_index.llm_predictor.base.OpenAI") +@patch("llama_index.llm_predictor.base.OpenAI") @patch.object(LLMPredictor, "get_llm_metadata", return_value=LLMMetadata()) @patch.object(LLMChain, "__init__", return_value=None) @patch.object( diff --git a/tests/indices/tree/test_index.py b/tests/indices/tree/test_index.py index 68598fe582077..aadf0f40902c2 100644 --- a/tests/indices/tree/test_index.py +++ b/tests/indices/tree/test_index.py @@ -3,12 +3,12 @@ from typing import Any, Dict, List, Optional from unittest.mock import patch -from gpt_index.data_structs.data_structs_v2 import IndexGraph -from gpt_index.data_structs.node_v2 import Node -from gpt_index.indices.service_context import ServiceContext -from gpt_index.storage.docstore import BaseDocumentStore -from gpt_index.indices.tree.base import GPTTreeIndex -from gpt_index.readers.schema.base import Document +from llama_index.data_structs.data_structs_v2 import IndexGraph +from llama_index.data_structs.node_v2 import Node +from llama_index.indices.service_context import ServiceContext +from llama_index.storage.docstore import BaseDocumentStore +from llama_index.indices.tree.base import GPTTreeIndex +from llama_index.readers.schema.base import Document def _get_left_or_right_node( @@ -87,7 +87,7 @@ def test_build_tree_with_embed( ] -@patch("gpt_index.indices.common_tree.base.run_async_tasks", side_effect=[OUTPUTS]) +@patch("llama_index.indices.common_tree.base.run_async_tasks", side_effect=[OUTPUTS]) def test_build_tree_async( _mock_run_async_tasks: Any, documents: List[Document], diff --git a/tests/indices/tree/test_retrievers.py b/tests/indices/tree/test_retrievers.py index 53dec2b338645..7305ba404ea5c 100644 --- a/tests/indices/tree/test_retrievers.py +++ b/tests/indices/tree/test_retrievers.py @@ -1,8 +1,8 @@ from typing import Dict, List -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.tree.base import GPTTreeIndex -from gpt_index.readers.schema.base import Document +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.tree.base import GPTTreeIndex +from llama_index.readers.schema.base import Document def test_query( diff --git a/tests/indices/vector_store/conftest.py b/tests/indices/vector_store/conftest.py index ece15efbaa830..0092d4567f794 100644 --- a/tests/indices/vector_store/conftest.py +++ b/tests/indices/vector_store/conftest.py @@ -5,8 +5,8 @@ from unittest.mock import MagicMock -from gpt_index.storage.storage_context import StorageContext -from gpt_index.vector_stores.faiss import FaissVectorStore +from llama_index.storage.storage_context import StorageContext +from llama_index.vector_stores.faiss import FaissVectorStore from tests.indices.vector_store.mock_faiss import MockFaissIndex diff --git a/tests/indices/vector_store/mock_services.py b/tests/indices/vector_store/mock_services.py index a54bf5ce33408..9e749f1f80cfc 100644 --- a/tests/indices/vector_store/mock_services.py +++ b/tests/indices/vector_store/mock_services.py @@ -1,5 +1,5 @@ from typing import List -from gpt_index.embeddings.base import BaseEmbedding +from llama_index.embeddings.base import BaseEmbedding class MockEmbedding(BaseEmbedding): diff --git a/tests/indices/vector_store/test_faiss.py b/tests/indices/vector_store/test_faiss.py index 8fd9e5e01f28e..4057c3c8e479d 100644 --- a/tests/indices/vector_store/test_faiss.py +++ b/tests/indices/vector_store/test_faiss.py @@ -5,15 +5,15 @@ from typing import List import pytest -from gpt_index.data_structs.node_v2 import Node +from llama_index.data_structs.node_v2 import Node -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.vector_store.base import GPTVectorStoreIndex +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.vector_store.base import GPTVectorStoreIndex -from gpt_index.readers.schema.base import Document -from gpt_index.storage.storage_context import StorageContext -from gpt_index.vector_stores.faiss import FaissVectorStore -from gpt_index.vector_stores.types import NodeEmbeddingResult, VectorStoreQuery +from llama_index.readers.schema.base import Document +from llama_index.storage.storage_context import StorageContext +from llama_index.vector_stores.faiss import FaissVectorStore +from llama_index.vector_stores.types import NodeEmbeddingResult, VectorStoreQuery @pytest.mark.skipif("CI" in os.environ, reason="no FAISS in CI") diff --git a/tests/indices/vector_store/test_milvus.py b/tests/indices/vector_store/test_milvus.py index f9bac802bf98b..7454adbf45398 100644 --- a/tests/indices/vector_store/test_milvus.py +++ b/tests/indices/vector_store/test_milvus.py @@ -2,11 +2,11 @@ from typing import Any, List, Optional -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.vector_store import GPTVectorStoreIndex -from gpt_index.storage.storage_context import StorageContext +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.vector_store import GPTVectorStoreIndex +from llama_index.storage.storage_context import StorageContext -from gpt_index.vector_stores.types import ( +from llama_index.vector_stores.types import ( NodeEmbeddingResult, VectorStore, VectorStoreQuery, diff --git a/tests/indices/vector_store/test_myscale.py b/tests/indices/vector_store/test_myscale.py index 2524d1fa779f6..e121fbd5e7f88 100644 --- a/tests/indices/vector_store/test_myscale.py +++ b/tests/indices/vector_store/test_myscale.py @@ -4,18 +4,18 @@ import pytest -from gpt_index.indices.vector_store.base import GPTVectorStoreIndex -from gpt_index.storage.storage_context import StorageContext +from llama_index.indices.vector_store.base import GPTVectorStoreIndex +from llama_index.storage.storage_context import StorageContext try: import clickhouse_connect except ImportError: clickhouse_connect = None # type: ignore -from gpt_index.data_structs.node_v2 import Node -from gpt_index.readers.schema.base import Document -from gpt_index.vector_stores import MyScaleVectorStore -from gpt_index.vector_stores.types import VectorStoreQuery +from llama_index.data_structs.node_v2 import Node +from llama_index.readers.schema.base import Document +from llama_index.vector_stores import MyScaleVectorStore +from llama_index.vector_stores.types import VectorStoreQuery # local test only, update variable here for test MYSCALE_CLUSTER_URL = None diff --git a/tests/indices/vector_store/test_pinecone.py b/tests/indices/vector_store/test_pinecone.py index 7d1e028a9f8aa..b92c89687d7fd 100644 --- a/tests/indices/vector_store/test_pinecone.py +++ b/tests/indices/vector_store/test_pinecone.py @@ -5,12 +5,12 @@ from unittest.mock import MagicMock, Mock import pytest -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.vector_store.base import GPTVectorStoreIndex +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.vector_store.base import GPTVectorStoreIndex -from gpt_index.readers.schema.base import Document -from gpt_index.storage.storage_context import StorageContext -from gpt_index.vector_stores.pinecone import PineconeVectorStore +from llama_index.readers.schema.base import Document +from llama_index.storage.storage_context import StorageContext +from llama_index.vector_stores.pinecone import PineconeVectorStore from tests.indices.vector_store.utils import MockPineconeIndex from tests.mock_utils.mock_utils import mock_tokenizer diff --git a/tests/indices/vector_store/test_retrievers.py b/tests/indices/vector_store/test_retrievers.py index 11565312ba596..45bb3690379be 100644 --- a/tests/indices/vector_store/test_retrievers.py +++ b/tests/indices/vector_store/test_retrievers.py @@ -1,11 +1,11 @@ from typing import List, cast -from gpt_index.data_structs.node_v2 import DocumentRelationship, Node -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.vector_store.base import GPTVectorStoreIndex -from gpt_index.readers.schema.base import Document -from gpt_index.storage.storage_context import StorageContext -from gpt_index.vector_stores.simple import SimpleVectorStore +from llama_index.data_structs.node_v2 import DocumentRelationship, Node +from llama_index.indices.query.schema import QueryBundle +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.vector_store.base import GPTVectorStoreIndex +from llama_index.readers.schema.base import Document +from llama_index.storage.storage_context import StorageContext +from llama_index.vector_stores.simple import SimpleVectorStore def test_faiss_query( diff --git a/tests/indices/vector_store/test_simple.py b/tests/indices/vector_store/test_simple.py index dcc5ed24a8d11..a77b1d8173424 100644 --- a/tests/indices/vector_store/test_simple.py +++ b/tests/indices/vector_store/test_simple.py @@ -3,11 +3,11 @@ from typing import Any, List, cast -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.vector_store.base import GPTVectorStoreIndex +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.vector_store.base import GPTVectorStoreIndex -from gpt_index.readers.schema.base import Document -from gpt_index.vector_stores.simple import SimpleVectorStore +from llama_index.readers.schema.base import Document +from llama_index.vector_stores.simple import SimpleVectorStore def test_build_simple( diff --git a/tests/indices/vector_store/test_weaviate.py b/tests/indices/vector_store/test_weaviate.py index 9c4b1ddeb1263..fcf35b9d0c355 100644 --- a/tests/indices/vector_store/test_weaviate.py +++ b/tests/indices/vector_store/test_weaviate.py @@ -1,10 +1,10 @@ from typing import Any, List, Optional from unittest.mock import Mock -from gpt_index.indices.service_context import ServiceContext +from llama_index.indices.service_context import ServiceContext -from gpt_index.indices.vector_store import GPTVectorStoreIndex -from gpt_index.storage.storage_context import StorageContext -from gpt_index.vector_stores.types import ( +from llama_index.indices.vector_store import GPTVectorStoreIndex +from llama_index.storage.storage_context import StorageContext +from llama_index.vector_stores.types import ( NodeEmbeddingResult, VectorStore, VectorStoreQuery, diff --git a/tests/langchain_helpers/test_text_splitter.py b/tests/langchain_helpers/test_text_splitter.py index b3899815d804b..93791d4b91416 100644 --- a/tests/langchain_helpers/test_text_splitter.py +++ b/tests/langchain_helpers/test_text_splitter.py @@ -1,5 +1,5 @@ """Test text splitter.""" -from gpt_index.langchain_helpers.text_splitter import ( +from llama_index.langchain_helpers.text_splitter import ( SentenceSplitter, TokenTextSplitter, ) diff --git a/tests/llm_predictor/test_base.py b/tests/llm_predictor/test_base.py index 7017c14106970..0f5166364f55b 100644 --- a/tests/llm_predictor/test_base.py +++ b/tests/llm_predictor/test_base.py @@ -6,10 +6,10 @@ import pytest from langchain.llms.fake import FakeListLLM -from gpt_index.llm_predictor.structured import LLMPredictor, StructuredLLMPredictor -from gpt_index.output_parsers.base import BaseOutputParser -from gpt_index.prompts.default_prompts import DEFAULT_SIMPLE_INPUT_PROMPT -from gpt_index.prompts.prompts import Prompt, SimpleInputPrompt +from llama_index.llm_predictor.structured import LLMPredictor, StructuredLLMPredictor +from llama_index.output_parsers.base import BaseOutputParser +from llama_index.prompts.default_prompts import DEFAULT_SIMPLE_INPUT_PROMPT +from llama_index.prompts.prompts import Prompt, SimpleInputPrompt try: from gptcache import Cache diff --git a/tests/logger/test_base.py b/tests/logger/test_base.py index d89bc7235d13f..9c66b46a0e086 100644 --- a/tests/logger/test_base.py +++ b/tests/logger/test_base.py @@ -1,6 +1,6 @@ """Unit tests for logger.""" -from gpt_index.logger.base import LlamaLogger +from llama_index.logger.base import LlamaLogger def test_logger() -> None: diff --git a/tests/mock_utils/mock_predict.py b/tests/mock_utils/mock_predict.py index 8fd224cb6aff5..65812fa0845e3 100644 --- a/tests/mock_utils/mock_predict.py +++ b/tests/mock_utils/mock_predict.py @@ -3,12 +3,12 @@ import json from typing import Any, Dict, Tuple -from gpt_index.indices.query.query_transform.prompts import ( +from llama_index.indices.query.query_transform.prompts import ( DecomposeQueryTransformPrompt, ) -from gpt_index.prompts.base import Prompt -from gpt_index.prompts.prompt_type import PromptType -from gpt_index.token_counter.utils import mock_extract_keywords_response +from llama_index.prompts.base import Prompt +from llama_index.prompts.prompt_type import PromptType +from llama_index.token_counter.utils import mock_extract_keywords_response def _mock_summary_predict(prompt_args: Dict) -> str: diff --git a/tests/mock_utils/mock_prompts.py b/tests/mock_utils/mock_prompts.py index 3c57c01900dee..96079a3ba76a8 100644 --- a/tests/mock_utils/mock_prompts.py +++ b/tests/mock_utils/mock_prompts.py @@ -1,6 +1,6 @@ """Mock prompt utils.""" -from gpt_index.prompts.prompts import ( +from llama_index.prompts.prompts import ( KeywordExtractPrompt, KnowledgeGraphPrompt, PandasPrompt, diff --git a/tests/mock_utils/mock_text_splitter.py b/tests/mock_utils/mock_text_splitter.py index ee07563b36f18..63c98322e03a5 100644 --- a/tests/mock_utils/mock_text_splitter.py +++ b/tests/mock_utils/mock_text_splitter.py @@ -2,7 +2,7 @@ from typing import Any, List, Optional -from gpt_index.langchain_helpers.text_splitter import TextSplit +from llama_index.langchain_helpers.text_splitter import TextSplit def patch_token_splitter_newline( diff --git a/tests/mock_utils/mock_utils.py b/tests/mock_utils/mock_utils.py index 894c95fe14837..8fed074a217ea 100644 --- a/tests/mock_utils/mock_utils.py +++ b/tests/mock_utils/mock_utils.py @@ -2,7 +2,7 @@ from typing import List, Optional, Set -from gpt_index.indices.keyword_table.utils import simple_extract_keywords +from llama_index.indices.keyword_table.utils import simple_extract_keywords def mock_tokenizer(text: str) -> List[str]: diff --git a/tests/optimization/test_base.py b/tests/optimization/test_base.py index 6565f3196bb35..783c3bebb6dea 100644 --- a/tests/optimization/test_base.py +++ b/tests/optimization/test_base.py @@ -3,9 +3,9 @@ from typing import Any, List from unittest.mock import patch -from gpt_index.embeddings.openai import OpenAIEmbedding -from gpt_index.indices.query.schema import QueryBundle -from gpt_index.optimization.optimizer import SentenceEmbeddingOptimizer +from llama_index.embeddings.openai import OpenAIEmbedding +from llama_index.indices.query.schema import QueryBundle +from llama_index.optimization.optimizer import SentenceEmbeddingOptimizer def mock_tokenizer_fn(text: str) -> List[str]: diff --git a/tests/output_parsers/test_base.py b/tests/output_parsers/test_base.py index 99eb6f7eb0c99..b07f5aecc274c 100644 --- a/tests/output_parsers/test_base.py +++ b/tests/output_parsers/test_base.py @@ -4,7 +4,7 @@ from langchain.output_parsers import ResponseSchema from langchain.schema import BaseOutputParser as LCOutputParser -from gpt_index.output_parsers.langchain import LangchainOutputParser +from llama_index.output_parsers.langchain import LangchainOutputParser class MockOutputParser(LCOutputParser): diff --git a/tests/output_parsers/test_selection.py b/tests/output_parsers/test_selection.py index d6816262883e4..0ec124dd5e342 100644 --- a/tests/output_parsers/test_selection.py +++ b/tests/output_parsers/test_selection.py @@ -1,6 +1,6 @@ import pytest -from gpt_index.output_parsers.base import StructuredOutput -from gpt_index.output_parsers.selection import SelectionOutputParser +from llama_index.output_parsers.base import StructuredOutput +from llama_index.output_parsers.selection import SelectionOutputParser @pytest.fixture() diff --git a/tests/playground/test_base.py b/tests/playground/test_base.py index 560bd331a9a8f..d06bcb9464715 100644 --- a/tests/playground/test_base.py +++ b/tests/playground/test_base.py @@ -3,14 +3,14 @@ from typing import List import pytest -from gpt_index.embeddings.base import BaseEmbedding - -from gpt_index.indices.list.base import GPTListIndex -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.tree.base import GPTTreeIndex -from gpt_index.indices.vector_store.base import GPTVectorStoreIndex -from gpt_index.playground import DEFAULT_INDEX_CLASSES, DEFAULT_MODES, Playground -from gpt_index.readers.schema.base import Document +from llama_index.embeddings.base import BaseEmbedding + +from llama_index.indices.list.base import GPTListIndex +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.tree.base import GPTTreeIndex +from llama_index.indices.vector_store.base import GPTVectorStoreIndex +from llama_index.playground import DEFAULT_INDEX_CLASSES, DEFAULT_MODES, Playground +from llama_index.readers.schema.base import Document class MockEmbedding(BaseEmbedding): diff --git a/tests/prompts/test_base.py b/tests/prompts/test_base.py index 9c23da004ef14..affab9bfd6214 100644 --- a/tests/prompts/test_base.py +++ b/tests/prompts/test_base.py @@ -9,7 +9,7 @@ from langchain.chat_models.base import BaseChatModel from langchain.chat_models.openai import ChatOpenAI -from gpt_index.prompts.base import Prompt +from llama_index.prompts.base import Prompt class TestLanguageModel(ChatOpenAI): diff --git a/tests/readers/test_file.py b/tests/readers/test_file.py index eb3bb5a97780e..6e0a8f6161f76 100644 --- a/tests/readers/test_file.py +++ b/tests/readers/test_file.py @@ -3,7 +3,7 @@ from tempfile import TemporaryDirectory from typing import Any, Dict -from gpt_index.readers.file.base import SimpleDirectoryReader +from llama_index.readers.file.base import SimpleDirectoryReader def test_recursive() -> None: diff --git a/tests/readers/test_json.py b/tests/readers/test_json.py index 33d80f4e011f9..f01715be37109 100644 --- a/tests/readers/test_json.py +++ b/tests/readers/test_json.py @@ -2,7 +2,7 @@ from tempfile import TemporaryDirectory -from gpt_index.readers.json import JSONReader +from llama_index.readers.json import JSONReader def test_basic() -> None: diff --git a/tests/readers/test_mongo.py b/tests/readers/test_mongo.py index dcc34eafdd69a..9b1a2e562ab3c 100644 --- a/tests/readers/test_mongo.py +++ b/tests/readers/test_mongo.py @@ -2,7 +2,7 @@ import pytest -from gpt_index.readers.mongo import SimpleMongoReader +from llama_index.readers.mongo import SimpleMongoReader try: from pymongo import MongoClient diff --git a/tests/readers/test_string_iterable.py b/tests/readers/test_string_iterable.py index b74ba1a830563..67155ea42cee7 100644 --- a/tests/readers/test_string_iterable.py +++ b/tests/readers/test_string_iterable.py @@ -1,6 +1,6 @@ """Test String Iterable Reader.""" -from gpt_index.readers.string_iterable import StringIterableReader +from llama_index.readers.string_iterable import StringIterableReader def test_load() -> None: diff --git a/tests/selectors/test_llm_selectors.py b/tests/selectors/test_llm_selectors.py index 27e76e3dbd11e..8d3f5e6dc0e0b 100644 --- a/tests/selectors/test_llm_selectors.py +++ b/tests/selectors/test_llm_selectors.py @@ -1,5 +1,5 @@ -from gpt_index.indices.service_context import ServiceContext -from gpt_index.selectors.llm_selectors import LLMMultiSelector, LLMSingleSelector +from llama_index.indices.service_context import ServiceContext +from llama_index.selectors.llm_selectors import LLMMultiSelector, LLMSingleSelector def test_llm_single_selector( diff --git a/tests/storage/conftest.py b/tests/storage/conftest.py index 2e6ef8c1e3519..c4b6c2d37ae7f 100644 --- a/tests/storage/conftest.py +++ b/tests/storage/conftest.py @@ -1,6 +1,6 @@ import pytest -from gpt_index.storage.kvstore.mongodb_kvstore import MongoDBKVStore -from gpt_index.storage.kvstore.simple_kvstore import SimpleKVStore +from llama_index.storage.kvstore.mongodb_kvstore import MongoDBKVStore +from llama_index.storage.kvstore.simple_kvstore import SimpleKVStore from tests.storage.kvstore.mock_mongodb import MockMongoClient diff --git a/tests/storage/docstore/test_mongo_docstore.py b/tests/storage/docstore/test_mongo_docstore.py index b56e63f81af3c..9e1dabdfc2367 100644 --- a/tests/storage/docstore/test_mongo_docstore.py +++ b/tests/storage/docstore/test_mongo_docstore.py @@ -2,10 +2,10 @@ import pytest -from gpt_index.storage.docstore.mongo_docstore import MongoDocumentStore -from gpt_index.readers.schema.base import Document -from gpt_index.schema import BaseDocument -from gpt_index.storage.kvstore.mongodb_kvstore import MongoDBKVStore +from llama_index.storage.docstore.mongo_docstore import MongoDocumentStore +from llama_index.readers.schema.base import Document +from llama_index.schema import BaseDocument +from llama_index.storage.kvstore.mongodb_kvstore import MongoDBKVStore try: from pymongo import MongoClient diff --git a/tests/storage/docstore/test_simple_docstore.py b/tests/storage/docstore/test_simple_docstore.py index cb0f291d8d5c8..5e5cf568ec585 100644 --- a/tests/storage/docstore/test_simple_docstore.py +++ b/tests/storage/docstore/test_simple_docstore.py @@ -3,10 +3,10 @@ from pathlib import Path import pytest -from gpt_index.data_structs.node_v2 import Node -from gpt_index.storage.docstore import SimpleDocumentStore -from gpt_index.readers.schema.base import Document -from gpt_index.storage.kvstore.simple_kvstore import SimpleKVStore +from llama_index.data_structs.node_v2 import Node +from llama_index.storage.docstore import SimpleDocumentStore +from llama_index.readers.schema.base import Document +from llama_index.storage.kvstore.simple_kvstore import SimpleKVStore @pytest.fixture() diff --git a/tests/storage/kvstore/test_mongodb_kvstore.py b/tests/storage/kvstore/test_mongodb_kvstore.py index 4cfcc4778044b..720bd08f0e2b3 100644 --- a/tests/storage/kvstore/test_mongodb_kvstore.py +++ b/tests/storage/kvstore/test_mongodb_kvstore.py @@ -1,5 +1,5 @@ import pytest -from gpt_index.storage.kvstore.mongodb_kvstore import MongoDBKVStore +from llama_index.storage.kvstore.mongodb_kvstore import MongoDBKVStore try: from pymongo import MongoClient diff --git a/tests/storage/kvstore/test_simple_kvstore.py b/tests/storage/kvstore/test_simple_kvstore.py index 3b713e0b77ed8..78ee0ba5b7dfa 100644 --- a/tests/storage/kvstore/test_simple_kvstore.py +++ b/tests/storage/kvstore/test_simple_kvstore.py @@ -1,5 +1,5 @@ import pytest -from gpt_index.storage.kvstore.simple_kvstore import SimpleKVStore +from llama_index.storage.kvstore.simple_kvstore import SimpleKVStore from pathlib import Path diff --git a/tests/test_utils.py b/tests/test_utils.py index faa863af4272e..ad4580bd7ce1e 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -4,7 +4,7 @@ import pytest -from gpt_index.utils import ( +from llama_index.utils import ( ErrorToRetry, globals_helper, retry_on_exceptions_with_backoff, diff --git a/tests/token_predictor/test_base.py b/tests/token_predictor/test_base.py index a40e44dec4383..d8beb24e51936 100644 --- a/tests/token_predictor/test_base.py +++ b/tests/token_predictor/test_base.py @@ -5,13 +5,13 @@ from langchain.llms.base import BaseLLM -from gpt_index.indices.keyword_table.base import GPTKeywordTableIndex -from gpt_index.indices.list.base import GPTListIndex -from gpt_index.indices.service_context import ServiceContext -from gpt_index.indices.tree.base import GPTTreeIndex -from gpt_index.langchain_helpers.text_splitter import TokenTextSplitter -from gpt_index.readers.schema.base import Document -from gpt_index.token_counter.mock_chain_wrapper import MockLLMPredictor +from llama_index.indices.keyword_table.base import GPTKeywordTableIndex +from llama_index.indices.list.base import GPTListIndex +from llama_index.indices.service_context import ServiceContext +from llama_index.indices.tree.base import GPTTreeIndex +from llama_index.langchain_helpers.text_splitter import TokenTextSplitter +from llama_index.readers.schema.base import Document +from llama_index.token_counter.mock_chain_wrapper import MockLLMPredictor from tests.mock_utils.mock_text_splitter import mock_token_splitter_newline diff --git a/tests/vector_stores/test_qdrant.py b/tests/vector_stores/test_qdrant.py index 768713b81858d..6ebcae25c1318 100644 --- a/tests/vector_stores/test_qdrant.py +++ b/tests/vector_stores/test_qdrant.py @@ -7,9 +7,9 @@ except ImportError: qdrant_client = None # type: ignore -from gpt_index.data_structs import Node -from gpt_index.vector_stores import QdrantVectorStore -from gpt_index.vector_stores.types import NodeEmbeddingResult, VectorStoreQuery +from llama_index.data_structs import Node +from llama_index.vector_stores import QdrantVectorStore +from llama_index.vector_stores.types import NodeEmbeddingResult, VectorStoreQuery @pytest.fixture diff --git a/tests/vector_stores/test_weaviate.py b/tests/vector_stores/test_weaviate.py index 85a1b6ef75820..fe0d86986555a 100644 --- a/tests/vector_stores/test_weaviate.py +++ b/tests/vector_stores/test_weaviate.py @@ -1,9 +1,9 @@ import sys from unittest.mock import MagicMock -from gpt_index.data_structs.node_v2 import Node -from gpt_index.vector_stores.types import NodeEmbeddingResult +from llama_index.data_structs.node_v2 import Node +from llama_index.vector_stores.types import NodeEmbeddingResult -from gpt_index.vector_stores.weaviate import WeaviateVectorStore +from llama_index.vector_stores.weaviate import WeaviateVectorStore def test_weaviate_add() -> None: