From 58ab336aa33826ff77f2f7f0097c53f60c2bb021 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Tue, 3 Dec 2024 09:06:14 +0100 Subject: [PATCH] Update app.py --- lollms/app.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lollms/app.py b/lollms/app.py index 299d6c4..89da61e 100644 --- a/lollms/app.py +++ b/lollms/app.py @@ -907,6 +907,7 @@ class LollmsApplication(LoLLMsCom): Returns: Tuple[str, str, List[str]]: The prepared query, original message content, and tokenized query. """ + skills_detials=[] skills = [] documentation_entries = [] start_ai_header_id_template = self.config.start_ai_header_id_template @@ -1272,12 +1273,13 @@ The reformulation must be placed inside a json markdown tag like this: if self.config.debug: ASCIIColors.info(f"Query : {query}") skill_titles, skills, similarities = self.skills_library.query_vector_db(query, top_k=3, min_similarity=self.config.rag_min_correspondance)#query_entry_fts(query) - knowledge_infos={"titles":skill_titles,"contents":skills, "similarities":similarities} + skills_detials=[{"title": title, "content":content, "similarity":similarity} for title, content, similarity in zip(skill_titles, skills, similarities)] + if len(skills)>0: if knowledge=="": knowledge=f"{self.system_custom_header(knowledge)}\n" - for i,(title, content) in enumerate(zip(skill_titles,skills)): - knowledge += self.system_custom_header(f"knowledge {i}") +f"\ntitle:\n{title}\ncontent:\n{content}\n" + for i,skill in enumerate(skills_detials): + knowledge += self.system_custom_header(f"knowledge {i}") +f"\ntitle:\n{skill['title']}\ncontent:\n{skill['content']}\n" self.personality.step_end("Adding skills") self.personality.step_end("Querying skills library") except Exception as ex: @@ -1467,7 +1469,7 @@ The reformulation must be placed inside a json markdown tag like this: "ai_prefix":ai_prefix, "extra":"", "available_space":available_space, - "skills":[{"title": title, "content":content, "similarity":similarity} for title, content, similarity in zip(skill_titles, skills, similarities)], + "skills":skills_detials, "is_continue":is_continue, "previous_chunk":previous_chunk, "prompt":current_message.content