Skip to content

[Bug]: Pydantic model's description is not taken into account when generating structured outputs #31804

@venki-lfc

Description

@venki-lfc

Your current environment

vllm == 0.11.0
langchain==1.2.0
langchain-core== 1.2.6
langchain-openai == 1.1.6

🐛 Describe the bug

When using with_structured_output from langchain's ChatOpenAI, the model response does not seem to follow the rules mentioned in description field. Here is an example:

# Define a simple Pydantic schema
class CarDescription(BaseModel):
    origin: str = Field(description="Country of origin in Uppercase")
    model: str = Field(description="Model of the car in lowercase")
    car_type: Literal["Sports", "Luxury", "Economic"] = Field(description="Type of the car")


# Wrap with structured output
structured_llm = llm.with_structured_output(CarDescription)

# Generate Result
result = structured_llm.invoke("Create a car description for VW")

The results looks like this:
origin='Germany' model='Golf GTI' car_type='Sports'

It can be seen that the LLM failed to generate the origin and model in the respective cases as mentioned in their descriptions. I served Qwen3-30B-A3B-Instruct using vllm to get the result.

I tested this with GPT-5-mini and the results were in the correct cases. So I assume vLLM somehow does not read the description of each key but just the name of the key. Can you please fix this issue?

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions