From 3c29253ec52ac770f7ae8b6319c9c20c9d714051 Mon Sep 17 00:00:00 2001 From: flamx123 Date: Mon, 18 Nov 2024 15:08:58 +0800 Subject: [PATCH] fix law_chat_bot --- agentuniverse/agent/action/knowledge/store/chroma_store.py | 3 ++- agentuniverse/agent/action/knowledge/store/sqlite_store.py | 2 ++ sample_standard_app/app/core/rag_router/nlu_rag_router.yaml | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/agentuniverse/agent/action/knowledge/store/chroma_store.py b/agentuniverse/agent/action/knowledge/store/chroma_store.py index 084ee759..4f719a06 100644 --- a/agentuniverse/agent/action/knowledge/store/chroma_store.py +++ b/agentuniverse/agent/action/knowledge/store/chroma_store.py @@ -78,7 +78,8 @@ def query(self, query: Query, **kwargs) -> List[Document]: Returns: List[Document]: List of documents retrieved by the query. """ - + if self.collection is None: + self._new_client() embedding = query.embeddings if self.embedding_model is not None and len(embedding) == 0: embedding = EmbeddingManager().get_instance_obj( diff --git a/agentuniverse/agent/action/knowledge/store/sqlite_store.py b/agentuniverse/agent/action/knowledge/store/sqlite_store.py index a30a6d97..1413b0f6 100644 --- a/agentuniverse/agent/action/knowledge/store/sqlite_store.py +++ b/agentuniverse/agent/action/knowledge/store/sqlite_store.py @@ -178,6 +178,8 @@ def query(self, query: Query, **kwargs) -> List[Document]: # Get doc_id from inverted index. relevant_docs = set() inverted_index = {} + if not self.conn: + self._new_client() with self.conn: for keyword in query_terms: cursor = self.conn.cursor() diff --git a/sample_standard_app/app/core/rag_router/nlu_rag_router.yaml b/sample_standard_app/app/core/rag_router/nlu_rag_router.yaml index cb082e1d..0015a752 100644 --- a/sample_standard_app/app/core/rag_router/nlu_rag_router.yaml +++ b/sample_standard_app/app/core/rag_router/nlu_rag_router.yaml @@ -2,8 +2,8 @@ name: 'nlu_rag_router' description: 'base rag router map query to all store' store_amount: 2 llm: - name: demo_llm - model_name: gpt-4o + name: 'qwen_llm' + model_name: 'qwen-max' metadata: type: 'RAG_ROUTER' module: 'agentuniverse.agent.action.knowledge.rag_router.nlu_rag_router'