Skip to content
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

fix: Support Azure OpenAI #14722

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

fipro78
Copy link
Contributor

@fipro78 fipro78 commented Jan 13, 2025

  • Add configuration of OpenAI API version
  • Add configuration of supportsDeveloperMessage
  • If OpenAI API version is configured, use AzureOpenAI

Fixes #14711

What it does

It fixes #14711 and adds support for accessing an OpenAI model deployed on Azure.
To make this work, the AzureOpenAI class needs to be used, as described in the openai-node docs.

To build up the request with AzureOpenAI you need to pass a apiVersion. This PR therefore adds the option to configure the apiVersion in the settings. If no apiVersion is configured, the default OpenAI object is used for initialization.

I also noticed that it can happen, that the OpenAI model version deployed on Azure might not yet support the developer role. Therefore I also added the option to configure whether the developer role is supported or not, which defaults to true.

How to test

The reviewer would need to have an OpenAI model available in Azure and then configure a custom openai model like this:

{
  "ai-features.AiEnable.enableAI": true,
  "ai-features.openAiCustom.customOpenAiModels": [
    {
      "model": "gpt4o",
      "url": "<AZURE_OPENAI_API_BASE_URL>",
      "id": "azure-deployment",
      "apiKey": "<AZURE_OPENAI_API_KEY>",
      "apiVersion": "<AZURE_OPENAI_API_VERSION>",
      "supportsDeveloperMessage": false
    }
  ],
  "ai-features.agentSettings": {
    "Universal": {
      "languageModelRequirements": [
        {
          "purpose": "chat",
          "identifier": "azure-deployment"
        }
      ]
    },
    "Orchestrator": {
      "languageModelRequirements": [
        {
          "purpose": "agent-selection",
          "identifier": "azure-deployment"
        }
      ]
    }
  }
}

Of course a non Azure model deployment should still work as before.

Follow-ups

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Review checklist

Reminder for reviewers

* Add configuration of OpenAI API version
* Add configuration of supportsDeveloperMessage
* If OpenAI API version is configured, use AzureOpenAI

Fixes eclipse-theia#14711
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Waiting on reviewers
Development

Successfully merging this pull request may close these issues.

[Theia AI] Support Azure OpenAI
1 participant