fix(v3): preserve provider for structured output - #2775
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 4353d5b The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
akeimach
approved these changes
Aug 19, 2026
Contributor
There was a problem hiding this comment.
No issues found across 3 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant Client as External Caller
participant LLMProv as LLMProvider
participant AISdk as AISdkClient
participant infer as inferProviderName()
participant Model as LanguageModelV2
participant SDK as AI SDK (generateObject)
Client->>LLMProv: getClient("anthropic/claude-opus-4-8")
LLMProv->>LLMProv: strip "anthropic/" prefix → bare "claude-opus-4-8"
LLMProv->>AISdk: create with model "claude-opus-4-8"
Note over LLMProv,AISdk: Model is from AI SDK, not raw string
Client->>AISdk: createChatCompletion(options)
AISdk->>AISdk: resolve model.provider from AI SDK model
AISdk->>infer: inferProviderName(model)
Note over Model,infer: NEW: Use model.provider (e.g. "anthropic")<br/>instead of model.modelId (e.g. "claude-opus-4-8")
infer->>Model: access model.provider
Model-->>infer: "anthropic"
alt provider exists
infer->>infer: split "anthropic" by "." → ["anthropic"]
infer-->>AISdk: "anthropic"
else provider missing (fallback)
infer->>Model: access model.modelId
Model-->>infer: "claude-opus-4-8"
infer->>infer: split "claude-opus-4-8" by "/" → ["claude-opus-4-8"]
infer-->>AISdk: undefined
end
AISdk->>AISdk: check if provider is "anthropic"
alt provider is "anthropic"
AISdk->>AISdk: set structuredOutputMode to "auto"
AISdk->>SDK: generateObject() with providerOptions.anthropic.structuredOutputMode
Note over AISdk,SDK: Correctly enables native Anthropic structured outputs
else provider is not "anthropic"
AISdk->>SDK: generateObject() without Anthropic options
end
SDK-->>AISdk: structured output result
AISdk-->>Client: completion response
Merged
miguelg719
pushed a commit
that referenced
this pull request
Aug 20, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to v3, this PR will be updated. # Releases ## @browserbasehq/stagehand@3.7.2 ### Patch Changes - [#2775](#2775) [`b954a46`](b954a46) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix Anthropic structured output options for provider-prefixed models - [#2767](#2767) [`98fa7a4`](98fa7a4) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix: Normalize CUA coordinates to actual viewport - [#2385](#2385) [`7566804`](7566804) Thanks [@miguelg719](https://github.com/miguelg719)! - Add `useTouch` option to actuate agent clicks as trusted touch ## @browserbasehq/stagehand-evals@2.1.1 ### Patch Changes - Updated dependencies \[[`b954a46`](b954a46), [`98fa7a4`](98fa7a4), [`7566804`](7566804)]: - @browserbasehq/stagehand@3.7.2 ## @browserbasehq/stagehand-server-v3@3.7.4 ### Patch Changes - Updated dependencies \[[`b954a46`](b954a46), [`98fa7a4`](98fa7a4), [`7566804`](7566804)]: - @browserbasehq/stagehand@3.7.2 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
LLMProvider passes the bare claude-opus-4-8 model ID to the Anthropic AI SDK provider. AISdkClient previously inferred the provider only from that bare model ID, so extract() omitted structuredOutputMode: auto and did not opt into Anthropic native structured outputs.
Testing