Using Agent #1393
-
Hi Team I am trying to code using agent to create an chatbot which can remember earlier questions (Conversational chatbot). But the agent is not remembering my earlier questions. Can you help me out? import os st.header("🤖 MIS ChatBot", divider = 'rainbow') sales_by_country = pd.DataFrame({ load_dotenv() if "chat_history" not in st.session_state: for message in st.session_state.chat_history: user_prompt = st.chat_input("Ask MIS Agent...") if user_prompt: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
To make the Agent remember earlier questions in your chatbot, you need to set the
By making these changes, your chatbot should be able to remember earlier questions and provide more contextually aware responses [1]. |
Beta Was this translation helpful? Give feedback.
To make the Agent remember earlier questions in your chatbot, you need to set the
memory_size
parameter when initializing theAgent
. This allows the agent to retain conversation history. Here's how you can modify your code:Set the
memory_size
Parameter:When creating the
Agent
instance, specify thememory_size
to a value greater than 1. This will enable the agent to remember previous interactions.Ensure Memory is Utilized:
The
memory_size
parameter controls how many past interactions the agent can remember. Adjust this value based on how much history you want the agent to retain.By making these changes, your chatbot should be able …