bstraehle commited on
Commit
ca4d650
1 Parent(s): a906963

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -159,13 +159,13 @@ def wait_on_run(client, thread, run):
159
 
160
  return run
161
 
162
- def execute_tool_call(tool_call):
163
  name = tool_call.function.name
164
  args = json.loads(tool_call.function.arguments)
165
 
166
  print(f"{name}, {args}")
167
 
168
- #return tools[name](**args)
169
 
170
  def list_run_steps(client, thread, run):
171
  run_steps = client.beta.threads.runs.steps.list(
@@ -188,6 +188,7 @@ def list_run_steps(client, thread, run):
188
  #print("XXXXX")
189
 
190
  ###
 
191
  for tool in get_current_agent().tools:
192
  print("===")
193
  print(tool)
@@ -196,10 +197,10 @@ def list_run_steps(client, thread, run):
196
  print("===")
197
  ###
198
 
199
- #tools = {tool.__name__: tool for tool in get_current_agent().tools}
200
 
201
  for tool_call in step_details.tool_calls:
202
- result = execute_tool_call(tool_call)
203
 
204
  return run_steps
205
 
 
159
 
160
  return run
161
 
162
+ def execute_tool_call(tools, tool_call):
163
  name = tool_call.function.name
164
  args = json.loads(tool_call.function.arguments)
165
 
166
  print(f"{name}, {args}")
167
 
168
+ return tools[name](**args)
169
 
170
  def list_run_steps(client, thread, run):
171
  run_steps = client.beta.threads.runs.steps.list(
 
188
  #print("XXXXX")
189
 
190
  ###
191
+ tools = {}
192
  for tool in get_current_agent().tools:
193
  print("===")
194
  print(tool)
 
197
  print("===")
198
  ###
199
 
200
+ tools = {tool.function.__name__: tool.function for tool in get_current_agent().tools}
201
 
202
  for tool_call in step_details.tool_calls:
203
+ result = execute_tool_call(tools, tool_call)
204
 
205
  return run_steps
206