Spaces:
Runtime error
Runtime error
lakshmivairamani
commited on
Commit
•
4687add
1
Parent(s):
1c3687e
Update app.py
Browse files
app.py
CHANGED
@@ -136,18 +136,18 @@ For document-related questions, search and retrieve information from the uploade
|
|
136 |
For SQL database-related questions, only use the fields available in the collegedb schema, which includes tables such as buildings, classrooms, college, course, faculty, interns, person, section, student, and textbook.
|
137 |
{{agent_scratchpad}}
|
138 |
Question: {{input}}
|
139 |
-
|
140 |
"""
|
141 |
|
142 |
-
|
143 |
prompt = ChatPromptTemplate.from_template(prompt_template)
|
144 |
|
145 |
# Initialize the agent with memory
|
146 |
-
|
147 |
-
llm_with_memory = llm.bind()
|
148 |
agent = create_tool_calling_agent(llm_with_memory, tools, prompt)
|
149 |
-
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
|
150 |
-
|
151 |
|
152 |
# Define the interface function
|
153 |
max_iterations = 5
|
@@ -171,9 +171,9 @@ def answer_question(user_question, city="United Arab Emirates"):
|
|
171 |
return "The agent could not generate a valid response within the iteration limit."
|
172 |
|
173 |
# Print memory buffer for debugging
|
174 |
-
|
175 |
# Print memory buffer for debugging
|
176 |
-
|
177 |
|
178 |
|
179 |
# Format the response text
|
|
|
136 |
For SQL database-related questions, only use the fields available in the collegedb schema, which includes tables such as buildings, classrooms, college, course, faculty, interns, person, section, student, and textbook.
|
137 |
{{agent_scratchpad}}
|
138 |
Question: {{input}}
|
139 |
+
{memory.buffer}
|
140 |
"""
|
141 |
|
142 |
+
|
143 |
prompt = ChatPromptTemplate.from_template(prompt_template)
|
144 |
|
145 |
# Initialize the agent with memory
|
146 |
+
llm_with_memory = llm.bind(memory=memory)
|
147 |
+
#llm_with_memory = llm.bind()
|
148 |
agent = create_tool_calling_agent(llm_with_memory, tools, prompt)
|
149 |
+
#agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
|
150 |
+
agent_executor = AgentExecutor(agent=agent, tools=tools, memory= memory, verbose=True)
|
151 |
|
152 |
# Define the interface function
|
153 |
max_iterations = 5
|
|
|
171 |
return "The agent could not generate a valid response within the iteration limit."
|
172 |
|
173 |
# Print memory buffer for debugging
|
174 |
+
print("Memory Buffer:", memory.buffer)
|
175 |
# Print memory buffer for debugging
|
176 |
+
print("Memory Buffer11:", memory.load_memory_variables({}))
|
177 |
|
178 |
|
179 |
# Format the response text
|