diff --git a/docs/docs/agents/modules/memory/hybrid_memory.md b/docs/docs/agents/modules/memory/hybrid_memory.md index 707ac0ed8..6494a5cba 100644 --- a/docs/docs/agents/modules/memory/hybrid_memory.md +++ b/docs/docs/agents/modules/memory/hybrid_memory.md @@ -57,12 +57,10 @@ from dbgpt_ext.storage.vector_store.chroma_store import ChromaVectorConfig, Chro shutil.rmtree("/tmp/tmp_ltm_vector_store", ignore_errors=True) vector_store = ChromaStore( ChromaVectorConfig( - embedding_fn=embeddings, - vector_store_config=ChromaVectorConfig( - name="ltm_vector_store", - persist_path="/tmp/tmp_ltm_vector_store", - ), - ) + persist_path="/tmp/tmp_ltm_vector_store", + ), + name="ltm_vector_store", + embedding_fn=embeddings ) ``` diff --git a/docs/docs/agents/modules/memory/long_term_memory.md b/docs/docs/agents/modules/memory/long_term_memory.md index 44c73b055..3caae8275 100644 --- a/docs/docs/agents/modules/memory/long_term_memory.md +++ b/docs/docs/agents/modules/memory/long_term_memory.md @@ -47,13 +47,11 @@ from dbgpt_ext.storage.vector_store.chroma_store import ChromaVectorConfig, Chro # Delete old vector store directory(/tmp/tmp_ltm_vector_stor) shutil.rmtree("/tmp/tmp_ltm_vector_store", ignore_errors=True) vector_store = ChromaStore( - ChromaVectorConfig( - embedding_fn=embeddings, - vector_store_config=ChromaVectorConfig( - name="ltm_vector_store", - persist_path="/tmp/tmp_ltm_vector_store", - ), - ) + vector_store_config=ChromaVectorConfig( + persist_path="/tmp/tmp_ltm_vector_store", + ), + name="ltm_vector_store", + embedding_fn=embeddings, ) ``` diff --git a/docs/docs/awel/cookbook/first_rag_with_awel.md b/docs/docs/awel/cookbook/first_rag_with_awel.md index d29056d05..fbdfb18e4 100644 --- a/docs/docs/awel/cookbook/first_rag_with_awel.md +++ b/docs/docs/awel/cookbook/first_rag_with_awel.md @@ -11,7 +11,7 @@ In this example, we will load your knowledge from a URL and store it in a vector First, you need to install the `dbgpt` library. ```bash -pip install "dbgpt[rag]>=0.5.2" +pip install "dbgpt[agent,simple_framework, client]>=0.7.1" "dbgpt_ext>=0.7.1" -U ```` ### Prepare Embedding Model @@ -84,10 +84,10 @@ shutil.rmtree("/tmp/awel_rag_test_vector_store", ignore_errors=True) vector_store = ChromaStore( vector_store_config=ChromaVectorConfig( - name="test_vstore", - persist_path="/tmp/awel_rag_test_vector_store", - embedding_fn=embeddings - ) + persist_path="/tmp/awel_rag_test_vector_store" + ), + name="test_vstore", + embedding_fn=embeddings ) with DAG("load_knowledge_dag") as knowledge_dag: @@ -274,10 +274,10 @@ shutil.rmtree("/tmp/awel_rag_test_vector_store", ignore_errors=True) vector_store = ChromaStore( vector_store_config=ChromaVectorConfig( - name="test_vstore", persist_path="/tmp/awel_rag_test_vector_store", - embedding_fn=embeddings ), + name="test_vstore", + embedding_fn=embeddings ) with DAG("load_knowledge_dag") as knowledge_dag: diff --git a/docs/docs/awel/cookbook/write_your_chat_database.md b/docs/docs/awel/cookbook/write_your_chat_database.md index db7f7fb67..b67bf512f 100644 --- a/docs/docs/awel/cookbook/write_your_chat_database.md +++ b/docs/docs/awel/cookbook/write_your_chat_database.md @@ -29,7 +29,8 @@ In this guide, we mainly focus on step 1, 2, and 3. First, you need to install the `dbgpt` library. ```bash -pip install "dbgpt[rag]>=0.7.0" -U +pip install "dbgpt[rag, agent, client, simple_framework]>=0.7.0" "dbgpt_ext>=0.7.0" -U +pip install openai ```` ## Build Knowledge Base @@ -92,9 +93,9 @@ shutil.rmtree("/tmp/awel_with_data_vector_store", ignore_errors=True) vector_store = ChromaStore( ChromaVectorConfig( persist_path="/tmp/tmp_ltm_vector_store", - name="ltm_vector_store", - embedding_fn=embeddings, - ) + ), + name="ltm_vector_store", + embedding_fn=embeddings, ) with DAG("load_schema_dag") as load_schema_dag: @@ -102,7 +103,7 @@ with DAG("load_schema_dag") as load_schema_dag: # Load database schema to vector store assembler_task = DBSchemaAssemblerOperator( connector=db_conn, - index_store=vector_store, + table_vector_store_connector=vector_store, chunk_parameters=ChunkParameters(chunk_strategy="CHUNK_BY_SIZE") ) input_task >> assembler_task @@ -122,7 +123,8 @@ with DAG("retrieve_schema_dag") as retrieve_schema_dag: # Retrieve database schema from vector store retriever_task = DBSchemaRetrieverOperator( top_k=1, - index_store=vector_store, + table_vector_store_connector=vector_store, + field_vector_store_connector=vector_store ) input_task >> retriever_task @@ -487,10 +489,10 @@ db_conn.create_temp_tables( vector_store = ChromaStore( ChromaVectorConfig( - embedding_fn=embeddings, - name="db_schema_vector_store", persist_path="/tmp/awel_with_data_vector_store", - ) + ), + embedding_fn=embeddings, + name="db_schema_vector_store", ) antv_charts = [ @@ -623,7 +625,7 @@ with DAG("load_schema_dag") as load_schema_dag: # Load database schema to vector store assembler_task = DBSchemaAssemblerOperator( connector=db_conn, - index_store=vector_store, + table_vector_store_connector=vector_store, chunk_parameters=ChunkParameters(chunk_strategy="CHUNK_BY_SIZE"), ) input_task >> assembler_task diff --git a/examples/awel/simple_nl_schema_sql_chart_example.py b/examples/awel/simple_nl_schema_sql_chart_example.py index 84e9edded..7be75f47e 100644 --- a/examples/awel/simple_nl_schema_sql_chart_example.py +++ b/examples/awel/simple_nl_schema_sql_chart_example.py @@ -51,16 +51,16 @@ INPUT_PROMPT = "\n###Input:\n{}\n###Response:" def _create_vector_connector(): """Create vector connector.""" - config = ChromaVectorConfig( - persist_path=PILOT_PATH, + config = ChromaVectorConfig(persist_path=PILOT_PATH) + + return ChromaStore( + config, name="embedding_rag_test", embedding_fn=DefaultEmbeddingFactory( default_model_name=os.path.join(MODEL_PATH, "text2vec-large-chinese"), ).create(), ) - return ChromaStore(config) - def _create_temporary_connection(): """Create a temporary database connection for testing.""" diff --git a/examples/sdk/chat_data_with_awel.py b/examples/sdk/chat_data_with_awel.py index bbb01218b..448e482a5 100644 --- a/examples/sdk/chat_data_with_awel.py +++ b/examples/sdk/chat_data_with_awel.py @@ -60,12 +60,12 @@ db_conn.create_temp_tables( } ) -config = ChromaVectorConfig( - persist_path=PILOT_PATH, +config = ChromaVectorConfig(persist_path=PILOT_PATH) +vector_store = ChromaStore( + config, name="db_schema_vector_store", embedding_fn=embeddings, ) -vector_store = ChromaStore(config) antv_charts = [ {"response_line_chart": "used to display comparative trend analysis data"}, diff --git a/packages/dbgpt-core/src/dbgpt/agent/core/memory/hybrid.py b/packages/dbgpt-core/src/dbgpt/agent/core/memory/hybrid.py index 2e879804b..fc94000b1 100644 --- a/packages/dbgpt-core/src/dbgpt/agent/core/memory/hybrid.py +++ b/packages/dbgpt-core/src/dbgpt/agent/core/memory/hybrid.py @@ -94,11 +94,9 @@ class HybridMemory(Memory, Generic[T]): vstore_path = vstore_path or os.path.join(DATA_DIR, "agent_memory") vector_store = ChromaStore( - ChromaVectorConfig( - name=vstore_name, - persist_path=vstore_path, - embedding_fn=embeddings, - ) + ChromaVectorConfig(persist_path=vstore_path), + name=vstore_name, + embedding_fn=embeddings, ) return cls.from_vstore( vector_store=vector_store,