Skip to content

feat(web): add reasoningEffort support for Azure OpenAI provider#1101

Merged
brendan-kellam merged 3 commits intomainfrom
brendan/azure-reasoning-effort-SOU-872
Apr 9, 2026
Merged

feat(web): add reasoningEffort support for Azure OpenAI provider#1101
brendan-kellam merged 3 commits intomainfrom
brendan/azure-reasoning-effort-SOU-872

Conversation

@brendan-kellam
Copy link
Copy Markdown
Contributor

@brendan-kellam brendan-kellam commented Apr 9, 2026

Summary

  • Adds reasoningEffort configuration option to the Azure OpenAI language model schema
  • Passes reasoningEffort as a provider option when creating Azure OpenAI models, defaulting to medium (consistent with the existing OpenAI provider behavior)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Azure OpenAI provider: added optional reasoningEffort setting (levels: minimal, low, medium (default), high) to tune reasoning depth.
  • Documentation
    • Updated Azure OpenAI docs: clarify that model should be the Azure deployment name, explain resourceName vs baseUrl behavior, and show reasoningEffort in examples.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mintlify
Copy link
Copy Markdown

mintlify bot commented Apr 9, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
sourcebot 🟢 Ready View Preview Apr 9, 2026, 5:30 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@github-actions

This comment has been minimized.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1bf49d8d-4896-4d71-9610-3467d0c55b1f

📥 Commits

Reviewing files that changed from the base of the PR and between 6408f6a and 4ef9b23.

📒 Files selected for processing (1)
  • docs/docs/configuration/language-model-providers.mdx

Walkthrough

Adds an optional reasoningEffort string configuration to the Azure OpenAI provider across schemas, types, docs, and the runtime handler so the Azure branch supplies this option (defaulting to "medium") to OpenAI provider options.

Changes

Cohort / File(s) Summary
Changelog
CHANGELOG.md
Inserted unreleased note documenting the new reasoningEffort option for the Azure OpenAI provider.
Schema docs (mdx)
docs/snippets/schemas/v3/index.schema.mdx, docs/snippets/schemas/v3/languageModel.schema.mdx
Added optional reasoningEffort: string to AzureLanguageModel documentation, with description, default medium, and examples (minimal, low, medium, high).
Schema definitions (TS)
packages/schemas/src/v3/index.schema.ts, packages/schemas/src/v3/languageModel.schema.ts
Added reasoningEffort property to the AzureLanguageModel JSON schema definitions (two mirrored locations) with description, examples, and default note.
Type declarations (TS)
packages/schemas/src/v3/index.type.ts, packages/schemas/src/v3/languageModel.type.ts
Added optional reasoningEffort?: string to the exported AzureLanguageModel interfaces.
JSON schema
schemas/v3/languageModel.json
Added definitions.AzureLanguageModel.properties.reasoningEffort as a string with description, default note, and examples.
Runtime usage
packages/web/src/features/chat/utils.server.ts
Azure branch of getAISDKLanguageModelAndOptions now returns providerOptions.openai.reasoningEffort set from config (or defaults to 'medium') and asserts options type.
Docs (configuration)
docs/docs/configuration/language-model-providers.mdx
Updated Azure OpenAI docs: clarify model is an Azure deployment name, explain resourceName vs baseUrl, and add reasoningEffort example (default medium).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • msukkari
  • Ferexx
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: adding reasoningEffort support for the Azure OpenAI provider, which matches the core objective of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch brendan/azure-reasoning-effort-SOU-872

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
packages/web/src/features/chat/utils.server.ts (1)

237-241: Use the azure namespace for provider options in Azure responses models.

The Azure responses model should use providerOptions.azure instead of providerOptions.openai. While openai is supported for backward compatibility, the AI SDK documentation recommends the azure namespace 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: Constrain reasoningEffort with 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: Constrain reasoningEffort with enum (and optionally default) instead of examples only.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 44e7e62 and 6408f6a.

📒 Files selected for processing (9)
  • CHANGELOG.md
  • docs/snippets/schemas/v3/index.schema.mdx
  • docs/snippets/schemas/v3/languageModel.schema.mdx
  • packages/schemas/src/v3/index.schema.ts
  • packages/schemas/src/v3/index.type.ts
  • packages/schemas/src/v3/languageModel.schema.ts
  • packages/schemas/src/v3/languageModel.type.ts
  • packages/web/src/features/chat/utils.server.ts
  • schemas/v3/languageModel.json

@brendan-kellam brendan-kellam merged commit 339a184 into main Apr 9, 2026
10 of 11 checks passed
@brendan-kellam brendan-kellam deleted the brendan/azure-reasoning-effort-SOU-872 branch April 9, 2026 17:38
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.

1 participant