Submission checklist
Package (Required)
Related Issues / PRs
#35538
Reproduction Steps / Example Code (Python)
from langchain_openai import ChatOpenAI
from pydantic import BaseModel
llm = ChatOpenAI(model='gpt-5.4', streaming=True)
class ModelOutput(BaseModel):
output: str
print(llm.with_structured_output(ModelOutput).invoke("What is the capital of France?"))
Error Message and Stack Trace (if applicable)
D:\temp\.venv\Lib\site-packages\pydantic\main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `none` - serialized value may not be as expected [field_name='parsed', input_value=ModelOutput(output='Paris.'), input_type=ModelOutput])
return self.__pydantic_serializer__.to_python(
output='Paris.'
Description
Enabling streaming causes warning demonstrated in the example
It happens here
|
chunk = chunk.model_dump() |
Warning when model invoked without streaming was fixed in
#35543, but for streaming issue remains.
System Info
System Information
OS: Windows
OS Version: 10.0.26200
Python Version: 3.14.6 (tags/v3.14.6:c63aec6, Jun 10 2026, 10:26:10) [MSC v.1944 64 bit (AMD64)]
Package Information
langchain_core: 1.4.3
langchain: 1.3.7
langsmith: 0.8.14
langchain_openai: 1.3.0
langchain_protocol: 0.0.16
langgraph_sdk: 0.4.2
Optional packages not installed
deepagents
deepagents-cli
Other Dependencies
httpx: 0.28.1
jsonpatch: 1.33
langgraph: 1.2.4
openai: 2.41.1
orjson: 3.11.9
packaging: 26.2
pydantic: 2.13.4
pyyaml: 6.0.3
requests: 2.34.2
requests-toolbelt: 1.0.0
tenacity: 9.1.4
tiktoken: 0.13.0
typing-extensions: 4.15.0
uuid-utils: 0.16.0
websockets: 15.0.1
xxhash: 3.7.0
zstandard: 0.25.0
Submission checklist
Package (Required)
Related Issues / PRs
#35538
Reproduction Steps / Example Code (Python)
Error Message and Stack Trace (if applicable)
Description
Enabling streaming causes warning demonstrated in the example
It happens here
langchain/libs/partners/openai/langchain_openai/chat_models/base.py
Line 1673 in ce21bf4
Warning when model invoked without streaming was fixed in #35543, but for streaming issue remains.
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies