Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1627,7 +1627,7 @@ prompt_template = ChatPromptTemplate.from_messages(
|
|
| 1627 |
|
| 1628 |
# Create Langchain Agent with specific model and temperature
|
| 1629 |
try:
|
| 1630 |
-
llm = ChatOpenAI(model="gpt-4o", temperature=0.
|
| 1631 |
llm_with_tools = llm.bind_tools(tools)
|
| 1632 |
except Exception as e:
|
| 1633 |
logger.error(f"Error creating Langchain Agent: {e}")
|
|
@@ -1727,12 +1727,9 @@ def chatbot_response(message, history):
|
|
| 1727 |
# Prepend the selected dataset to the response
|
| 1728 |
response = f"**Selected Dataset: {selected_dataset_ai}**\n\n{output['output']}"
|
| 1729 |
|
| 1730 |
-
|
| 1731 |
-
|
| 1732 |
-
|
| 1733 |
-
# Avoid duplication by ensuring that neither 'Trust Tip' nor 'Suggestion' appears in the response already
|
| 1734 |
-
if trust_tip_and_suggestion not in response:
|
| 1735 |
-
response += trust_tip_and_suggestion
|
| 1736 |
|
| 1737 |
# Save the interaction context
|
| 1738 |
chat_history.extend(
|
|
|
|
| 1627 |
|
| 1628 |
# Create Langchain Agent with specific model and temperature
|
| 1629 |
try:
|
| 1630 |
+
llm = ChatOpenAI(model="gpt-4o", temperature=0.5)
|
| 1631 |
llm_with_tools = llm.bind_tools(tools)
|
| 1632 |
except Exception as e:
|
| 1633 |
logger.error(f"Error creating Langchain Agent: {e}")
|
|
|
|
| 1727 |
# Prepend the selected dataset to the response
|
| 1728 |
response = f"**Selected Dataset: {selected_dataset_ai}**\n\n{output['output']}"
|
| 1729 |
|
| 1730 |
+
if not any(f"**Trust Tip**: {trust_tip}" in entry["bot"] and f"**Suggestion**: {suggestion}" in entry["bot"] for entry in chat_history):
|
| 1731 |
+
response += f"\n\n---\n\n**Trust Tip**: {trust_tip}\n\n**Suggestion**: {suggestion}"
|
| 1732 |
+
n
|
|
|
|
|
|
|
|
|
|
| 1733 |
|
| 1734 |
# Save the interaction context
|
| 1735 |
chat_history.extend(
|