From f85526284811271abd7cb10a7c25fd5721d9fb48 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Sun, 15 Dec 2024 19:00:42 +0100 Subject: [PATCH] fix --- lollms/app.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lollms/app.py b/lollms/app.py index a02230f..4ae8304 100644 --- a/lollms/app.py +++ b/lollms/app.py @@ -1095,6 +1095,7 @@ class LollmsApplication(LoLLMsCom): "--- discussion --", f"{discussion[-2048:]}", "---", + "Make sure to write the RAG vector database query in your output json code." ]) template = """{ "query": "[the rag query deduced from the last messge in the discussion]" @@ -1104,8 +1105,12 @@ class LollmsApplication(LoLLMsCom): if query is None: query = current_message.content else: - query = json.loads(query) - query = query["query"] + try: + query = json.loads(query) + query = query["query"] + except Exception as ex: + ASCIIColors.error("failed to generate the query") + query = current_message.content self.personality.step_end("Building vector store query") ASCIIColors.magenta(f"Query: {query}") self.personality.step(f"Query: {query}")