Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-langchain-openai for
openSUSE:Factory checked in at 2026-08-09 21:44:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-langchain-openai (Old)
and /work/SRC/openSUSE:Factory/.python-langchain-openai.new.16738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-langchain-openai"
Sun Aug 9 21:44:02 2026 rev:6 rq:1370300 version:1.4.2
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-langchain-openai/python-langchain-openai.changes
2026-07-26 11:32:39.047346139 +0200
+++
/work/SRC/openSUSE:Factory/.python-langchain-openai.new.16738/python-langchain-openai.changes
2026-08-09 21:46:05.468271202 +0200
@@ -1,0 +2,12 @@
+Sat Aug 8 04:38:01 UTC 2026 - Martin Pluskal <[email protected]>
+
+- Update to 1.4.2:
+ * Handle ContextWindowExceededError
+ * Filter langchain-generated content block IDs
+ * Preserve Responses text options
+ * Redact the MCP authorization header
+ * Refresh the bundled model profile data
+- Follow upstream and raise the langchain-core requirement floor to
+ 1.5.3
+
+-------------------------------------------------------------------
Old:
----
langchain_openai-1.4.1.tar.gz
New:
----
langchain_openai-1.4.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-langchain-openai.spec ++++++
--- /var/tmp/diff_new_pack.sQa17L/_old 2026-08-09 21:46:05.964288132 +0200
+++ /var/tmp/diff_new_pack.sQa17L/_new 2026-08-09 21:46:05.972288406 +0200
@@ -17,7 +17,7 @@
Name: python-langchain-openai
-Version: 1.4.1
+Version: 1.4.2
Release: 0
Summary: An integration package connecting OpenAI and LangChain
License: MIT
@@ -27,13 +27,13 @@
BuildRequires: %{python_module pip}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
-Requires: python-langchain-core >= 1.5.1
+Requires: python-langchain-core >= 1.5.3
Requires: python-openai >= 2.45.0
Requires: python-tiktoken >= 0.7.0
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module httpx}
-BuildRequires: %{python_module langchain-core >= 1.5.0}
+BuildRequires: %{python_module langchain-core >= 1.5.3}
BuildRequires: %{python_module openai >= 2.45.0}
BuildRequires: %{python_module pytest-asyncio}
BuildRequires: %{python_module tiktoken >= 0.7.0}
++++++ langchain_openai-1.4.1.tar.gz -> langchain_openai-1.4.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/langchain_openai-1.4.1/PKG-INFO
new/langchain_openai-1.4.2/PKG-INFO
--- old/langchain_openai-1.4.1/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
+++ new/langchain_openai-1.4.2/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: langchain-openai
-Version: 1.4.1
+Version: 1.4.2
Summary: An integration package connecting OpenAI and LangChain
Project-URL: Homepage,
https://docs.langchain.com/oss/python/integrations/providers/openai
Project-URL: Documentation,
https://reference.langchain.com/python/integrations/langchain_openai/
@@ -23,7 +23,7 @@
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: <4.0.0,>=3.10.0
-Requires-Dist: langchain-core<2.0.0,>=1.5.1
+Requires-Dist: langchain-core<2.0.0,>=1.5.3
Requires-Dist: openai<3.0.0,>=2.45.0
Requires-Dist: tiktoken<1.0.0,>=0.7.0
Description-Content-Type: text/markdown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/langchain_openai-1.4.1/langchain_openai/_version.py
new/langchain_openai-1.4.2/langchain_openai/_version.py
--- old/langchain_openai-1.4.1/langchain_openai/_version.py 2020-02-02
01:00:00.000000000 +0100
+++ new/langchain_openai-1.4.2/langchain_openai/_version.py 2020-02-02
01:00:00.000000000 +0100
@@ -1,3 +1,3 @@
"""Version information for `langchain-openai`."""
-__version__ = "1.4.1"
+__version__ = "1.4.2"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/langchain_openai-1.4.1/langchain_openai/chat_models/base.py
new/langchain_openai-1.4.2/langchain_openai/chat_models/base.py
--- old/langchain_openai-1.4.1/langchain_openai/chat_models/base.py
2020-02-02 01:00:00.000000000 +0100
+++ new/langchain_openai-1.4.2/langchain_openai/chat_models/base.py
2020-02-02 01:00:00.000000000 +0100
@@ -118,7 +118,7 @@
TypeBaseModel,
is_basemodel_subclass,
)
-from langchain_core.utils.utils import _build_model_kwargs, from_env
+from langchain_core.utils.utils import LC_AUTO_PREFIX, _build_model_kwargs,
from_env
from pydantic import (
BaseModel,
ConfigDict,
@@ -564,6 +564,7 @@
"context_length_exceeded" in str(e)
or "Input tokens exceed the configured limit" in e.message
or "prompt is too long" in e.message
+ or "ContextWindowExceededError" in e.message
):
raise OpenAIContextOverflowError(
message=e.message, response=e.response, body=e.body
@@ -2045,10 +2046,18 @@
**self._default_params,
**kwargs,
}
- # Redact headers from built-in remote MCP tool invocations
+ # Redact credentials from built-in remote MCP tool invocations
if (tools := params.get("tools")) and isinstance(tools, list):
+ sensitive_fields = ("headers", "authorization")
params["tools"] = [
- ({**tool, "headers": "**REDACTED**"} if "headers" in tool else
tool)
+ {
+ **tool,
+ **{
+ field: "**REDACTED**"
+ for field in sensitive_fields
+ if field in tool
+ },
+ }
if isinstance(tool, dict) and tool.get("type") == "mcp"
else tool
for tool in tools
@@ -4349,6 +4358,9 @@
else:
payload["tool_choice"] = tool_choice
+ if isinstance(payload.get("text"), dict):
+ payload["text"] = payload["text"].copy()
+
# Structured output
if schema := payload.pop("response_format", None):
# For pydantic + non-streaming case, we use responses.parse.
@@ -4659,7 +4671,14 @@
"content": [new_block],
"role": "assistant",
}
- if store is not False:
+ if (
+ store is not False
+ and msg_id
+ and not msg_id.startswith(LC_AUTO_PREFIX)
+ ):
+ # LangChain-auto-generated (`lc_`) IDs are
not
+ # provider-issued; the Responses API
rejects
+ # them (expects `msg_...`), so don't
forward.
new_item["id"] = msg_id
if phase is not None:
new_item["phase"] = phase
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/langchain_openai-1.4.1/langchain_openai/data/_profiles.py
new/langchain_openai-1.4.2/langchain_openai/data/_profiles.py
--- old/langchain_openai-1.4.1/langchain_openai/data/_profiles.py
2020-02-02 01:00:00.000000000 +0100
+++ new/langchain_openai-1.4.2/langchain_openai/data/_profiles.py
2020-02-02 01:00:00.000000000 +0100
@@ -44,6 +44,7 @@
},
"gpt-3.5-turbo": {
"name": "GPT-3.5-turbo",
+ "status": "deprecated",
"release_date": "2023-03-01",
"last_updated": "2023-11-06",
"open_weights": False,
@@ -71,6 +72,7 @@
},
"gpt-4": {
"name": "GPT-4",
+ "status": "deprecated",
"release_date": "2023-11-06",
"last_updated": "2024-04-09",
"open_weights": False,
@@ -98,6 +100,7 @@
},
"gpt-4-turbo": {
"name": "GPT-4 Turbo",
+ "status": "deprecated",
"release_date": "2023-11-06",
"last_updated": "2024-04-09",
"open_weights": False,
@@ -179,6 +182,7 @@
},
"gpt-4.1-nano": {
"name": "GPT-4.1 nano",
+ "status": "deprecated",
"release_date": "2025-04-14",
"last_updated": "2025-04-14",
"open_weights": False,
@@ -233,6 +237,7 @@
},
"gpt-4o-2024-05-13": {
"name": "GPT-4o (2024-05-13)",
+ "status": "deprecated",
"release_date": "2024-05-13",
"last_updated": "2024-05-13",
"open_weights": False,
@@ -374,31 +379,13 @@
],
},
"gpt-5-chat-latest": {
- "name": "GPT-5 Chat (latest)",
- "release_date": "2025-08-07",
- "last_updated": "2025-08-07",
- "open_weights": False,
- "max_input_tokens": 272000,
- "max_output_tokens": 128000,
- "text_inputs": True,
- "image_inputs": True,
- "audio_inputs": False,
- "video_inputs": False,
- "text_outputs": True,
- "image_outputs": False,
- "audio_outputs": False,
- "video_outputs": False,
- "reasoning_output": True,
- "tool_calling": False,
- "structured_output": True,
- "attachment": True,
- "temperature": True,
"image_url_inputs": True,
"pdf_inputs": True,
"pdf_tool_message": True,
"image_tool_message": True,
"tool_choice": True,
"tool_call_streaming": True,
+ "max_input_tokens": 272000,
"reasoning_effort_levels": [
"none",
"low",
@@ -408,31 +395,13 @@
],
},
"gpt-5-codex": {
- "name": "GPT-5-Codex",
- "release_date": "2025-09-15",
- "last_updated": "2025-09-15",
- "open_weights": False,
- "max_input_tokens": 272000,
- "max_output_tokens": 128000,
- "text_inputs": True,
- "image_inputs": True,
- "audio_inputs": False,
- "video_inputs": False,
- "text_outputs": True,
- "image_outputs": False,
- "audio_outputs": False,
- "video_outputs": False,
- "reasoning_output": True,
- "tool_calling": True,
- "structured_output": True,
- "attachment": False,
- "temperature": False,
"image_url_inputs": True,
"pdf_inputs": True,
"pdf_tool_message": True,
"image_tool_message": True,
"tool_choice": True,
"tool_call_streaming": True,
+ "max_input_tokens": 272000,
"reasoning_effort_levels": [
"none",
"low",
@@ -578,31 +547,13 @@
],
},
"gpt-5.1-chat-latest": {
- "name": "GPT-5.1 Chat",
- "release_date": "2025-11-13",
- "last_updated": "2025-11-13",
- "open_weights": False,
- "max_input_tokens": 272000,
- "max_output_tokens": 16384,
- "text_inputs": True,
- "image_inputs": True,
- "audio_inputs": False,
- "video_inputs": False,
- "text_outputs": True,
- "image_outputs": False,
- "audio_outputs": False,
- "video_outputs": False,
- "reasoning_output": True,
- "tool_calling": True,
- "structured_output": True,
- "attachment": True,
- "temperature": False,
"image_url_inputs": True,
"pdf_inputs": True,
"pdf_tool_message": True,
"image_tool_message": True,
"tool_choice": True,
"tool_call_streaming": True,
+ "max_input_tokens": 272000,
"reasoning_effort_levels": [
"none",
"low",
@@ -612,31 +563,13 @@
],
},
"gpt-5.1-codex": {
- "name": "GPT-5.1 Codex",
- "release_date": "2025-11-13",
- "last_updated": "2025-11-13",
- "open_weights": False,
- "max_input_tokens": 272000,
- "max_output_tokens": 128000,
- "text_inputs": True,
- "image_inputs": True,
- "audio_inputs": False,
- "video_inputs": False,
- "text_outputs": True,
- "image_outputs": False,
- "audio_outputs": False,
- "video_outputs": False,
- "reasoning_output": True,
- "tool_calling": True,
- "structured_output": True,
- "attachment": True,
- "temperature": False,
"image_url_inputs": True,
"pdf_inputs": True,
"pdf_tool_message": True,
"image_tool_message": True,
"tool_choice": True,
"tool_call_streaming": True,
+ "max_input_tokens": 272000,
"reasoning_effort_levels": [
"none",
"low",
@@ -646,31 +579,13 @@
],
},
"gpt-5.1-codex-max": {
- "name": "GPT-5.1 Codex Max",
- "release_date": "2025-11-13",
- "last_updated": "2025-11-13",
- "open_weights": False,
- "max_input_tokens": 272000,
- "max_output_tokens": 128000,
- "text_inputs": True,
- "image_inputs": True,
- "audio_inputs": False,
- "video_inputs": False,
- "text_outputs": True,
- "image_outputs": False,
- "audio_outputs": False,
- "video_outputs": False,
- "reasoning_output": True,
- "tool_calling": True,
- "structured_output": True,
- "attachment": True,
- "temperature": False,
"image_url_inputs": True,
"pdf_inputs": True,
"pdf_tool_message": True,
"image_tool_message": True,
"tool_choice": True,
"tool_call_streaming": True,
+ "max_input_tokens": 272000,
"reasoning_effort_levels": [
"none",
"low",
@@ -680,31 +595,13 @@
],
},
"gpt-5.1-codex-mini": {
- "name": "GPT-5.1 Codex mini",
- "release_date": "2025-11-13",
- "last_updated": "2025-11-13",
- "open_weights": False,
- "max_input_tokens": 272000,
- "max_output_tokens": 128000,
- "text_inputs": True,
- "image_inputs": True,
- "audio_inputs": False,
- "video_inputs": False,
- "text_outputs": True,
- "image_outputs": False,
- "audio_outputs": False,
- "video_outputs": False,
- "reasoning_output": True,
- "tool_calling": True,
- "structured_output": True,
- "attachment": True,
- "temperature": False,
"image_url_inputs": True,
"pdf_inputs": True,
"pdf_tool_message": True,
"image_tool_message": True,
"tool_choice": True,
"tool_call_streaming": True,
+ "max_input_tokens": 272000,
"reasoning_effort_levels": [
"none",
"low",
@@ -782,27 +679,8 @@
],
},
"gpt-5.2-codex": {
- "name": "GPT-5.2 Codex",
- "release_date": "2025-12-11",
- "last_updated": "2025-12-11",
- "open_weights": False,
- "max_input_tokens": 400000,
- "max_output_tokens": 128000,
- "text_inputs": True,
- "image_inputs": True,
- "audio_inputs": False,
- "pdf_inputs": True,
- "video_inputs": False,
- "text_outputs": True,
- "image_outputs": False,
- "audio_outputs": False,
- "video_outputs": False,
- "reasoning_output": True,
- "tool_calling": True,
- "structured_output": True,
- "attachment": True,
- "temperature": False,
"image_url_inputs": True,
+ "pdf_inputs": True,
"pdf_tool_message": True,
"image_tool_message": True,
"tool_choice": True,
@@ -1296,6 +1174,7 @@
},
"gpt-image-1": {
"name": "gpt-image-1",
+ "status": "deprecated",
"release_date": "2025-04-24",
"last_updated": "2025-04-24",
"open_weights": False,
@@ -1427,6 +1306,7 @@
},
"o1": {
"name": "o1",
+ "status": "deprecated",
"release_date": "2024-12-05",
"last_updated": "2024-12-05",
"open_weights": False,
@@ -1454,6 +1334,7 @@
},
"o1-pro": {
"name": "o1-pro",
+ "status": "deprecated",
"release_date": "2025-03-19",
"last_updated": "2025-03-19",
"open_weights": False,
@@ -1506,34 +1387,9 @@
"tool_choice": True,
"tool_call_streaming": True,
},
- "o3-deep-research": {
- "name": "o3-deep-research",
- "release_date": "2024-06-26",
- "last_updated": "2024-06-26",
- "open_weights": False,
- "max_input_tokens": 200000,
- "max_output_tokens": 100000,
- "text_inputs": True,
- "image_inputs": True,
- "audio_inputs": False,
- "video_inputs": False,
- "text_outputs": True,
- "image_outputs": False,
- "audio_outputs": False,
- "video_outputs": False,
- "reasoning_output": True,
- "tool_calling": True,
- "attachment": True,
- "temperature": False,
- "image_url_inputs": True,
- "pdf_inputs": True,
- "pdf_tool_message": True,
- "image_tool_message": True,
- "tool_choice": True,
- "tool_call_streaming": True,
- },
"o3-mini": {
"name": "o3-mini",
+ "status": "deprecated",
"release_date": "2024-12-20",
"last_updated": "2025-01-29",
"open_weights": False,
@@ -1588,6 +1444,7 @@
},
"o4-mini": {
"name": "o4-mini",
+ "status": "deprecated",
"release_date": "2025-04-16",
"last_updated": "2025-04-16",
"open_weights": False,
@@ -1607,32 +1464,6 @@
"attachment": True,
"temperature": False,
"image_url_inputs": True,
- "pdf_inputs": True,
- "pdf_tool_message": True,
- "image_tool_message": True,
- "tool_choice": True,
- "tool_call_streaming": True,
- },
- "o4-mini-deep-research": {
- "name": "o4-mini-deep-research",
- "release_date": "2024-06-26",
- "last_updated": "2024-06-26",
- "open_weights": False,
- "max_input_tokens": 200000,
- "max_output_tokens": 100000,
- "text_inputs": True,
- "image_inputs": True,
- "audio_inputs": False,
- "video_inputs": False,
- "text_outputs": True,
- "image_outputs": False,
- "audio_outputs": False,
- "video_outputs": False,
- "reasoning_output": True,
- "tool_calling": True,
- "attachment": True,
- "temperature": False,
- "image_url_inputs": True,
"pdf_inputs": True,
"pdf_tool_message": True,
"image_tool_message": True,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/langchain_openai-1.4.1/pyproject.toml
new/langchain_openai-1.4.2/pyproject.toml
--- old/langchain_openai-1.4.1/pyproject.toml 2020-02-02 01:00:00.000000000
+0100
+++ new/langchain_openai-1.4.2/pyproject.toml 2020-02-02 01:00:00.000000000
+0100
@@ -20,10 +20,10 @@
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
-version = "1.4.1"
+version = "1.4.2"
requires-python = ">=3.10.0,<4.0.0"
dependencies = [
- "langchain-core>=1.5.1,<2.0.0",
+ "langchain-core>=1.5.3,<2.0.0",
"openai>=2.45.0,<3.0.0",
"tiktoken>=0.7.0,<1.0.0",
]
@@ -56,7 +56,7 @@
"langchain>=1.0.0,<2.0.0",
"langchain-tests>=1.1.9,<2.0.0",
]
-lint = ["ruff>=0.13.1,<0.16.0"]
+lint = ["ruff>=0.13.1,<0.17.0"]
dev = []
test_integration = [
"httpx>=0.27.0,<1.0.0",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/langchain_openai-1.4.1/tests/unit_tests/chat_models/test_base.py
new/langchain_openai-1.4.2/tests/unit_tests/chat_models/test_base.py
--- old/langchain_openai-1.4.1/tests/unit_tests/chat_models/test_base.py
2020-02-02 01:00:00.000000000 +0100
+++ new/langchain_openai-1.4.2/tests/unit_tests/chat_models/test_base.py
2020-02-02 01:00:00.000000000 +0100
@@ -1825,6 +1825,22 @@
assert payload["text"]["verbosity"] == "high"
+def test_responses_payload_does_not_mutate_text_model_kwargs() -> None:
+ text = {"verbosity": "low"}
+ llm = ChatOpenAI(
+ model="gpt-5",
+ api_key=SecretStr("test"),
+ use_responses_api=True,
+ model_kwargs={"text": text},
+ )
+
+ payload = llm._get_request_payload("hello", response_format={"type":
"json_object"})
+
+ assert payload["text"]["format"] == {"type": "json_object"}
+ assert text == {"verbosity": "low"}
+ assert llm._get_request_payload("hello")["text"] == {"verbosity": "low"}
+
+
def test_structured_output_legacy_model() -> None:
class Output(TypedDict):
"""output."""
@@ -2969,6 +2985,34 @@
}
+def test_responses_api_payload_drops_lc_auto_ids() -> None:
+ """LangChain-auto-generated (`lc_`) IDs must not be forwarded to OpenAI.
+
+ The Responses API validates provider-issued message IDs (expects
`msg_...`),
+ so synthetic AI messages built from `create_text_block` (which assigns an
+ `lc_`-prefixed ID) previously triggered a 400. See issue #39113.
+ """
+ text_block = types.create_text_block("The capital of France is Paris.")
+ assert text_block["id"].startswith("lc_")
+
+ llm = ChatOpenAI(model=OPENAI_TEST_MODEL, use_responses_api=True)
+ payload =
llm._get_request_payload([AIMessage(content_blocks=[text_block])])
+
+ input_ = payload["input"]
+ assert len(input_) == 1
+ assert input_[0]["type"] == "message"
+ assert input_[0]["role"] == "assistant"
+ # The `lc_` ID is dropped rather than forwarded to OpenAI.
+ assert "id" not in input_[0]
+ assert input_[0]["content"] == [
+ {
+ "type": "output_text",
+ "text": "The capital of France is Paris.",
+ "annotations": [],
+ }
+ ]
+
+
def
test__construct_responses_api_input_human_message_with_image_url_conversion()
-> (
None
):
@@ -3447,25 +3491,31 @@
"server_label": "deepwiki",
"server_url": "https://mcp.deepwiki.com/mcp",
"require_approval": "always",
- "headers": {"Authorization": "Bearer PLACEHOLDER"},
+ "headers": {"Authorization": "Bearer HEADER_SECRET"},
+ "authorization": "Bearer AUTHORIZATION_SECRET",
}
]
with patch.object(llm, "root_client", mock_client):
llm_with_tools = llm.bind_tools(tools)
_ = llm_with_tools.invoke([input_message], config={"callbacks":
[tracer]})
- # Test headers are not traced
+ # Test credentials are not traced
assert len(tracer.chat_model_start_inputs) == 1
invocation_params =
tracer.chat_model_start_inputs[0]["kwargs"]["invocation_params"]
- for tool in invocation_params["tools"]:
- if "headers" in tool:
- assert tool["headers"] == "**REDACTED**"
- for substring in ["Authorization", "Bearer", "PLACEHOLDER"]:
+ assert invocation_params["tools"][0]["headers"] == "**REDACTED**"
+ assert invocation_params["tools"][0]["authorization"] == "**REDACTED**"
+ for substring in [
+ "Authorization",
+ "Bearer",
+ "HEADER_SECRET",
+ "AUTHORIZATION_SECRET",
+ ]:
assert substring not in str(tracer.chat_model_start_inputs)
- # Test headers are correctly propagated to request
+ # Test credentials are correctly propagated to request
payload = llm_with_tools._get_request_payload([input_message],
tools=tools) # type: ignore[attr-defined]
- assert payload["tools"][0]["headers"]["Authorization"] == "Bearer
PLACEHOLDER"
+ assert payload["tools"][0]["headers"]["Authorization"] == "Bearer
HEADER_SECRET"
+ assert payload["tools"][0]["authorization"] == "Bearer
AUTHORIZATION_SECRET"
def test_compat_responses_v03() -> None:
@@ -4457,6 +4507,31 @@
assert "prompt is too long" in str(exc_info.value)
+def test_context_overflow_error_context_window_exceeded() -> None:
+ """Test context overflow error triggered by ContextWindowExceededError."""
+ error_body = {
+ "error": {
+ "message": "ContextWindowExceededError: maximum context length
exceeded",
+ "type": "invalid_request_error",
+ "param": "messages",
+ "code": "invalid_request_error",
+ }
+ }
+ bad_request_error = openai.BadRequestError(
+ message=error_body["error"]["message"],
+ response=MagicMock(status_code=400),
+ body=error_body,
+ )
+ llm = ChatOpenAI()
+
+ with patch.object(llm.client, "with_raw_response") as mock_client:
+ mock_client.create.side_effect = bad_request_error
+ with pytest.raises(ContextOverflowError) as exc_info:
+ llm.invoke([HumanMessage(content="test")])
+
+ assert "ContextWindowExceededError" in str(exc_info.value)
+
+
def test_context_overflow_error_backwards_compatibility() -> None:
"""Test that ContextOverflowError can be caught as BadRequestError."""
llm = ChatOpenAI()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/langchain_openai-1.4.1/uv.lock
new/langchain_openai-1.4.2/uv.lock
--- old/langchain_openai-1.4.1/uv.lock 2020-02-02 01:00:00.000000000 +0100
+++ new/langchain_openai-1.4.2/uv.lock 2020-02-02 01:00:00.000000000 +0100
@@ -636,7 +636,7 @@
provides-extras = ["community", "anthropic", "openai", "azure-ai",
"google-vertexai", "google-genai", "fireworks", "ollama", "together",
"mistralai", "huggingface", "groq", "aws", "baseten", "deepseek", "xai",
"perplexity", "meta"]
[package.metadata.requires-dev]
-lint = [{ name = "ruff", specifier = ">=0.15.0,<0.16.0" }]
+lint = [{ name = "ruff", specifier = ">=0.15.0,<0.17.0" }]
test = [
{ name = "blockbuster", specifier = ">=1.5.26,<1.6.0" },
{ name = "langchain-openai", editable = "." },
@@ -666,7 +666,7 @@
[[package]]
name = "langchain-core"
-version = "1.5.0"
+version = "1.5.3"
source = { editable = "../../core" }
dependencies = [
{ name = "jsonpatch" },
@@ -697,9 +697,9 @@
dev = [
{ name = "grandalf", specifier = ">=0.8.0,<1.0.0" },
{ name = "jupyter", specifier = ">=1.0.0,<2.0.0" },
- { name = "setuptools", specifier = ">=67.6.1,<83.0.0" },
+ { name = "setuptools", specifier = ">=67.6.1,<84.0.0" },
]
-lint = [{ name = "ruff", specifier = ">=0.15.0,<0.16.0" }]
+lint = [{ name = "ruff", specifier = ">=0.15.0,<0.17.0" }]
test = [
{ name = "blockbuster", specifier = ">=1.5.18,<1.6.0" },
{ name = "freezegun", specifier = ">=1.2.2,<2.0.0" },
@@ -728,7 +728,7 @@
[[package]]
name = "langchain-openai"
-version = "1.4.1"
+version = "1.4.2"
source = { editable = "." }
dependencies = [
{ name = "langchain-core" },
@@ -777,7 +777,7 @@
[package.metadata.requires-dev]
dev = []
-lint = [{ name = "ruff", specifier = ">=0.13.1,<0.16.0" }]
+lint = [{ name = "ruff", specifier = ">=0.13.1,<0.17.0" }]
test = [
{ name = "freezegun", specifier = ">=1.2.2,<2.0.0" },
{ name = "langchain", editable = "../../langchain_v1" },
@@ -854,11 +854,11 @@
]
[package.metadata.requires-dev]
-lint = [{ name = "ruff", specifier = ">=0.15.0,<0.16.0" }]
+lint = [{ name = "ruff", specifier = ">=0.15.0,<0.17.0" }]
test = []
test-integration = []
typing = [
- { name = "mypy", specifier = ">=2.1.0,<2.2.0" },
+ { name = "mypy", specifier = ">=2.1.0,<2.4.0" },
{ name = "types-pyyaml", specifier = ">=6.0.12.2,<7.0.0.0" },
]