mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-31 08:33:36 +00:00
test:add document embedding and url embedding test
This commit is contained in:
20
tests/unit/embedding_engine/document_test.py
Normal file
20
tests/unit/embedding_engine/document_test.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from pilot import EmbeddingEngine, KnowledgeType
|
||||
|
||||
embedding_model = "your_embedding_model"
|
||||
vector_store_type = "Chroma"
|
||||
chroma_persist_path = "your_persist_path"
|
||||
vector_store_config = {
|
||||
"vector_store_name": "document_test",
|
||||
"vector_store_type": vector_store_type,
|
||||
"chroma_persist_path": chroma_persist_path,
|
||||
}
|
||||
|
||||
# it can be .md,.pdf,.docx, .csv, .html
|
||||
document_path = "your_path/test.md"
|
||||
embedding_engine = EmbeddingEngine(
|
||||
knowledge_source=document_path,
|
||||
knowledge_type=KnowledgeType.DOCUMENT.value,
|
||||
model_name=embedding_model,
|
||||
vector_store_config=vector_store_config)
|
||||
# embedding document content to vector store
|
||||
embedding_engine.knowledge_embedding()
|
@@ -1,7 +1,7 @@
|
||||
from pilot import EmbeddingEngine, KnowledgeType
|
||||
|
||||
url = "https://db-gpt.readthedocs.io/en/latest/getting_started/getting_started.html"
|
||||
embedding_model = "text2vec"
|
||||
embedding_model = "your_embedding_model"
|
||||
vector_store_type = "Chroma"
|
||||
chroma_persist_path = "your_persist_path"
|
||||
vector_store_config = {
|
Reference in New Issue
Block a user