naman1102 commited on
Commit
e312936
·
1 Parent(s): 28ad120

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -105,7 +105,7 @@ def tool_selector(state: AgentState) -> AgentState:
105
  " {'action':'audio'}\n"
106
  " {'action':'excel'}\n"
107
  " {'action':'code', 'snippet':'<python code>'}\n"
108
- " {'action':'code', 'file':'<name>.py'}\n"
109
  " {'action':'final'}\n"
110
 
111
 
@@ -163,13 +163,18 @@ def excel_tool(state: AgentState) -> AgentState:
163
  return state
164
 
165
  def code_tool(state: AgentState) -> AgentState:
166
- out = {"analysis": analyze_code_tool({
167
- "task_id": state.task_id,
168
- "snippet": state.snippet,
169
- "file": state.file
170
- })}
 
 
 
 
 
171
  state.tool_calls += 1
172
- state.add(SystemMessage(content=f"CODE_TOOL_OUT: {brief(out)}"))
173
  state.next_action = None
174
  return state
175
 
 
105
  " {'action':'audio'}\n"
106
  " {'action':'excel'}\n"
107
  " {'action':'code', 'snippet':'<python code>'}\n"
108
+ " {'action':'code'}\n"
109
  " {'action':'final'}\n"
110
 
111
 
 
163
  return state
164
 
165
  def code_tool(state: AgentState) -> AgentState:
166
+ if state.snippet:
167
+ out = {"analysis": analyze_code_tool({
168
+ "task_id": state.task_id,
169
+ "snippet": state.snippet,
170
+ })}
171
+ else:
172
+ out = {"analysis": analyze_code_tool({
173
+ "task_id": state.task_id,
174
+ "snippet": ""
175
+ })}
176
  state.tool_calls += 1
177
+ state.add(SystemMessage(content=f"CODE_TOOL_OUT: {out}"))
178
  state.next_action = None
179
  return state
180