fix(openai): construct responses api input (#32557)

This commit is contained in:
sa411022 2025-08-22 03:56:29 +08:00 committed by GitHub
parent 4ba222148d
commit 61bc1bf9cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View File

@ -3749,7 +3749,13 @@ def _construct_responses_api_input(messages: Sequence[BaseMessage]) -> list:
{
"type": "message",
"role": "assistant",
"content": [{"type": "output_text", "text": msg["content"]}],
"content": [
{
"type": "output_text",
"text": msg["content"],
"annotations": [],
}
],
}
)

View File

@ -2153,7 +2153,11 @@ def test__construct_responses_api_input_ai_message_with_tool_calls_and_content()
assert result[0]["role"] == "assistant"
assert result[0]["content"] == [
{"type": "output_text", "text": "I'll check the weather for you."}
{
"type": "output_text",
"text": "I'll check the weather for you.",
"annotations": [],
}
]
assert result[1]["type"] == "function_call"
@ -2255,6 +2259,7 @@ def test__construct_responses_api_input_multiple_message_types() -> None:
{
"type": "output_text",
"text": "The weather in San Francisco is 72°F and sunny.",
"annotations": [],
}
]