关键词检索增加容错
This commit is contained in:
@@ -63,8 +63,9 @@ def persist_storage(docstore, vector_store):
|
||||
|
||||
def persist_BMRetriever(vector_store):
|
||||
STORAGE_DIR = os.getenv("BM_RETRIEVER_PATH", "storage_bm")
|
||||
top_k = int(os.getenv("TOP_K", "3"))
|
||||
bmRetriver = CHBM25Retriever.from_defaults(similarity_top_k=top_k,nodes=vector_store.get_nodes([]))
|
||||
nodes = vector_store.get_nodes([])
|
||||
top_k = min(int(os.getenv("TOP_K", "3")),len(nodes))
|
||||
bmRetriver = CHBM25Retriever.from_defaults(similarity_top_k=top_k,nodes = nodes)
|
||||
bmRetriver.persist(STORAGE_DIR)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user