mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-01 09:06:55 +00:00
refactor:refactor knowledge api
1.delete CFG in embedding_engine api 2.add a text_splitter param in embedding_engine api
This commit is contained in:
@@ -26,7 +26,7 @@ before execution:
|
||||
::
|
||||
|
||||
url = "https://db-gpt.readthedocs.io/en/latest/getting_started/getting_started.html"
|
||||
embedding_model = "text2vec"
|
||||
embedding_model = "your_model_path/all-MiniLM-L6-v2"
|
||||
vector_store_config = {
|
||||
"vector_store_name": your_name,
|
||||
}
|
||||
@@ -43,9 +43,11 @@ Document type can be .txt, .pdf, .md, .doc, .ppt.
|
||||
::
|
||||
|
||||
document_path = "your_path/test.md"
|
||||
embedding_model = "text2vec"
|
||||
embedding_model = "your_model_path/all-MiniLM-L6-v2"
|
||||
vector_store_config = {
|
||||
"vector_store_name": your_name,
|
||||
"vector_store_type": "Chroma",
|
||||
"chroma_persist_path": "your_persist_dir",
|
||||
}
|
||||
embedding_engine = EmbeddingEngine(
|
||||
knowledge_source=document_path,
|
||||
@@ -59,7 +61,7 @@ Document type can be .txt, .pdf, .md, .doc, .ppt.
|
||||
::
|
||||
|
||||
raw_text = "a long passage"
|
||||
embedding_model = "text2vec"
|
||||
embedding_model = "your_model_path/all-MiniLM-L6-v2"
|
||||
vector_store_config = {
|
||||
"vector_store_name": your_name,
|
||||
}
|
||||
|
@@ -32,11 +32,17 @@ Below is an example of using the knowledge base API to query knowledge:
|
||||
|
||||
```
|
||||
vector_store_config = {
|
||||
"vector_store_name": name
|
||||
"vector_store_name": your_name,
|
||||
"vector_store_type": "Chroma",
|
||||
"chroma_persist_path": "your_persist_dir",
|
||||
}
|
||||
|
||||
integrate
|
||||
|
||||
query = "your query"
|
||||
|
||||
embedding_model = "your_model_path/all-MiniLM-L6-v2"
|
||||
|
||||
embedding_engine = EmbeddingEngine(knowledge_source=url, knowledge_type=KnowledgeType.URL.value, model_name=embedding_model, vector_store_config=vector_store_config)
|
||||
|
||||
embedding_engine.similar_search(query, 10)
|
||||
|
Reference in New Issue
Block a user