bstraehle commited on
Commit
0150bec
1 Parent(s): ee9f7f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -244,6 +244,19 @@ def chat(message, history):
244
  run = wait_on_run(client, thread, run)
245
  run_steps = get_run_steps(client, thread, run)
246
  ###
 
 
 
 
 
 
 
 
 
 
 
 
 
247
 
248
  messages = get_messages(client, thread)
249
 
 
244
  run = wait_on_run(client, thread, run)
245
  run_steps = get_run_steps(client, thread, run)
246
  ###
247
+ tool_call_ids, tool_call_results = execute_tool_calls(run_steps)
248
+
249
+ if tool_call_ids[0]:
250
+ # https://platform.openai.com/docs/api-reference/runs/submitToolOutputs
251
+ run = client.beta.threads.runs.submit_tool_outputs(
252
+ thread_id=thread.id,
253
+ run_id=run.id,
254
+ tool_outputs=generate_tool_outputs(tool_call_ids, tool_call_results)
255
+ )
256
+
257
+ run = wait_on_run(client, thread, run)
258
+ run_steps = get_run_steps(client, thread, run)
259
+ ###
260
 
261
  messages = get_messages(client, thread)
262