The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
fix(openai): construct responses api input (#32557)
sa41102261bc1bf9cc86
diff --git a/libs/partners/openai/langchain_openai/chat_models/base.py b/libs/partners/openai/langchain_openai/chat_models/base.pyindex 1783bd052f..082a167c97 100644--- a/libs/partners/openai/langchain_openai/chat_models/base.py+++ b/libs/partners/openai/langchain_openai/chat_models/base.py@@ -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": [],+ }+ ],})diff --git a/libs/partners/openai/tests/unit_tests/chat_models/test_base.py b/libs/partners/openai/tests/unit_tests/chat_models/test_base.pyindex 1d79f2a2d9..761f2c6f10 100644--- a/libs/partners/openai/tests/unit_tests/chat_models/test_base.py+++ b/libs/partners/openai/tests/unit_tests/chat_models/test_base.py@@ -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": [],}]