Checked other resources
Package (Required)
Related Issues / PRs
PydanticSerializationUnexpectedValue warning when using structured output #35538
Reproduction Steps / Example Code (Python)
from langchain_openai import AzureChatOpenAI
from pydantic.main import BaseModel
gpt4_model = AzureChatOpenAI(...)
class ModelOutput(BaseModel):
output: str
gpt4_model.with_structured_output(ModelOutput).invoke("What is the capital of France?")
Error Message and Stack Trace (if applicable)
PydanticSerializationUnexpectedValue(Expected `none` - serialized value may not be as expected [field_name='parsed', input_value=ModelOutput(output='The c...al of France is Paris.'), input_type=ModelOutput])
return self.__pydantic_serializer__.to_python(
Description
Using structured output for AzureChatOpenAI produces a serializer warning.
System Info
System Information
OS: Linux
OS Version: #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025
Python Version: 3.12.3 (main, Mar 3 2026, 12:15:18) [GCC 13.3.0]
Package Information
langchain_core: 1.2.27
langsmith: 0.7.26
langchain_openai: 1.1.12
Optional packages not installed
deepagents
deepagents-cli
Other Dependencies
httpx: 0.28.1
jsonpatch: 1.33
openai: 2.30.0
orjson: 3.11.8
packaging: 26.0
pydantic: 2.12.5
pyyaml: 6.0.3
requests: 2.33.1
requests-toolbelt: 1.0.0
tenacity: 9.1.4
tiktoken: 0.12.0
typing-extensions: 4.15.0
uuid-utils: 0.14.1
xxhash: 3.6.0
zstandard: 0.25.0
Checked other resources
Package (Required)
Related Issues / PRs
PydanticSerializationUnexpectedValue warning when using structured output #35538
Reproduction Steps / Example Code (Python)
Error Message and Stack Trace (if applicable)
Description
Using structured output for AzureChatOpenAI produces a serializer warning.
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies