Variables for rag_context and fallback algorithms added to Tenant and parts of the implementation.

This commit is contained in:
Josako
2024-06-13 15:23:35 +02:00
parent cbddaee810
commit b77e1ab321
6 changed files with 63 additions and 17 deletions

View File

@@ -67,6 +67,11 @@ def select_model_variables(tenant):
else:
model_variables['rag_tuning'] = False
if tenant.rag_context:
model_variables['rag_context'] = tenant.rag_context
else:
model_variables['rag_context'] = " "
# Set HTML Chunking Variables
model_variables['html_tags'] = tenant.html_tags
model_variables['html_end_tags'] = tenant.html_end_tags
@@ -98,6 +103,9 @@ def select_model_variables(tenant):
model_variables['llm'] = ChatOpenAI(api_key=api_key,
model=llm_model,
temperature=model_variables['RAG_temperature'])
model_variables['llm_no_rag'] = ChatOpenAI(api_key=api_key,
model=llm_model,
temperature=model_variables['no_RAG_temperature'])
tool_calling_supported = False
match llm_model:
case 'gpt-4-turbo' | 'gpt-4o':
@@ -132,3 +140,7 @@ def create_language_template(template, language):
language_template = template.replace('{language}', language)
return language_template
def replace_variable_in_template(template, variable, value):
return template.replace(variable, value)