naman1102 commited on
Commit
833b3b5
·
1 Parent(s): 4288fbd
Files changed (2) hide show
  1. app.py +3 -2
  2. state.py +1 -0
app.py CHANGED
@@ -27,7 +27,7 @@ llm = ChatOpenAI(model_name="gpt-4.1-mini", temperature=0.0)
27
 
28
  agent = create_react_agent(model=llm, tools=tool_node)
29
 
30
- def plan_node(state: AgentState, user_input: str) -> AgentState:
31
  """
32
  Decide which tool (if any) to call. Append the user_input to state["messages"] and
33
  return a partial AgentState that sets exactly one of:
@@ -167,7 +167,8 @@ def respond_to_input(user_input: str) -> str:
167
 
168
  # 3) Build the initial state so that "messages" contains both messages
169
  initial_state: AgentState = {
170
- "messages": [system_msg, human_msg]
 
171
  }
172
 
173
  # 4) Invoke the compiled graph (no second argument needed)
 
27
 
28
  agent = create_react_agent(model=llm, tools=tool_node)
29
 
30
+ def plan_node(state: AgentState) -> AgentState:
31
  """
32
  Decide which tool (if any) to call. Append the user_input to state["messages"] and
33
  return a partial AgentState that sets exactly one of:
 
167
 
168
  # 3) Build the initial state so that "messages" contains both messages
169
  initial_state: AgentState = {
170
+ "messages": [system_msg, human_msg],
171
+ "user_input": user_input
172
  }
173
 
174
  # 4) Invoke the compiled graph (no second argument needed)
state.py CHANGED
@@ -12,3 +12,4 @@ class AgentState(TypedDict, total=False):
12
  ocr_result: str
13
  excel_result: str
14
  final_answer: str
 
 
12
  ocr_result: str
13
  excel_result: str
14
  final_answer: str
15
+ user_input: str