mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-18 20:27:58 +00:00
sync
This commit is contained in:
parent
cb32fcb474
commit
8b4aac2a1b
@ -1,5 +1,5 @@
|
||||
# =================== Lord Of Large Language Multimodal Systems Configuration file ===========================
|
||||
version: 120
|
||||
version: 121
|
||||
binding_name: null
|
||||
model_name: null
|
||||
model_variant: null
|
||||
@ -251,6 +251,7 @@ rag_check_new_files_at_startup: false #if true, the vectorizer will automaticall
|
||||
rag_preprocess_chunks: false #if true, an LLM will preprocess the content of the chunk before writing it in a simple format
|
||||
rag_activate_multi_hops: false #if true, we use multi hops algorithm to do multiple researches until the AI has enough data
|
||||
rag_min_nb_tokens_in_chunk: 10 #this removed any useless junk ith less than x tokens
|
||||
rag_max_n_hops: 3 #We set the maximum number of hop in multi hops rag
|
||||
|
||||
activate_skills_lib: false # Activate vectorizing previous conversations
|
||||
skills_lib_database_name: "default" # Default skills database
|
||||
|
@ -1053,10 +1053,21 @@ class LollmsApplication(LoLLMsCom):
|
||||
f"{start_header_id_template}Documentation{end_header_id_template}"])
|
||||
documentation += f"{separator_template}"
|
||||
results = []
|
||||
for db in self.active_rag_dbs:
|
||||
v = db["vectorizer"]
|
||||
r=v.search(query)
|
||||
results+=r
|
||||
recovered_ids=[[]*len(self.active_rag_dbs)]
|
||||
i=0
|
||||
hop_id = 0
|
||||
while( len(results)<self.config.rag_n_chunks and hop_id<self.config.rag_max_n_hops):
|
||||
hop_id +=1
|
||||
for db in self.active_rag_dbs:
|
||||
v = db["vectorizer"]
|
||||
r=v.search(query, self.config.rag_n_chunks, recovered_ids[i])
|
||||
recovered_ids[i].append([rg.chunk_id for rg in r])
|
||||
if self.config.rag_activate_multi_hops:
|
||||
r = [rg for rg in r if self.personality.verify_rag_entry(query, rg.content)]
|
||||
results+=r
|
||||
i+=1
|
||||
if len(results)>=self.config.rag_n_chunks:
|
||||
break
|
||||
n_neighbors = self.active_rag_dbs[0]["vectorizer"].n_neighbors
|
||||
sorted_results = sorted(results, key=lambda x: x.distance)[:n_neighbors]
|
||||
|
||||
@ -1321,7 +1332,7 @@ class LollmsApplication(LoLLMsCom):
|
||||
"extra":""
|
||||
}
|
||||
if self.config.debug:
|
||||
ASCIIColors.hilight(documentation,"source_document_title", ASCIIColors.color_yellow, ASCIIColors.color_red, False)
|
||||
ASCIIColors.highlight(documentation,"source_document_title", ASCIIColors.color_yellow, ASCIIColors.color_red, False)
|
||||
# Return the prepared query, original message content, and tokenized query
|
||||
return prompt_data, current_message.content, tokens, context_details, internet_search_infos
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# =================== Lord Of Large Language Multimodal Systems Configuration file ===========================
|
||||
version: 120
|
||||
version: 121
|
||||
binding_name: null
|
||||
model_name: null
|
||||
model_variant: null
|
||||
@ -251,6 +251,7 @@ rag_check_new_files_at_startup: false #if true, the vectorizer will automaticall
|
||||
rag_preprocess_chunks: false #if true, an LLM will preprocess the content of the chunk before writing it in a simple format
|
||||
rag_activate_multi_hops: false #if true, we use multi hops algorithm to do multiple researches until the AI has enough data
|
||||
rag_min_nb_tokens_in_chunk: 10 #this removed any useless junk ith less than x tokens
|
||||
rag_max_n_hops: 3 #We set the maximum number of hop in multi hops rag
|
||||
|
||||
activate_skills_lib: false # Activate vectorizing previous conversations
|
||||
skills_lib_database_name: "default" # Default skills database
|
||||
|
@ -3798,10 +3798,14 @@ fetch('/open_file', {
|
||||
def compress_html(self, code):
|
||||
return compress_html(code)
|
||||
|
||||
|
||||
|
||||
|
||||
# ===========================================================
|
||||
def select_model(self, binding_name, model_name):
|
||||
self.personality.app.select_model(binding_name, model_name)
|
||||
|
||||
def verify_rag_entry(self, query, rag_entry):
|
||||
return self.yes_no("Does the text entry contain the answer to the query?", self.system_custom_header("Query")+query+"\n"+self.system_custom_header("text entry")+":\n"+rag_entry)
|
||||
# Properties ===============================================
|
||||
@property
|
||||
def start_header_id_template(self) -> str:
|
||||
|
@ -33,7 +33,9 @@ import shutil
|
||||
from tqdm import tqdm
|
||||
import threading
|
||||
|
||||
|
||||
def adjust_dimensions(value: int) -> int:
|
||||
"""Adjusts the given value to be divisible by 8."""
|
||||
return (value // 8) * 8
|
||||
|
||||
def download_file(url, folder_path, local_filename):
|
||||
# Make sure 'folder_path' exists
|
||||
@ -215,7 +217,8 @@ class LollmsDiffusers(LollmsTTI):
|
||||
sc = self.get_scheduler_by_name(sampler_name)
|
||||
if sc:
|
||||
self.model.scheduler = sc
|
||||
|
||||
width = adjust_dimensions(width)
|
||||
height = adjust_dimensions(height)
|
||||
if output_path is None:
|
||||
output_path = self.output_dir
|
||||
if seed!=-1:
|
||||
|
Loading…
Reference in New Issue
Block a user