MCPcopy Create free account
hub / github.com/SmartFlowAI/TheGodOfCookery / load_vector_db

Function load_vector_db

eval/interface.py:31–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29
30
31def load_vector_db():
32 # 加载编码模型
33 bce_emb_config = load_config('rag_langchain', 'bce_emb_config')
34 embeddings = HuggingFaceEmbeddings(**bce_emb_config)
35 # 加载本地索引,创建向量检索器
36 # 除非指定使用chroma,否则默认使用faiss
37 rag_model_type = load_config('rag_langchain', 'rag_model_type')
38 if rag_model_type == "chroma":
39 vector_db_path = "../rag_langchain/chroma_db"
40 vectordb = Chroma(persist_directory=vector_db_path, embedding_function=embeddings)
41 else:
42 vector_db_path = "../rag_langchain/faiss_index"
43 vectordb = FAISS.load_local(folder_path=vector_db_path, embeddings=embeddings)
44 return vectordb
45
46
47def load_retriever():

Callers 2

test_vector_dbFunction · 0.90
load_retrieverFunction · 0.70

Calls 1

load_configFunction · 0.90

Tested by 1

test_vector_dbFunction · 0.72