Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -276,23 +276,25 @@ def chat(message, history, openai_api_key):
|
|
276 |
global client
|
277 |
|
278 |
assistant = get_current_agent()
|
279 |
-
|
280 |
-
thread = get_current_thread()
|
281 |
|
282 |
create_message(client, thread, message)
|
283 |
-
|
284 |
-
# async
|
285 |
run = create_run(client, assistant, thread)
|
286 |
run = wait_on_run(client, thread, run)
|
287 |
|
288 |
steps = list_steps(client, thread, run)
|
289 |
|
290 |
-
|
291 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
|
293 |
-
if len(message) > 0 :
|
294 |
-
create_message(client, thread, message[0])
|
295 |
-
|
296 |
messages = list_messages(client, thread)
|
297 |
|
298 |
content_values = extract_content_values(messages)
|
|
|
276 |
global client
|
277 |
|
278 |
assistant = get_current_agent()
|
279 |
+
thread = get_current_thread()
|
|
|
280 |
|
281 |
create_message(client, thread, message)
|
|
|
|
|
282 |
run = create_run(client, assistant, thread)
|
283 |
run = wait_on_run(client, thread, run)
|
284 |
|
285 |
steps = list_steps(client, thread, run)
|
286 |
|
287 |
+
results = execute_tool_calls(steps)
|
288 |
+
|
289 |
+
###
|
290 |
+
print("\n\n\n[" + results + "]\n\n\n")
|
291 |
+
|
292 |
+
if len(results) > 0 :
|
293 |
+
create_message(client, thread, results[0])
|
294 |
+
run = create_run(client, assistant, thread)
|
295 |
+
run = wait_on_run(client, thread, run)
|
296 |
+
###
|
297 |
|
|
|
|
|
|
|
298 |
messages = list_messages(client, thread)
|
299 |
|
300 |
content_values = extract_content_values(messages)
|