-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: improve Azure OpenAI compatibility #6033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Enhanced Azure detection logic to match Cline implementation - Added URL extraction for Azure endpoints with query parameters - Fixed reasoning model handling for Azure (o1, o3, o4) - Added specific error messages for common Azure issues - Addresses issue #1334
| // Primary indicator is azureApiVersion, then check URL patterns | ||
| const isAzureOpenAi = !!( | ||
| this.options.azureApiVersion || | ||
| options.openAiUseAzure || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typographical error: did you mean this.options.openAiUseAzure instead of options.openAiUseAzure? This would make the reference consistent with other options.
| options.openAiUseAzure || | |
| this.options.openAiUseAzure || |
|
@roomote-agent run issue-fixer mode on this pr |
|
Hi @hannesrudolph! I see your request to run issue-fixer mode on this PR. I notice the CodeQL check is currently failing. Let me investigate and fix the issues. 🔧 |
- Remove @ts-ignore comments and use proper type assertions - Add input validation and sanitization for error messages - Improve URL parsing error handling in _extractBaseUrl method - Prevent potential security vulnerabilities flagged by CodeQL
- Replace insecure .includes() checks with proper hostname validation - Add _isAzureHost() method to safely check for Azure domains - Add _isVolcesHost() method to safely check for Volces domains - Prevent security vulnerabilities from malicious URLs like malicious-azure.com.attacker.com
|
Hi @hannesrudolph! ✅ I have successfully fixed all the CodeQL issues in this PR. Summary of fixes:1. Fixed TypeScript type safety issues
2. Resolved CodeQL security vulnerabilities
3. Improved error handling
All CI checks are now passing, including the CodeQL security scan. The Azure OpenAI compatibility improvements are ready for review! 🚀 |
Summary
This PR improves Azure OpenAI compatibility by implementing several key enhancements based on how Cline handles Azure connections.
Changes
1. Enhanced Azure Detection Logic
azureApiVersionas the primary indicator (similar to Cline)2. URL Handling for Azure Endpoints
_extractBaseUrl()method to properly handle Azure URLs with query parametershttps://resource.openai.azure.com/openai/deployments/model/chat/completions?api-version=2025-01-01-preview3. Reasoning Model Support (o1, o3, o4)
4. Better Error Handling
Testing
Related Issues
Context
As requested by @hannesrudolph, I examined how Cline implemented Azure AI Foundry connectivity and applied similar patterns to improve our implementation.
Important
Enhances Azure OpenAI compatibility by improving detection logic, URL handling, and error management in
openai.ts.azureApiVersionand URL patterns inOpenAiHandler._extractBaseUrl()inOpenAiHandlerto handle Azure URLs without query parameters.createMessage()andhandleO3FamilyMessage().createMessage().This description was created by
for 6319935. You can customize this summary. It will automatically update as commits are pushed.