Integrate Azure Foundry GPT 5.5 model#607
Conversation
This commit adds support for the "Azure GPT 5.5" model, powered by Azure AI Foundry. Key changes: - Added `@ai-sdk/azure` as a dependency. - Updated `lib/utils/index.ts` to include the Azure provider initialization and logic for the "Azure GPT 5.5" model. - Added "Azure GPT 5.5" to the Model Selection UI in the settings page. - Added new environment variables (`AZURE_RESOURCE_NAME`, `AZURE_API_KEY`, `AZURE_DEPLOYMENT_NAME`) to `.env.local.example`. Tested by running `bun run build` which passed successfully, ensuring type safety and correct integration. Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
|
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughAdds Azure GPT 5.5 as a selectable model: dependency and env placeholders, provider wiring and fallback in ChangesAzure OpenAI Provider Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.env.local.example:
- Line 23: The AZURE_DEPLOYMENT_NAME default in .env.local.example currently
uses "gpt-4o" while the UI label in model-selection-form.tsx calls the option
"Azure GPT 5.5", causing confusion; update either the UI label in
model-selection-form.tsx to "Azure GPT‑4o" to match AZURE_DEPLOYMENT_NAME or add
a clarifying comment next to the AZURE_DEPLOYMENT_NAME entry explaining that the
product name "Azure GPT 5.5" maps to the deployment id "gpt-4o" (or update both
UI text and the env example to use the same naming), and ensure the change
references AZURE_DEPLOYMENT_NAME and the option identifier used in
model-selection-form.tsx so they remain consistent.
In `@lib/utils/index.ts`:
- Around line 86-95: The try-catch currently only wraps the call to
azure(azureDeploymentName) but not the provider creation via createAzure; move
the createAzure call into the same try block so any exceptions thrown during
provider initialization are caught and handled the same way as Grok/Gemini.
Specifically, wrap the createAzure({ resourceName: azureResourceName, apiKey:
azureApiKey }) and the subsequent return azure(azureDeploymentName) in a single
try block, log the same descriptive error using console.error (including the
caught error) and rethrow a new Error('Failed to initialize selected model.') so
initialization failures for createAzure and azure(...) are handled uniformly.
- Line 91: The Azure provider return currently uses a double cast
("azure(azureDeploymentName) as unknown as LanguageModel"); remove the
unnecessary "as unknown as LanguageModel" and return azure(azureDeploymentName)
directly, and if TypeScript still complains update the azure(...) function/type
signature to return the correct LanguageModel type instead of masking the
mismatch; reference the azure function call and the azureDeploymentName variable
and ensure the return matches the other providers (xai, google, openai) without
double casting.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: c7673531-3fb7-4c42-8f6c-b0fb1d3c2c4c
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
.env.local.examplecomponents/settings/components/model-selection-form.tsxlib/utils/index.tspackage.json
📜 Review details
🧰 Additional context used
🪛 dotenv-linter (4.0.0)
.env.local.example
[warning] 22-22: [UnorderedKey] The AZURE_API_KEY key should go before the AZURE_RESOURCE_NAME key
(UnorderedKey)
[warning] 23-23: [UnorderedKey] The AZURE_DEPLOYMENT_NAME key should go before the AZURE_RESOURCE_NAME key
(UnorderedKey)
🔇 Additional comments (5)
package.json (1)
21-21: LGTM!lib/utils/index.ts (3)
26-26: LGTM!
8-8: LGTM!Also applies to: 10-10
36-38: LGTM!components/settings/components/model-selection-form.tsx (1)
61-68: LGTM!
| apiKey: azureApiKey, | ||
| }); | ||
| try { | ||
| return azure(azureDeploymentName) as unknown as LanguageModel; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check the `@ai-sdk/azure` package type definitions
cat node_modules/@ai-sdk/azure/package.json | jq '.version, .types'
# Search for type definitions and exported interfaces
fd -e d.ts -e ts . node_modules/@ai-sdk/azure --exec cat {} \; | rg -A 5 'createAzure|LanguageModel'Repository: QueueLab/QCX
Length of output: 242
🌐 Web query:
What is the correct return type for createAzure() in @ai-sdk/azure version 3.0.64?
💡 Result:
In @ai-sdk/azure v3.0.64, createAzure returns a provider factory function (the “azure provider”), i.e. a callable that you use like azure(deploymentName) to create Azure language model instances. Evidence: the official Azure provider docs show createAzure({... }) assigned to a variable named azure, and then used as azure('your-deployment-name') when calling generateText for “Responses models” [1]. The docs also note the returned provider is typed via AzureResponsesProviderMetadata, which only makes sense if createAzure returns a provider factory callable with a deployment name [1].
Citations:
🏁 Script executed:
# First, locate and examine the lib/utils/index.ts file
cat -n lib/utils/index.ts | head -100Repository: QueueLab/QCX
Length of output: 4692
🏁 Script executed:
# Get more context around line 91
sed -n '80,100p' lib/utils/index.tsRepository: QueueLab/QCX
Length of output: 948
🏁 Script executed:
# Check imports at the top of the file
head -30 lib/utils/index.tsRepository: QueueLab/QCX
Length of output: 1076
Remove the double type cast on the Azure provider.
The expression azure(azureDeploymentName) as unknown as LanguageModel uses a double cast, which is inconsistent with all other providers in the same function. Lines 49, 65, and 79 return their provider calls directly without type assertions:
return xai('grok-4-fast-non-reasoning')return google('gemini-3.1-pro-preview')return openai('gpt-4o')
Since the Azure provider follows the same invocation pattern (azure(deploymentName)) as the others, it should return a compatible type without requiring explicit casting. The double cast suggests a type mismatch that either should be resolved at the API call level or indicates the cast is unnecessary.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@lib/utils/index.ts` at line 91, The Azure provider return currently uses a
double cast ("azure(azureDeploymentName) as unknown as LanguageModel"); remove
the unnecessary "as unknown as LanguageModel" and return
azure(azureDeploymentName) directly, and if TypeScript still complains update
the azure(...) function/type signature to return the correct LanguageModel type
instead of masking the mismatch; reference the azure function call and the
azureDeploymentName variable and ensure the return matches the other providers
(xai, google, openai) without double casting.
|
@coderabbitai plan from openai import OpenAI endpoint = "https://qcx-foundry.services.ai.azure.com/openai/v1" client = OpenAI( completion = client.chat.completions.create( print(completion.choices[0].message) make it like this |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 14371
Plan: Use OpenAI SDK with Azure Foundry endpoint for GPT 5.5
Failed to handle agent chat message. Please try again. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainLet me read the relevant files to generate an accurate diff. 🏁 Script executed: Length of output: 15479
|
Thank you for the suggestion. I've updated the implementation to support |
- Added support for `AZURE_ENDPOINT` environment variable. - Configured `baseURL` in `createAzure` using the new endpoint variable. - Updated `.env.local.example` with the endpoint placeholder and set default deployment to `gpt-5.5`. - Verified build success. Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
Removed unused azureResourceName environment variable.
|
@coderabbitai plan 2026-05-12 12:32:09.921 [error] Error [AI_RetryError]: Failed after 3 attempts. Last error: You exceeded your current quota, please check your plan and billing details. For more information on this error, head to: https://ai.google.dev/gemini-api/docs/rate-limits. To monitor your current usage, head to: https://ai.dev/rate-limit.
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 12817 🏁 Script executed: Length of output: 6730
Root Cause AnalysisError 1 — Gemini 429 quota ( Error 2 — Fix 1 — Gemini 429: retry with next provider on quota error
Fix 2 —
|
| File | Change |
|---|---|
lib/utils/index.ts |
Add skipProviders: Set<string> param to getModel() |
lib/actions/chat-helpers.ts (new) |
Plain getSystemPromptDirect() — no 'use server' directive |
app/actions.tsx |
Use getSystemPromptDirect; wrap inference in quota-retry catch |
The requested changes have been implemented and a pull request has been created: View PR
I've addressed the issues identified in the logs:
|
…`getSystemPrompt`. Here is a summary of the changes: - Added Azure OpenAI to the default model fallback chain (Gemini -> Grok -> Azure -> Bedrock -> OpenAI). - Set the default Azure deployment name to `gpt-5.5`. - Improved `getSystemPrompt` robustness by avoiding DB queries for anonymous users. - Updated the task completion logic to use the actual user ID when available. - Verified that the build is successful. Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
@coderabbitai can you fix the code & make it work |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
lib/utils/index.ts (2)
87-97:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winMove provider creation inside the try-catch block.
The
createAzurecall (lines 87-91) is outside the try-catch block that starts on line 92. If initialization throws during provider creation, it won't be caught with the configured error message.While other providers (Grok, Gemini) also have this pattern, any initialization failures in
createAzurewill propagate as unhandled errors instead of the user-friendly "Failed to initialize selected model" message.🛡️ Proposed fix to wrap provider creation in try-catch
case 'Azure GPT 5.5': if ((azureResourceName || azureEndpoint) && azureApiKey) { - const azure = createAzure({ - resourceName: azureResourceName, - baseURL: azureEndpoint, - apiKey: azureApiKey, - }); try { + const azure = createAzure({ + resourceName: azureResourceName, + baseURL: azureEndpoint, + apiKey: azureApiKey, + }); return azure(azureDeploymentName) as unknown as LanguageModel; } catch (error) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/utils/index.ts` around lines 87 - 97, The provider creation for Azure is outside the try-catch, so any exception thrown by createAzure({ resourceName: azureResourceName, baseURL: azureEndpoint, apiKey: azureApiKey }) will bypass the catch; move the createAzure call into the existing try block that returns azure(azureDeploymentName) and handle errors there by logging the caught error (e.g., include the error in the console.error call) before throwing the 'Failed to initialize selected model.' Error, ensuring you reference createAzure, azureDeploymentName, azureResourceName, azureEndpoint, and azureApiKey so the initialization and return remain identical but are fully covered by the try-catch.
93-93:⚠️ Potential issue | 🟠 Major | ⚡ Quick winRemove or explain the double type cast.
The expression
azure(azureDeploymentName) as unknown as LanguageModeluses a double cast, which is inconsistent with all other providers in the same function:
- Line 50:
return xai('grok-4-fast-non-reasoning')— no cast- Line 66:
return google('gemini-3.1-pro-preview')— no cast- Line 80:
return openai('gpt-4o')— no castThe double cast (
as unknown as) is a TypeScript escape hatch that bypasses type checking and suggests either:
- A genuine type incompatibility between the Azure provider and
LanguageModel- An unnecessary cast that should be removed
This same pattern is repeated on line 136 in the fallback section.
What is the correct return type for the azure() provider function returned by createAzure() in `@ai-sdk/azure`, and does it match the LanguageModel type from the ai package?🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/utils/index.ts` at line 93, The double cast `azure(azureDeploymentName) as unknown as LanguageModel` should be removed or replaced with a proper type-aligned fix: inspect the `createAzure()`/`azure()` return type in `@ai-sdk/azure`—if it already returns the same LanguageModel from the ai package, drop both casts and return `azure(azureDeploymentName)`; if it returns a different type, either (a) update `createAzure()` to return/export the correct `LanguageModel` type, or (b) add a single explicit cast `azure(...) as LanguageModel` only after ensuring the shapes align, and apply the same fix to the fallback usage (the repeated cast around line 136); reference symbols: azure(), createAzure(), and LanguageModel.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.env.local.example:
- Around line 21-24: Update the .env.example entry for AZURE_RESOURCE_NAME /
AZURE_ENDPOINT to clarify they are alternative methods: state that you should
provide either AZURE_ENDPOINT (for OpenAI-compatible Azure Foundry endpoints,
e.g. https://your-foundry.services.ai.azure.com/openai/v1 used together with
AZURE_DEPLOYMENT_NAME) OR AZURE_RESOURCE_NAME (for the traditional Azure OpenAI
resource name), and that only one of these is required; reference the code
checks that accept either option (see checks around azureResourceName /
azureEndpoint in lib/utils/index.ts) so users know which variables to set for
each approach.
---
Duplicate comments:
In `@lib/utils/index.ts`:
- Around line 87-97: The provider creation for Azure is outside the try-catch,
so any exception thrown by createAzure({ resourceName: azureResourceName,
baseURL: azureEndpoint, apiKey: azureApiKey }) will bypass the catch; move the
createAzure call into the existing try block that returns
azure(azureDeploymentName) and handle errors there by logging the caught error
(e.g., include the error in the console.error call) before throwing the 'Failed
to initialize selected model.' Error, ensuring you reference createAzure,
azureDeploymentName, azureResourceName, azureEndpoint, and azureApiKey so the
initialization and return remain identical but are fully covered by the
try-catch.
- Line 93: The double cast `azure(azureDeploymentName) as unknown as
LanguageModel` should be removed or replaced with a proper type-aligned fix:
inspect the `createAzure()`/`azure()` return type in `@ai-sdk/azure`—if it already
returns the same LanguageModel from the ai package, drop both casts and return
`azure(azureDeploymentName)`; if it returns a different type, either (a) update
`createAzure()` to return/export the correct `LanguageModel` type, or (b) add a
single explicit cast `azure(...) as LanguageModel` only after ensuring the
shapes align, and apply the same fix to the fallback usage (the repeated cast
around line 136); reference symbols: azure(), createAzure(), and LanguageModel.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: 61dd72a4-f4c9-4966-a71a-8c3e4759bef4
📒 Files selected for processing (4)
.env.local.exampleapp/actions.tsxlib/actions/chat.tslib/utils/index.ts
📜 Review details
🧰 Additional context used
🪛 dotenv-linter (4.0.0)
.env.local.example
[warning] 22-22: [UnorderedKey] The AZURE_ENDPOINT key should go before the AZURE_RESOURCE_NAME key
(UnorderedKey)
[warning] 23-23: [UnorderedKey] The AZURE_API_KEY key should go before the AZURE_ENDPOINT key
(UnorderedKey)
[warning] 24-24: [UnorderedKey] The AZURE_DEPLOYMENT_NAME key should go before the AZURE_ENDPOINT key
(UnorderedKey)
🔇 Additional comments (7)
lib/utils/index.ts (6)
129-140: Same issues as the selected model case apply here.This fallback block has the same concerns as the switch case (lines 85-101):
createAzureis outside the try-catch (lines 130-134 vs line 135)- Double type cast on line 136:
as unknown as LanguageModel- Potential
undefinedforresourceNameparameterThese issues are already flagged in the switch case above. Fixing them there should also address the fallback implementation.
26-26: LGTM!
36-39: LGTM!
105-105: LGTM!
87-91: ⚡ Quick winNo issue here. According to
@ai-sdk/azuredocumentation, whenbaseURLis provided,resourceNameis ignored and becomes optional. The code correctly passes it regardless of which parameter is set.
8-8: 🏗️ Heavy liftImplementation correctly uses
@ai-sdk/azurefor OpenAI-compatible Azure Foundry endpoints. The provider fully supports thebaseURLparameter to configure custom endpoint URLs for Azure Foundry, which matches the OpenAI-compatible approach discussed in the PR comments. No switch to@ai-sdk/openaiis necessary;@ai-sdk/azureis the appropriate choice for Azure-specific functionality.app/actions.tsx (1)
400-405: 🏗️ Heavy liftThe claim about a "request-context crash" from authenticated requests calling
getSystemPrompt()cannot be verified. The code shows a straightforward pattern:submit()(a'use server'function) callsgetSystemPrompt()(exported from another'use server'module), which performs a database query. This is a standard supported pattern in Next.js. The function correctly returnsnullearly for anonymous users and performs a direct Drizzle ORM query for authenticated users. No error logs, issues, or evidence of the reported crash were found in the codebase. The recommendation to move the DB lookup into a "plain helper" is unclear—server functions calling server functions is the appropriate pattern for database operations. Please clarify the specific error or request-context issue being referenced.
I've applied several fixes and improvements to address the feedback and make the implementation more robust:
|
|
@coderabbitai only the endpoint URL and the API is required for the Azure gpt5.5 but the system still using Gemini API |
…ss fixes. I refined the Azure endpoint handling by stripping the `/v1` suffix for compatibility and integrated Azure OpenAI into the default model fallback chain. I also improved the reliability of the system prompts and the finalization process with better error handling and guest user checks. Finally, I've confirmed that the production build is successful. Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 37726
Fix 1 — New file:
|
| File | What changes |
|---|---|
lib/actions/chat-helpers.ts (new) |
Plain getSystemPromptDirect() — no 'use server', fixes the searchParams crash |
lib/utils/index.ts |
Remove @ai-sdk/azure; use createOpenAI + baseURL for Azure; add skipProviders param to getModel() |
app/actions.tsx |
Use getSystemPromptDirect; catch quota 429 errors in processEvents() and retry skipping the exhausted provider |
package.json |
Remove "@ai-sdk/azure": "^3.0.64" |
After applying these changes, run:
bun install # removes `@ai-sdk/azure` from lockfile
bun run build # verify no type errors- Create
lib/actions/chat-helpers.tswithgetSystemPromptDirect(no'use server') - Update
lib/utils/index.ts: removecreateAzure, addskipProviders, switch Azure tocreateOpenAI+baseURL - Update
app/actions.tsx: swapgetSystemPrompt→getSystemPromptDirect; addisQuotaExhaustedhelper; wrap researcher call with quota retry - Update
package.json: remove@ai-sdk/azure
The requested changes have been implemented and a pull request has been created: View PR
I've prioritized the Azure configuration as requested. Azure OpenAI (via Endpoint or Resource Name) is now at the top of the default provider fallback chain, so the system will favor it over Gemini if the credentials are provided. Additionally, I've updated the logic to use |
- Moved Azure OpenAI (via endpoint or resource) to the top of the default provider fallback chain. - Updated Azure endpoint logic to use `createOpenAI` with `baseURL` for better compatibility with Azure AI Foundry's OpenAI-compatible endpoints. - Maintained support for standard Azure OpenAI resources as a secondary option. - Verified build success. Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 30888 🏁 Script executed: Length of output: 19767
Root Cause
|
Integrated Azure AI Foundry to support the "Azure GPT 5.5" model selection and inference. This includes adding the necessary SDK provider, updating the backend model factory, and enhancing the settings UI for model selection.
PR created automatically by Jules for task 17932664142642914555 started by @ngoiyaeric
Summary by CodeRabbit
New Features
Behavior Changes