Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
Bump qdrant-client from 1.8.2 to 1.9.0 in /intel_extension_for_transf…
Browse files Browse the repository at this point in the history
…ormers/neural_chat/tests (#1592)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: yuwenzho <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 14, 2024
1 parent 44a24ec commit 335edda
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ def __init__(self,
knowledge_base = self.database.build(documents=langchain_documents, embedding=self.embeddings, **kwargs)
self.retriever = RetrieverAdapter(retrieval_type=self.retrieval_type, document_store=knowledge_base, \
**kwargs)
if self.vector_database == "Qdrant" and knowledge_base.is_local():
# one local storage folder cannot be accessed by multiple instances of Qdrant client simultaneously.
knowledge_base.client.close()
elif self.retrieval_type == "child_parent": # Using child-parent store retriever
child_documents = self.splitter.split_documents(langchain_documents)
langchain_documents = document_append_id(langchain_documents)
Expand All @@ -206,12 +203,6 @@ def __init__(self,
sign='child', **kwargs)
self.retriever = RetrieverAdapter(retrieval_type=self.retrieval_type, document_store=knowledge_base, \
child_document_store=child_knowledge_base, **kwargs)
if self.vector_database == "Qdrant" :
# one local storage folder cannot be accessed by multiple instances of Qdrant client simultaneously.
if knowledge_base.is_local():
knowledge_base.client.close()
if child_knowledge_base.is_local():
child_knowledge_base.client.close()
elif self.retrieval_type == "bm25":
self.docs = document_append_id(langchain_documents)
self.retriever = RetrieverAdapter(retrieval_type=self.retrieval_type, docs=self.docs, **kwargs)
Expand Down Expand Up @@ -341,4 +332,23 @@ def pre_llm_inference_actions(self, model_name, query):
prompt = generate_qa_prompt(query, context)
else:
logging.error("The selected generation mode is invalid!")

# qdrant local vector db need to be closed
# one local storage folder cannot be accessed by multiple instances of Qdrant client simultaneously.
if self.vector_database == "Qdrant":
to_close = []
if self.retrieval_type == "default":
knowledge_base = self.retriever.retriever.vectorstore
if knowledge_base.is_local():
to_close.append(knowledge_base)
if self.retrieval_type == "child_parent":
knowledge_base = self.retriever.retriever.parentstore
child_knowledge_base = self.retriever.retriever.vectorstore
if knowledge_base.is_local():
to_close.append(knowledge_base)
if child_knowledge_base.is_local():
to_close.append(child_knowledge_base)
for kb in to_close:
kb.client.close()

return prompt, links
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pypinyin
python-docx
python-multipart
pyyaml
qdrant-client==1.8.2
qdrant-client==1.9.0
rank_bm25
resampy==0.3.1
rouge_score
Expand Down

0 comments on commit 335edda

Please sign in to comment.