Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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'
|
| 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 |
-
|
| 167 |
-
"
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
state.tool_calls += 1
|
| 172 |
-
state.add(SystemMessage(content=f"CODE_TOOL_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 |
|