feat(web): add reasoningEffort support for Azure OpenAI provider#1101
feat(web): add reasoningEffort support for Azure OpenAI provider#1101brendan-kellam merged 3 commits intomainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds an optional Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
packages/web/src/features/chat/utils.server.ts (1)
237-241: Use theazurenamespace for provider options in Azure responses models.The Azure responses model should use
providerOptions.azureinstead ofproviderOptions.openai. Whileopenaiis supported for backward compatibility, the AI SDK documentation recommends theazurenamespace for Responses models to ensure forward compatibility and clarity.♻️ Suggested update
-import { createAzure } from '@ai-sdk/azure'; +import { createAzure, type OpenAILanguageModelResponsesOptions as AzureResponsesOptions } from '@ai-sdk/azure'; ... return { model: azure(modelId), providerOptions: { - openai: { + azure: { reasoningEffort: config.reasoningEffort ?? 'medium', - } satisfies OpenAIResponsesProviderOptions, + } satisfies AzureResponsesOptions, } };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/web/src/features/chat/utils.server.ts` around lines 237 - 241, The providerOptions for Azure Responses should be under the azure namespace rather than openai: change providerOptions.openai to providerOptions.azure (keeping the reasoningEffort assignment) and update the type to the appropriate Azure responses provider options type if one exists (e.g., AzureResponsesProviderOptions) while preserving the existing reasoningEffort default and the satisfies check; ensure the object key is providerOptions.azure and the value still satisfies the expected provider options interface.docs/snippets/schemas/v3/index.schema.mdx (1)
2061-2070: ConstrainreasoningEffortwith an enum instead of free-form string.Lines 2061-2070 and Lines 3531-3540 document specific allowed values, but schema validation currently accepts any string. This weakens config validation and pushes bad values to runtime/provider errors.
♻️ Suggested schema change
"reasoningEffort": { - "type": "string", + "type": "string", + "enum": [ + "minimal", + "low", + "medium", + "high" + ], "description": "The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings", "examples": [ "minimal", "low", "medium", "high" ] },Given this file is generated, apply this in the source schema generator (
packages/schemas/src/v3/...) and regenerate.Also applies to: 3531-3540
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/snippets/schemas/v3/index.schema.mdx` around lines 2061 - 2070, The schema currently defines "reasoningEffort" as an unconstrained string; update the source schema generator under packages/schemas/src/v3/ to change the "reasoningEffort" property to an enum with allowed values ["minimal","low","medium","high"] (replace the free-form "type": "string" for the "reasoningEffort" property with an enum definition), apply the same change for the other occurrence (lines corresponding to the second "reasoningEffort" definition), then regenerate the docs so docs/snippets/schemas/v3/index.schema.mdx reflects the enum-constrained field.packages/schemas/src/v3/languageModel.schema.ts (1)
374-383: ConstrainreasoningEffortwithenum(and optionallydefault) instead ofexamplesonly.Right now, schema validation accepts any string, so typos like
"meduim"pass validation and fail later at runtime. Since this field is documented as a fixed set of values, enforce it in schema.Suggested schema change
"reasoningEffort": { "type": "string", + "enum": [ + "minimal", + "low", + "medium", + "high" + ], + "default": "medium", "description": "The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings", "examples": [ "minimal", "low", "medium", "high" ] },Also applies to: 1844-1853
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/schemas/src/v3/languageModel.schema.ts` around lines 374 - 383, The schema property "reasoningEffort" currently uses "examples" only, so it accepts any string; update the "reasoningEffort" definition in packages/schemas/src/v3/languageModel.schema.ts to enforce allowed values by replacing or augmenting "examples" with an "enum" array ["minimal","low","medium","high"] and set a "default": "medium" (or add only the enum if default undesired); make the same change for the other occurrence of the reasoningEffort property later in the file (the duplicate at the later block) so schema validation rejects typos and enforces the documented fixed set.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@schemas/v3/languageModel.json`:
- Around line 129-138: The reasoningEffort schema currently allows any string
and includes an invalid example ("minimal"); update the reasoningEffort property
in schemas/v3/languageModel.json to restrict values to the Azure
Responses-supported enum ["low","medium","high"], set the default to "medium"
(as described), and remove or replace the "minimal" example so examples only
include the valid values; locate the reasoningEffort property by name to make
this change.
---
Nitpick comments:
In `@docs/snippets/schemas/v3/index.schema.mdx`:
- Around line 2061-2070: The schema currently defines "reasoningEffort" as an
unconstrained string; update the source schema generator under
packages/schemas/src/v3/ to change the "reasoningEffort" property to an enum
with allowed values ["minimal","low","medium","high"] (replace the free-form
"type": "string" for the "reasoningEffort" property with an enum definition),
apply the same change for the other occurrence (lines corresponding to the
second "reasoningEffort" definition), then regenerate the docs so
docs/snippets/schemas/v3/index.schema.mdx reflects the enum-constrained field.
In `@packages/schemas/src/v3/languageModel.schema.ts`:
- Around line 374-383: The schema property "reasoningEffort" currently uses
"examples" only, so it accepts any string; update the "reasoningEffort"
definition in packages/schemas/src/v3/languageModel.schema.ts to enforce allowed
values by replacing or augmenting "examples" with an "enum" array
["minimal","low","medium","high"] and set a "default": "medium" (or add only the
enum if default undesired); make the same change for the other occurrence of the
reasoningEffort property later in the file (the duplicate at the later block) so
schema validation rejects typos and enforces the documented fixed set.
In `@packages/web/src/features/chat/utils.server.ts`:
- Around line 237-241: The providerOptions for Azure Responses should be under
the azure namespace rather than openai: change providerOptions.openai to
providerOptions.azure (keeping the reasoningEffort assignment) and update the
type to the appropriate Azure responses provider options type if one exists
(e.g., AzureResponsesProviderOptions) while preserving the existing
reasoningEffort default and the satisfies check; ensure the object key is
providerOptions.azure and the value still satisfies the expected provider
options interface.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 839dbc6f-2eee-430a-aa7a-ce2fe86f7774
📒 Files selected for processing (9)
CHANGELOG.mddocs/snippets/schemas/v3/index.schema.mdxdocs/snippets/schemas/v3/languageModel.schema.mdxpackages/schemas/src/v3/index.schema.tspackages/schemas/src/v3/index.type.tspackages/schemas/src/v3/languageModel.schema.tspackages/schemas/src/v3/languageModel.type.tspackages/web/src/features/chat/utils.server.tsschemas/v3/languageModel.json
Summary
reasoningEffortconfiguration option to the Azure OpenAI language model schemareasoningEffortas a provider option when creating Azure OpenAI models, defaulting tomedium(consistent with the existing OpenAI provider behavior)🤖 Generated with Claude Code
Summary by CodeRabbit