bstraehle commited on
Commit
1812acf
·
verified ·
1 Parent(s): 0741172

Update assistants.py

Browse files
Files changed (1) hide show
  1. assistants.py +2 -25
assistants.py CHANGED
@@ -172,30 +172,7 @@ def extract_content_values(data):
172
 
173
  return text_values, image_values
174
 
175
- ###
176
- def generate_tool_outputs(tool_call_ids, tool_call_results):
177
- tool_outputs = []
178
-
179
- for tool_call_id, tool_call_result in zip(tool_call_ids, tool_call_results):
180
- tool_output = {}
181
-
182
- try:
183
- tool_output = {
184
- "tool_call_id": tool_call_id,
185
- "output": tool_call_result.to_json()
186
- }
187
- except AttributeError:
188
- tool_output = {
189
- "tool_call_id": tool_call_id,
190
- "output": tool_call_result
191
- }
192
-
193
- tool_outputs.append(tool_output)
194
-
195
- return tool_outputs
196
- ###
197
-
198
- def todo(thread, run, run_steps, iteration):
199
  tool_call_ids, tool_call_results = execute_tool_calls(run_steps)
200
 
201
  if len(tool_call_ids) > 0:
@@ -222,4 +199,4 @@ def todo(thread, run, run_steps, iteration):
222
  run = wait_on_run(openai_client, thread, run)
223
  run_steps = get_run_steps(openai_client, thread, run)
224
 
225
- todo(thread, run, run_steps, iteration + 1)
 
172
 
173
  return text_values, image_values
174
 
175
+ def recurse_execute_tool_calls(thread, run, run_steps, iteration):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  tool_call_ids, tool_call_results = execute_tool_calls(run_steps)
177
 
178
  if len(tool_call_ids) > 0:
 
199
  run = wait_on_run(openai_client, thread, run)
200
  run_steps = get_run_steps(openai_client, thread, run)
201
 
202
+ recurse_execute_tool_calls(thread, run, run_steps, iteration + 1)