8000 feat(copilot): add Azure OpenAI support by ysfscream · Pull Request #1926 · emqx/MQTTX · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(copilot): add Azure OpenAI support #1926

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

Merged
merged 5 commits into from
Apr 16, 2025
Merged

feat(copilot): add Azure OpenAI support #1926

merged 5 commits into from
Apr 16, 2025

Conversation

ysfscream
Copy link
Member
@ysfscream ysfscream commented Apr 15, 2025

PR Checklist

If you have any questions, you can refer to the Contributing Guide

What is the current behavior?

The application currently does not support Azure OpenAI as an AI provider option. Users cannot configure or utilize Azure OpenAI models for AI features like Copilot.

Issue Number

None

What is the new behavior?

This PR introduces support for Azure OpenAI as an AI provider. Users can now select 'Azure OpenAI' in the AI settings and configure their Azure endpoint (either via Resource Name or full URL) and API key. This enables the use of various Azure OpenAI models (e.g., deployment-gpt-4o, deployment-gpt-4.1-mini, etc.) within the application's AI features.

image

Key changes include:

  • Added 'Azure OpenAI' to AImodelsOptions in src/utils/ai/copilot.ts.
  • The corresponding Azure OpenAI models with the deployment- prefix are included.
  • Added a helper function getAzureProviderOptions to parse the host/resource name and API version.
  • Updated getModelProvider to handle the creation of the Azure OpenAI client using createAzure from @ai-sdk/azure, passing the correctly parsed options.

Does this PR introduce a breaking change?

  • Yes
  • No

Specific Instructions

Azure OpenAI configuration has some specific requirements due to minimizing changes to the existing provider structure:

  1. Host Field: The Host configuration field for Azure OpenAI can accept either the Resource Name (e.g., your-resource-name) or the full Endpoint URL (e.g., https://your-resource-name.openai.azure.com).
  2. API Version: The desired API Version must be specified as a query parameter appended to the Host field. For example: your-resource-name?api-version=2025-01-01-preview or https://your-resource-name.openai.azure.com/?api-version=2025-01-01-preview. If not provided, it defaults to 2025-01-01-preview. This approach was chosen to avoid larger structural changes like adding a dedicated Provider field or modifying database schemas.
  3. Model Names: Model names for Azure OpenAI are prefixed with deployment- (e.g., deployment-gpt-4o). This reflects that models in Azure are deployments and helps prevent naming collisions with standard OpenAI models, given the absence of a distinct Provider field in the current setup.

These configuration steps are non-standard compared to other providers and must be documented for users intending to use Azure OpenAI.

Other information

Consider updating the official documentation to guide users through the Azure OpenAI configuration process outlined in the "Specific Instructions" section.

@ysfscream ysfscream requested review from Copilot and Red-Asuka and removed request for Copilot April 16, 2025 02:33
@ysfscream ysfscream self-assigned this Apr 16, 2025
@ysfscream ysfscream requested a review from Copilot April 16, 2025 02:33
@ysfscream ysfscream added enhancement New feature or request feature This pr is a feature desktop MQTTX Desktop labels Apr 16, 2025
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • package.json: Language not supported

@ysfscream ysfscream moved this to In Progress in MQTTX Apr 16, 2025
@ysfscream ysfscream added this to the v1.12.0 milestone Apr 16, 2025
@ysfscream ysfscream marked this pull request as ready for review April 16, 2025 02:34
@Red-Asuka Red-Asuka merged commit a09221c into main Apr 16, 2025
4 checks passed
8000
@github-project-automation github-project-automation bot moved this from In Progress to Done in MQTTX Apr 16, 2025
@Red-Asuka Red-Asuka deleted the ysf/desktop branch April 16, 2025 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop MQTTX Desktop enhancement New feature or request feature This pr is a feature
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants
0