josondev commited on
Commit
e6232e1
·
verified ·
1 Parent(s): a35ea13

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -28,12 +28,19 @@ class BasicAgent:
28
  if self.graph is None:
29
  return "Error: Agent not properly initialized"
30
 
31
- # Wrap the question in a HumanMessage from langchain_core
32
- messages = [HumanMessage(content=question)]
 
 
 
 
 
 
 
33
  config = {"configurable": {"thread_id": f"eval_{hash(question)}"}}
34
 
35
  try:
36
- result = self.graph.invoke({"messages": messages}, config)
37
 
38
  # Handle different response formats
39
  if isinstance(result, dict):
 
28
  if self.graph is None:
29
  return "Error: Agent not properly initialized"
30
 
31
+ # Create complete state structure that matches EnhancedAgentState
32
+ state = {
33
+ "messages": [HumanMessage(content=question)],
34
+ "query": question, # This was the critical missing field
35
+ "agent_type": "",
36
+ "final_answer": "",
37
+ "perf": {},
38
+ "agno_resp": ""
39
+ }
40
  config = {"configurable": {"thread_id": f"eval_{hash(question)}"}}
41
 
42
  try:
43
+ result = self.graph.invoke(state, config)
44
 
45
  # Handle different response formats
46
  if isinstance(result, dict):