Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 17, 2025

Fixes #5805 - Eliminates the need to specify API version in both Base URL and separate field for Azure OpenAI


Important

This PR refines Azure OpenAI API version handling by extracting the version from the URL, reducing configuration redundancy, and updating the UI to reflect detected versions.

  • Behavior:
    • OpenAiHandler in openai.ts now extracts Azure API version from URL if not explicitly set, reducing redundancy.
    • Maintains original URL for Azure AI Inference and Azure OpenAI to ensure compatibility.
  • Utilities:
    • Adds extractApiVersionFromUrl() and related functions in azure-url-parser.ts.
    • Comprehensive tests for URL parsing in azure-url-parser.test.ts.
  • UI:
    • OpenAICompatible.tsx updated to show detected API version if not manually set.
    • Adds translation strings for API version detection message in multiple locale files.

This description was created by Ellipsis for 0f12000. You can customize this summary. It will automatically update as commits are pushed.

- Add URL parsing utility to extract API version from Base URL
- Modify OpenAI provider to use extracted API version when azureApiVersion field is not set
- Update UI to show helpful message when API version is detected in URL
- Add comprehensive tests for URL parsing functionality

Fixes #5805
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 17, 2025 09:09
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 17, 2025
@dosubot dosubot bot added the bug Something isn't working label Jul 17, 2025
const baseUrl = apiConfiguration?.openAiBaseUrl || ""
const extractedApiVersion = extractApiVersionFromUrl(baseUrl)
const isAzureUrl = isAzureOpenAiUrl(baseUrl)
const showApiVersionExtraction = isAzureUrl && extractedApiVersion && !azureApiVersionSelected
Copy link
Contributor

Choose a reason for hiding this comment

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

The variable 'showApiVersionExtraction' is computed based on the extracted API version from the Base URL but is not used anywhere in the UI. Consider using it to display a notice (or auto-fill the Azure API version field) to help users understand that the API version was detected from their Base URL, thereby reducing configuration duplication.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 17, 2025
- Fix security vulnerability in URL validation by using endsWith instead of includes
- Add UI notification for detected API version from Base URL
- Add validation for Azure API version format
- Improve test coverage with edge cases
- Exclude Azure AI Inference Service URLs from Azure OpenAI detection
- Add translation key 'azureApiVersionDetected' to English locale
- Update OpenAICompatible component to use translation function
- Addresses Ellipsis bot comment about internationalization
- Improve Azure URL detection logic to be more specific
- Add visual validation for manually entered Azure API versions in UI
- Import isValidAzureApiVersion function for input validation
- Add border color styling to indicate valid/invalid API version format
- Added translations for 'azureApiVersionDetected' key in all supported languages
- Translations inform users when API version is auto-detected from Base URL
- Covers languages: ca, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jul 17, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 18, 2025
- Extract API version from URL for both Azure OpenAI and Azure AI Inference
- Keep original URL unchanged to maintain backward compatibility
- API version is still sent in both URL and parameter as before
- Only the user experience changes (no need to specify version twice)
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

Looks good but can't really test with Azure

Image

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Jul 19, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 19, 2025
@mrubens
Copy link
Collaborator

mrubens commented Jul 31, 2025

Has anyone been able to test this one?

@daniel-lxs daniel-lxs moved this from PR [Needs Review] to PR [Draft / In Progress] in Roo Code Roadmap Aug 18, 2025
@daniel-lxs daniel-lxs marked this pull request as draft August 18, 2025 16:54
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 22, 2025
@github-project-automation github-project-automation bot moved this from PR [Draft / In Progress] to Done in Roo Code Roadmap Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer PR - Draft / In Progress size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Azure OpenAI: duplication of api version

5 participants