Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -476,6 +476,14 @@ def clean_response(response_text):
|
|
476 |
|
477 |
return cleaned_response
|
478 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
|
480 |
|
481 |
|
@@ -489,9 +497,20 @@ def generate_answer(message, choice, retrieval_mode, selected_model):
|
|
489 |
choice = None
|
490 |
retrieval_mode = None
|
491 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
try:
|
493 |
-
# Select the appropriate template based on the choice
|
494 |
-
if choice == "Details":
|
|
|
|
|
495 |
prompt_template = QA_CHAIN_PROMPT_1
|
496 |
elif choice == "Conversational":
|
497 |
prompt_template = QA_CHAIN_PROMPT_2
|
|
|
476 |
|
477 |
return cleaned_response
|
478 |
|
479 |
+
# Define a new template specifically for GPT-4o-mini in VDB Details mode
|
480 |
+
gpt4o_mini_template_details = f"""
|
481 |
+
As a highly specialized assistant, I provide precise, detailed, and informative responses. On this bright day of {current_date}, I'm equipped to assist with all your queries about Birmingham, Alabama, offering detailed insights tailored to your needs.
|
482 |
+
Given your request, here is the detailed information you're seeking:
|
483 |
+
{{context}}
|
484 |
+
Question: {{question}}
|
485 |
+
Detailed Answer:
|
486 |
+
"""
|
487 |
|
488 |
|
489 |
|
|
|
497 |
choice = None
|
498 |
retrieval_mode = None
|
499 |
|
500 |
+
# try:
|
501 |
+
# # Select the appropriate template based on the choice
|
502 |
+
# if choice == "Details":
|
503 |
+
# prompt_template = QA_CHAIN_PROMPT_1
|
504 |
+
# elif choice == "Conversational":
|
505 |
+
# prompt_template = QA_CHAIN_PROMPT_2
|
506 |
+
# else:
|
507 |
+
# prompt_template = QA_CHAIN_PROMPT_1 # Fallback to template1
|
508 |
+
|
509 |
try:
|
510 |
+
# Select the appropriate template based on the choice and model
|
511 |
+
if choice == "Details" and selected_model == chat_model1: # GPT-4o-mini
|
512 |
+
prompt_template = PromptTemplate(input_variables=["context", "question"], template=gpt4o_mini_template_details)
|
513 |
+
elif choice == "Details":
|
514 |
prompt_template = QA_CHAIN_PROMPT_1
|
515 |
elif choice == "Conversational":
|
516 |
prompt_template = QA_CHAIN_PROMPT_2
|