bielas194 commited on
Commit
c0f4098
Β·
verified Β·
1 Parent(s): 49fee4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -129,8 +129,7 @@ def run_agent_in_gradio(message, history):
129
  chat_history.append(AIMessage(content=ai_msg))
130
 
131
  try:
132
- # Pass agent_scratchpad as an empty list for each new turn
133
- # This addresses the ValueError for agent_scratchpad
134
  response = agent_executor.invoke(
135
  {"input": message, "chat_history": chat_history, "agent_scratchpad": []}
136
  )
@@ -147,9 +146,9 @@ def run_agent_in_gradio(message, history):
147
 
148
  except Exception as e:
149
  print(f"Error running agent: {e}")
150
- traceback.print_exc() # This line will now work correctly
151
  return f"❌ Agent encountered an error: {str(e)}"
152
-
153
  # Gradio ChatInterface setup
154
  demo = gr.ChatInterface(
155
  fn=run_agent_in_gradio,
 
129
  chat_history.append(AIMessage(content=ai_msg))
130
 
131
  try:
132
+ # THIS LINE IS CRUCIAL AND MUST INCLUDE "agent_scratchpad": []
 
133
  response = agent_executor.invoke(
134
  {"input": message, "chat_history": chat_history, "agent_scratchpad": []}
135
  )
 
146
 
147
  except Exception as e:
148
  print(f"Error running agent: {e}")
149
+ traceback.print_exc()
150
  return f"❌ Agent encountered an error: {str(e)}"
151
+
152
  # Gradio ChatInterface setup
153
  demo = gr.ChatInterface(
154
  fn=run_agent_in_gradio,