Skip to content

Commit 2817776

Browse files
Add "code interpreter tool call" message at top
1 parent bdbd817 commit 2817776

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

routers/chat.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,17 @@ async def handle_assistant_stream(
214214

215215
# Handle code interpreter tool calls
216216
elif tool_call.type == "code_interpreter":
217-
if tool_call.code_interpreter and tool_call.code_interpreter.input:
218-
yield sse_format(
219-
"toolDelta",
220-
wrap_for_oob_swap(step_id, str(tool_call.code_interpreter.input))
221-
)
217+
if tool_call.code_interpreter and tool_call.code_interpreter.input is not None:
218+
if tool_call.code_interpreter.input == "":
219+
yield sse_format(
220+
"toolDelta",
221+
wrap_for_oob_swap(step_id, "<em>Code Interpreter tool call</em><br>")
222+
)
223+
else:
224+
yield sse_format(
225+
"toolDelta",
226+
wrap_for_oob_swap(step_id, str(tool_call.code_interpreter.input))
227+
)
222228
if tool_call.code_interpreter and tool_call.code_interpreter.outputs:
223229
for output in tool_call.code_interpreter.outputs:
224230
if output.type == "logs" and output.logs:

0 commit comments

Comments
 (0)