bstraehle commited on
Commit
56e4078
1 Parent(s): cb9ef1e

Update assistants.py

Browse files
Files changed (1) hide show
  1. assistants.py +5 -6
assistants.py CHANGED
@@ -168,12 +168,13 @@ def execute_tool_calls(run_steps):
168
  for tool_call in step_details.tool_calls:
169
  show_json("tool_call", tool_call)
170
 
171
- gr.Info(f"Tool call: {tool_call}")
172
-
173
  if hasattr(tool_call, "function"):
 
174
  tool_call_ids.append(tool_call.id)
175
  tool_call_results.append(execute_tool_call(tool_call))
176
-
 
 
177
  return tool_call_ids, tool_call_results
178
 
179
  def recurse_execute_tool_calls(thread, run, run_steps, iteration):
@@ -192,9 +193,7 @@ def recurse_execute_tool_calls(thread, run, run_steps, iteration):
192
  "tool_call_id": tool_call_ids[iteration],
193
  "output": tool_call_results[iteration]
194
  }
195
-
196
- gr.Info(f"Tool output: {tool_output}")
197
-
198
  # https://platform.openai.com/docs/api-reference/runs/submitToolOutputs
199
  run = openai_client.beta.threads.runs.submit_tool_outputs(
200
  thread_id=thread.id,
 
168
  for tool_call in step_details.tool_calls:
169
  show_json("tool_call", tool_call)
170
 
 
 
171
  if hasattr(tool_call, "function"):
172
+ gr.Info(f"Custom tool call: {type(tool_call)}: {tool_call.function.name}")
173
  tool_call_ids.append(tool_call.id)
174
  tool_call_results.append(execute_tool_call(tool_call))
175
+ else:
176
+ gr.Info(f"Built-in tool call: {type(tool_call)}")
177
+
178
  return tool_call_ids, tool_call_results
179
 
180
  def recurse_execute_tool_calls(thread, run, run_steps, iteration):
 
193
  "tool_call_id": tool_call_ids[iteration],
194
  "output": tool_call_results[iteration]
195
  }
196
+
 
 
197
  # https://platform.openai.com/docs/api-reference/runs/submitToolOutputs
198
  run = openai_client.beta.threads.runs.submit_tool_outputs(
199
  thread_id=thread.id,