aparnavellala commited on
Commit
ff72119
·
verified ·
1 Parent(s): 70692d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -13
app.py CHANGED
@@ -174,17 +174,18 @@ def supervisor_chain(state):
174
  if next_action not in options:
175
  raise ValueError(f"Invalid next action: '{next_action}'. Expected one of {options}.")
176
 
177
- # Initialize intermediate_steps if not already present
178
- if "intermediate_steps" not in state:
179
- state["intermediate_steps"] = []
180
 
181
- # Append the supervisor decision to intermediate_steps
182
- state["intermediate_steps"].append(
183
- {"supervisor": "decision", "next_action": next_action}
184
- )
185
 
186
  print(f"[DEBUG] Next action decided: {next_action}") # Log decision
187
- return {"next": next_action, "messages": messages, "intermediate_steps": state["intermediate_steps"]}
 
188
 
189
  except Exception as e:
190
  print(f"[ERROR] Supervisor chain failed: {e}")
@@ -278,18 +279,18 @@ initial_state = {
278
  #HumanMessage(content="Code hello world and print it to the terminal.") # Correct format for user input
279
  HumanMessage(content="Write Code for printing \"hello world\" in Python. Keep it precise.") # Correct format for user input
280
  ]
281
- ,
282
- "intermediate_steps": [] # Add this to track progress if needed
283
  }
284
 
285
 
286
  # Properly formatted second test state
287
  second_test = {
288
  "messages": [
289
- HumanMessage(content="How is the weather in Sanfrancisco and Bangalore? Can you give research results") # Correct format for user input
290
  ]
291
- ,
292
- "intermediate_steps": [] # Add this to track progress if needed
293
  }
294
 
295
 
 
174
  if next_action not in options:
175
  raise ValueError(f"Invalid next action: '{next_action}'. Expected one of {options}.")
176
 
177
+ # # Initialize intermediate_steps if not already present
178
+ # if "intermediate_steps" not in state:
179
+ # state["intermediate_steps"] = []
180
 
181
+ # # Append the supervisor decision to intermediate_steps
182
+ # state["intermediate_steps"].append(
183
+ # {"supervisor": "decision", "next_action": next_action}
184
+ # )
185
 
186
  print(f"[DEBUG] Next action decided: {next_action}") # Log decision
187
+ return {"next": next_action, "messages": messages}
188
+ # return {"next": next_action, "messages": messages, "intermediate_steps": state["intermediate_steps"]}
189
 
190
  except Exception as e:
191
  print(f"[ERROR] Supervisor chain failed: {e}")
 
279
  #HumanMessage(content="Code hello world and print it to the terminal.") # Correct format for user input
280
  HumanMessage(content="Write Code for printing \"hello world\" in Python. Keep it precise.") # Correct format for user input
281
  ]
282
+ # ,
283
+ # "intermediate_steps": [] # Add this to track progress if needed
284
  }
285
 
286
 
287
  # Properly formatted second test state
288
  second_test = {
289
  "messages": [
290
+ HumanMessage(content="How is the weather in Sanfrancisco and Bangalore? Give research results") # Correct format for user input
291
  ]
292
+ # ,
293
+ # "intermediate_steps": [] # Add this to track progress if needed
294
  }
295
 
296