Spaces:
Running
Running
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
@@ -688,13 +688,13 @@ class NutritionBot:
|
|
688 |
|
689 |
# Build a context string from the relevant history
|
690 |
context = "Previous relevant interactions:\n"
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
|
696 |
# Print context for debugging purposes
|
697 |
-
|
698 |
|
699 |
# Prepare a prompt combining past context and the current query
|
700 |
prompt = f"""
|
@@ -702,6 +702,7 @@ class NutritionBot:
|
|
702 |
Current customer query: {query}
|
703 |
Provide a helpful response that takes into account any relevant past interactions.
|
704 |
"""
|
|
|
705 |
|
706 |
# Generate a response using the agent
|
707 |
response = self.agent_executor.invoke({"input": prompt})
|
|
|
688 |
|
689 |
# Build a context string from the relevant history
|
690 |
context = "Previous relevant interactions:\n"
|
691 |
+
for memory in relevant_history:
|
692 |
+
context += f"Customer: {memory['memory']}\n" # Customer's past messages
|
693 |
+
context += f"Support: {memory['memory']}\n" # Chatbot's past responses
|
694 |
+
context += "---\n"
|
695 |
|
696 |
# Print context for debugging purposes
|
697 |
+
st.write("Context: ", context)
|
698 |
|
699 |
# Prepare a prompt combining past context and the current query
|
700 |
prompt = f"""
|
|
|
702 |
Current customer query: {query}
|
703 |
Provide a helpful response that takes into account any relevant past interactions.
|
704 |
"""
|
705 |
+
st.write("prompt: ", prompt)
|
706 |
|
707 |
# Generate a response using the agent
|
708 |
response = self.agent_executor.invoke({"input": prompt})
|