Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -91,12 +91,19 @@ agent_executor = AgentExecutor(
|
|
91 |
agent=agent,
|
92 |
tools=tools_add,
|
93 |
verbose=True,
|
|
|
|
|
94 |
)
|
95 |
|
96 |
def data_gov_ma(message, history):
|
97 |
try:
|
98 |
response = agent_executor.invoke({"input": message})
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
100 |
except ValueError as e:
|
101 |
return "Je suis désolé, je n'ai pas compris votre question.Pourriez-vous la reformuler s'il vous plaît ?"
|
102 |
|
|
|
91 |
agent=agent,
|
92 |
tools=tools_add,
|
93 |
verbose=True,
|
94 |
+
max_iterations = 10,
|
95 |
+
|
96 |
)
|
97 |
|
98 |
def data_gov_ma(message, history):
|
99 |
try:
|
100 |
response = agent_executor.invoke({"input": message})
|
101 |
+
final_response = response['output']
|
102 |
+
timeout_iteration_error = 'Agent stopped due to iteration limit or time limit.'
|
103 |
+
if final_response == timeout_iteration_error:
|
104 |
+
return "Je suis désolé, je n'ai pas compris votre question.Pourriez-vous la reformuler s'il vous plaît ?"
|
105 |
+
else:
|
106 |
+
return final_response
|
107 |
except ValueError as e:
|
108 |
return "Je suis désolé, je n'ai pas compris votre question.Pourriez-vous la reformuler s'il vous plaît ?"
|
109 |
|