fix: keep batch-path function_call_output.output as string per OpenAI spec
The streaming path emits output as content-part arrays for Open WebUI compatibility, but the batch (non-streaming) Responses API path must return output as a plain string per the OpenAI Responses API spec. Reverts the _extract_output_items change from the cherry-picked commits while preserving the streaming path's array format.
This commit is contained in:
parent
302554b158
commit
cf1d718823
@ -1949,15 +1949,10 @@ class APIServerAdapter(BasePlatformAdapter):
|
||||
"call_id": tc.get("id", ""),
|
||||
})
|
||||
elif role == "tool":
|
||||
output_content = msg.get("content", "")
|
||||
if isinstance(output_content, list):
|
||||
output = output_content
|
||||
else:
|
||||
output = [{"type": "input_text", "text": str(output_content)}]
|
||||
items.append({
|
||||
"type": "function_call_output",
|
||||
"call_id": msg.get("tool_call_id", ""),
|
||||
"output": output,
|
||||
"output": msg.get("content", ""),
|
||||
})
|
||||
|
||||
# Final assistant message
|
||||
|
||||
@ -1547,7 +1547,7 @@ class TestToolCallsInOutput:
|
||||
assert output[0]["call_id"] == "call_abc123"
|
||||
assert output[1]["type"] == "function_call_output"
|
||||
assert output[1]["call_id"] == "call_abc123"
|
||||
assert output[1]["output"] == [{"type": "input_text", "text": "42"}]
|
||||
assert output[1]["output"] == "42"
|
||||
assert output[2]["type"] == "message"
|
||||
assert output[2]["content"][0]["text"] == "The result is 42."
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user