SIGN IN SIGN UP

fix(langchain): normalize raw schemas in middleware response_format override (#35019)

Normalizes raw Pydantic schemas to AutoStrategy when middleware
overrides response_format.

When middleware calls
`request.override(response_format=SomePydanticClass)` with a raw schema,
the code now wraps it in `AutoStrategy` before processing. This prevents
an `IndexError` crash that occurred because raw schemas were falling
through to the "no structured output" branch.

Fixes #35008

Co-authored-by: Guofang Tang <[email protected]>
Co-authored-by: Sydney Runkle <[email protected]>
G
Guofang.Tang committed
81b4752419df992b65357fe544372743ab3de77a
Parent: 8767a46
Committed by GitHub <[email protected]> on 2/6/2026, 12:32:26 PM