Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -109,6 +109,19 @@ def get_run_steps(client, thread, run):
|
|
| 109 |
|
| 110 |
return run_steps
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
def get_run_step_details(run_steps):
|
| 113 |
run_step_details = []
|
| 114 |
|
|
@@ -118,6 +131,14 @@ def get_run_step_details(run_steps):
|
|
| 118 |
|
| 119 |
show_json("step_details", step_details)
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
return run_step_details
|
| 122 |
|
| 123 |
def get_messages(client, thread):
|
|
|
|
| 109 |
|
| 110 |
return run_steps
|
| 111 |
|
| 112 |
+
###
|
| 113 |
+
def execute_tool_call(tool_call):
|
| 114 |
+
name = tool_call.function.name
|
| 115 |
+
args = json.loads(tool_call.function.arguments)
|
| 116 |
+
|
| 117 |
+
print(f"name={name}")
|
| 118 |
+
print(f"args={args}")
|
| 119 |
+
|
| 120 |
+
#global tools
|
| 121 |
+
|
| 122 |
+
#return tools[name](**args)
|
| 123 |
+
###
|
| 124 |
+
|
| 125 |
def get_run_step_details(run_steps):
|
| 126 |
run_step_details = []
|
| 127 |
|
|
|
|
| 131 |
|
| 132 |
show_json("step_details", step_details)
|
| 133 |
|
| 134 |
+
###
|
| 135 |
+
if hasattr(step_details, "tool_calls"):
|
| 136 |
+
for tool_call in step_details.tool_calls:
|
| 137 |
+
result = execute_tool_call(tool_call)
|
| 138 |
+
|
| 139 |
+
show_json("tool_call", tool_call)
|
| 140 |
+
###
|
| 141 |
+
|
| 142 |
return run_step_details
|
| 143 |
|
| 144 |
def get_messages(client, thread):
|