Replies: 1 comment
-
🤖 Hello, From your code, it seems like you're trying to use the The In your code, you're creating the Here's how you can modify your code to update the memory: @app.route('/csvchat', methods=['GET', 'POST'])
def chat_box():
global agent,agent_chain,memory_x, file_uploaded, user_questions, ai_answers # Access global variables
if not file_uploaded:
return redirect(url_for('upload_file')) # Redirect to file upload if no file has been uploaded
if request.method == 'POST':
question = request.form['question']
response = agent_chain.run(input=question, language="English") # Use user input from the web page
user_questions.append(question)
ai_answers.append(response)
# Update the memory with the user's input and the agent's response
agent.memory.update(human_input=question, ai_output=response)
print(agent.memory) This should update the memory with the conversation history and allow the agent to generate responses based on the conversation history. I hope this helps! Let me know if you have any other questions. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
@dosu-bot hello i am building my web app chatbot using the Langchain CSV_AGENT but i have a problem here that i want to make the chatbot be conversational also so the agent could generate responses from the csv search and also from the chat history till now i want to make it locally so i dont handle the chat sessions or anything all i need is just whne i run the app there is a new chat history is created for the conversation and thats it so the agent have access to this conversation and the uploaded csv_file ----- trying doing this but the agent is only answering from the csv file but when i try to ask about anything conversationaly eg. i try to send a question of "hello my name is jhon how are you " and the next question i ask "what is my name" the agent answer me that its dont know this private data ----- here is the code of the flask app ------>>>>
Beta Was this translation helpful? Give feedback.
All reactions