Skip to content

Conversation

christian-bromann
Copy link
Member

This patch updates the structured output behavior for createAgent:

  • it now better detects models that support structured responses
  • it automatically selects structured responses if user only provides a json or Zod schema
  • it adds e2e tests verifying the behavior
  • it generally improves the implementation, e.g. compute decision which strategy to use after the modifyModelRequest hook of the middleware

Copy link

changeset-bot bot commented Sep 23, 2025

⚠️ No Changeset found

Latest commit: ad1caf3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Sep 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
langchainjs-docs Ready Ready Preview Comment Sep 25, 2025 6:04am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
langchainjs-api-refs Ignored Ignored Sep 25, 2025 6:04am

Comment on lines +415 to +424
const CHAT_MODELS_THAT_SUPPORT_JSON_SCHEMA_OUTPUT = ["ChatOpenAI", "ChatXAI"];
const MODEL_NAMES_THAT_SUPPORT_JSON_SCHEMA_OUTPUT = [
"grok",
"gpt-5",
"gpt-4.1",
"gpt-4o",
"gpt-oss",
"o3-pro",
"o3-mini",
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this list is incomplete? Post V1 I'd love if we did some exploration on how to make this native to the provider packages (maintaining this list separately/ any kind of "model capability matrix" feels like asking for trouble)

(no fix needed here, just a comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 Let's create a post v1 list

@christian-bromann christian-bromann merged commit d823370 into v1 Sep 25, 2025
42 of 43 checks passed
@christian-bromann christian-bromann deleted the cb/structured-refinedment branch September 25, 2025 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants