mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-03-01 04:06:07 +00:00
Update app.py
This commit is contained in:
parent
454e08d3be
commit
5d9968893c
@ -1000,12 +1000,14 @@ class LollmsApplication(LoLLMsCom):
|
|||||||
else:
|
else:
|
||||||
query = current_message.content
|
query = current_message.content
|
||||||
try:
|
try:
|
||||||
docs, sorted_similarities, document_ids = self.personality.persona_data_vectorizer.recover_text(query, top_k=int(self.config.data_vectorization_nb_chunks))
|
chunks:List[Chunk] = self.personality.persona_data_vectorizer.search(query, int(self.config.rag_n_chunks))
|
||||||
for doc, infos, doc_id in zip(docs, sorted_similarities, document_ids):
|
for chunk in chunks:
|
||||||
if self.config.data_vectorization_put_chunk_informations_into_context:
|
if self.config.data_vectorization_put_chunk_informations_into_context:
|
||||||
documentation += f"{self.start_header_id_template}document chunk{self.end_header_id_template}\nchunk_infos:{infos}\ncontent:{doc}\n"
|
documentation += f"{self.start_header_id_template}document chunk{self.end_header_id_template}\ndocument title: {chunk.doc.title}\nchunk content:\n{chunk.text}\n"
|
||||||
else:
|
else:
|
||||||
documentation += f"{self.start_header_id_template}chunk{self.end_header_id_template}\n{doc}\n"
|
documentation += f"{self.start_header_id_template}chunk{self.end_header_id_template}\n{chunk.text}\n"
|
||||||
|
|
||||||
|
documentation += f"{self.separator_template}{self.start_header_id_template}important information: Use the documentation data to answer the user questions. If the data is not present in the documentation, please tell the user that the information he is asking for does not exist in the documentation section. It is strictly forbidden to give the user an answer without having actual proof from the documentation.\n"
|
||||||
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
trace_exception(ex)
|
trace_exception(ex)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user