Spaces:
Runtime error
Runtime error
Commit
·
a271076
1
Parent(s):
440ee82
refactor: rename ai_call, add comments
Browse files- wanderlust.py +3 -2
wanderlust.py
CHANGED
|
@@ -95,7 +95,8 @@ functions = {
|
|
| 95 |
}
|
| 96 |
|
| 97 |
|
| 98 |
-
def
|
|
|
|
| 99 |
function = tool_call.function
|
| 100 |
name = function.name
|
| 101 |
arguments = json.loads(function.arguments)
|
|
@@ -207,7 +208,7 @@ def ChatInterface():
|
|
| 207 |
if run.status == "requires_action":
|
| 208 |
tool_outputs = []
|
| 209 |
for tool_call in run.required_action.submit_tool_outputs.tool_calls:
|
| 210 |
-
tool_output =
|
| 211 |
tool_outputs.append(tool_output)
|
| 212 |
messages.set([*messages.value, tool_output])
|
| 213 |
openai.beta.threads.runs.submit_tool_outputs(
|
|
|
|
| 95 |
}
|
| 96 |
|
| 97 |
|
| 98 |
+
def assistant_tool_call(tool_call):
|
| 99 |
+
# actually executes the tool call the OpenAI assistant wants to perform
|
| 100 |
function = tool_call.function
|
| 101 |
name = function.name
|
| 102 |
arguments = json.loads(function.arguments)
|
|
|
|
| 208 |
if run.status == "requires_action":
|
| 209 |
tool_outputs = []
|
| 210 |
for tool_call in run.required_action.submit_tool_outputs.tool_calls:
|
| 211 |
+
tool_output = assistant_tool_call(tool_call)
|
| 212 |
tool_outputs.append(tool_output)
|
| 213 |
messages.set([*messages.value, tool_output])
|
| 214 |
openai.beta.threads.runs.submit_tool_outputs(
|