fix,docs(provider/azure):allow 'azure' as a key for providerOptions#11073
Conversation
…ption-reasoning-encrypted-content
…e reasoning-delta part
|
I have reviewed this pull request (self-review) |
|
The breaking change is a major issue, because users will have stored UI message histories with the old data. We had a similar problems with Vertex/Google. @aayush-kapoor can you review / guide given that the situation here is somewhat similar to google/vertex? |
|
Thanks for calling this out — I agree that making this a breaking change would be a major issue, especially for users who already have stored UI histories with the old I’ll adjust this PR to follow the same pattern as Google / Vertex. Once I push the update, could you take a look and let me know if I’m aligning with the approach correctly? |
|
I have reviewed this pull request (self-review) @aayush-kapoor When you have a moment, I’d appreciate it if you could take a look. |
…ption-reasoning-encrypted-content
|
Merged the latest commits and resolved conflicts and build errors. |
|
@tsuzaki430 thanks and sorry for the delay, was busy with ai sdk (and now will only have a very limited time in the next couple of weeks) my main question is how backwards compat is solved. i.e. if someone has stored ui message data for azure with openai provider options already, will it still work without changes after this pull request lands? |
|
Thank you for the question, and congratulations on the AI SDK v6 release!🎉 In the case of Google and Vertex, the implementation first attempts to resolve the provider options as I’ve confirmed that tests continue to work correctly even when using the As for data that was previously stored with |
…ption-reasoning-encrypted-content
|
Merged the latest commits and resolved conflicts and build errors. |
|
Thank you for fixing this! We currently can't switch to the responses API for reasoning models on azure openai due to this issue. Looking forward to getting the issue resolved. Is there anything I can help with to get this merged? |
|
I can confirm encrypted reasonings are now processed and send back to azure openai's responses api, thank you for fixing this 👍 |
|
Thank you for your message. |
Background
This PR addresses #10917.
When using Azure OpenAI reasoning models via the Responses API, the SDK currently only handles reasoning parts when their
providerOptionslive under theopenaikey. Azure Responses, however, expose reasoning parts andproviderMetadataunder theazurenamespace. This mismatch causes the SDK to log a warning about "non-OpenAI reasoning parts" and drop encrypted reasoning traces instead of passing them through to the client.Summary
This PR makes the Responses provider options handling in
@ai-sdk/openaiconfigurable and switches Azure Responses to useproviderOptions.azureso that reasoning parts andproviderMetadatastay in sync.Concretely:
OpenAI provider
Extend the Responses input conversion so that the provider options key (
openai,azure, etc.) is configurable instead of being hard-coded toopenai.Keep the existing OpenAI behavior unchanged by continuing to use the
openaikey by default.Azure provider
Update the Azure Responses integration to use the
azureprovider key when reading/writing ResponsesproviderOptions.However, to maintain backward compatibility,
providerOptions.openairemains available.This makes Azure reasoning parts and
providerMetadata.azureconsistent and prevents encrypted reasoning traces from being treated as unsupported "non-OpenAI reasoning".Docs & migration
Update the Azure provider docs to explain that the Responses API now available
providerOptions.azureproviderOptions.openaiand returnsproviderMetadata.azure.Add a migration note to the 6.0 migration guide describing the change from
openai→azurefor Azure Responses.content/providers/01-ai-sdk-providers/04-azure.mdxcontent/docs/08-migration-guides/24-migration-guide-6-0.mdxExamples & tests
reasoning.encrypted_contentfor both OpenAI and Azure Responses.providerOptions.azurefor Responses.packages/azure/src/__fixtures__/azure-reasoning-encrypted-content.1.chunks.txtpackages/azure/src/__fixtures__/azure-reasoning-encrypted-content.1.jsonpackages/openai/src/responses/__fixtures__/openai-reasoning-encrypted-content.1.chunks.txtpackages/openai/src/responses/__fixtures__/openai-reasoning-encrypted-content.1.jsonpackages/openai/src/responses/convert-to-openai-responses-input.tspackages/openai/src/responses/openai-responses-language-model.test.tsManual Verification
new tests in
examples/ai-corepnpm tsx src/generate-text/azure-reasoning-encrypted-content.tspnpm tsx src/generate-text/openai-reasoning-encrypted-content.tspnpm tsx src/generate-text/azure-provider-options-name-openai-compatible.tspnpm tsx src/stream-text/azure-reasoning-encrypted-content.tspnpm tsx src/stream-text/openai-reasoning-encrypted-content.tspnpm tsx src/stream-text/azure-provider-options-name-openai-compatible.tsfix existing tests and re-try in
examples/ai-core.pnpm tsx src/generate-text/azure-image.tspnpm tsx src/generate-text/azure-responses-reasoning-summary.tspnpm tsx src/stream-text/azure-fullstream-logprobs.tspnpm tsx src/stream-text/azure-responses-reasoning-summary.tsfix existing tests and re-try in
examples/next-openai.pnpm run dev&http://localhost:3000/test-azure-code-interpreter-annotation-download(fix examples/next-openai/app/api/chat-azure-code-interpreter-annotation-download/route.ts)
Checklist
pnpm changesetin the project root)Future Work
N/A
Related Issues
Fixes #10917.
Reference #10983.
fix(google-vertex): allow 'vertex' as a key for providerOptions