mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-24 12:00:52 +00:00
fix(openai): construct responses api input (#32557)
This commit is contained in:
parent
4ba222148d
commit
61bc1bf9cc
@ -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": [],
|
||||
}
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -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": [],
|
||||
}
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user