mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-01 00:03:29 +00:00
chore: update create chroma store param (#2798)
This commit is contained in:
parent
bf6f38906d
commit
f423b1fb2c
@ -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
|
||||
)
|
||||
```
|
||||
|
||||
|
@ -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,
|
||||
)
|
||||
```
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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."""
|
||||
|
@ -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"},
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user