DeepSeek V3 Does Not Support Structured Output in LangChain with ChatOpenAI() #29282
Open
5 tasks done
Labels
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
investigate
Flagged for investigation.
Ɑ: models
Related to LLMs or chat model modules
Checked other resources
Example Code
Steps to Reproduce:
Install the required libraries:
Initialize the model and define a Pydantic model for structured output:
Use
with_structured_output()
to enforce the Pydantic model and query the model with structured output:Error Message and Stack Trace (if applicable)
Actual Behavior:
The model throws an
UnprocessableEntityError
indicating that theresponse_format
typejson_schema
is unavailable:Description
Description:
When using
ChatOpenAI()
with DeepSeek V3 in LangChain, thewith_structured_output()
method fails to enforce structured output formats (e.g., Pydantic models). The model returns an error indicating that theresponse_format
typejson_schema
is unavailable. This prevents the use of structured output functionality, which is critical for applications requiring consistent and predictable data formats.Expected Behavior:
The model should return a structured output in the format defined by the Pydantic model:
System Info
Environment:
langchain-openai
,langchain-community
,langchain_experimental
,langgraph
deepseek-chat
(via DeepSeek API)The text was updated successfully, but these errors were encountered: