Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,7 +18,7 @@ from PyPDF2 import PdfReader
|
|
| 18 |
|
| 19 |
# Initialize the memory
|
| 20 |
|
| 21 |
-
memory = ConversationBufferMemory(return_messages=True, memory_key="chat_history")
|
| 22 |
|
| 23 |
|
| 24 |
|
|
@@ -135,15 +135,17 @@ For weather-related questions, if the user specifies a city, provide the weather
|
|
| 135 |
For document-related questions, search and retrieve information from the uploaded document.
|
| 136 |
{{agent_scratchpad}}
|
| 137 |
Question: {{input}}
|
| 138 |
-
{memory.buffer}
|
| 139 |
-
"""
|
| 140 |
|
|
|
|
|
|
|
| 141 |
prompt = ChatPromptTemplate.from_template(prompt_template)
|
| 142 |
|
| 143 |
# Initialize the agent with memory
|
| 144 |
-
llm_with_memory = llm.bind(memory=memory)
|
|
|
|
| 145 |
agent = create_tool_calling_agent(llm_with_memory, tools, prompt)
|
| 146 |
-
agent_executor = AgentExecutor(agent=agent, tools=tools,
|
|
|
|
| 147 |
|
| 148 |
# Define the interface function
|
| 149 |
max_iterations = 5
|
|
|
|
| 18 |
|
| 19 |
# Initialize the memory
|
| 20 |
|
| 21 |
+
#memory = ConversationBufferMemory(return_messages=True, memory_key="chat_history")
|
| 22 |
|
| 23 |
|
| 24 |
|
|
|
|
| 135 |
For document-related questions, search and retrieve information from the uploaded document.
|
| 136 |
{{agent_scratchpad}}
|
| 137 |
Question: {{input}}
|
|
|
|
|
|
|
| 138 |
|
| 139 |
+
"""
|
| 140 |
+
#{memory.buffer}
|
| 141 |
prompt = ChatPromptTemplate.from_template(prompt_template)
|
| 142 |
|
| 143 |
# Initialize the agent with memory
|
| 144 |
+
#llm_with_memory = llm.bind(memory=memory)
|
| 145 |
+
llm_with_memory = llm.bind()
|
| 146 |
agent = create_tool_calling_agent(llm_with_memory, tools, prompt)
|
| 147 |
+
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
|
| 148 |
+
#agent_executor = AgentExecutor(agent=agent, tools=tools, memory= memory, verbose=True)
|
| 149 |
|
| 150 |
# Define the interface function
|
| 151 |
max_iterations = 5
|