@theia/ai-openai v1.59.0
Description
The @theia/ai-openai integrates OpenAI's models with Theia AI.
The OpenAI API key and the models to use can be configured via preferences.
Alternatively the OpenAI API key can also be handed in via the OPENAI_API_KEY variable.
Custom models
The extension also supports OpenAI compatible models hosted on different end points.
You can configure the end points via the ai-features.openAiCustom.customOpenAiModels preference:
{
model: string,
url: string,
id?: string,
apiKey?: string | true,
apiVersion?: string | true,
developerMessageSettings?: 'user' | 'system' | 'developer' | 'mergeWithFollowingUserMessage' | 'skip',
enableStreaming?: boolean
}modelandurlare mandatory attributes, indicating the end point and model to useidis an optional attribute which is used in the UI to refer to this configurationapiKeyis either the key to access the API served at the given URL ortrueto use the global OpenAI API key. If not given 'no-key' will be used.apiVersionis either the api version to access the API served at the given URL in Azure ortrueto use the global OpenAI API version.developerMessageSettingsControls the handling of system messages:user,system, anddeveloperwill be used as a role,mergeWithFollowingUserMessagewill prefix the following user message with the system message or convert the system message to user message if the next message is not a user message.skipwill just remove the system message. Defaulting todeveloper.enableStreamingis a flag that indicates whether the streaming API shall be used or not.trueby default.
Azure OpenAI
To use a custom OpenAI model hosted on Azure, the AzureOpenAI class needs to be used, as described in the
openai-node docs.
Requests to an OpenAI model hosted on Azure need an apiVersion. To configure a custom OpenAI model in Theia you therefore need to configure the apiVersion with the end point.
Note that if you don't configure an apiVersion, the default OpenAI object is used for initialization and a connection to an Azure hosted OpenAI model will fail.
An OpenAI model version deployed on Azure might not support the developer role. In that case it is possible to configure whether the developer role is supported or not via the
developerMessageSettings option, e.g. setting it to system or user.
The following snippet shows a possible configuration to access an OpenAI model hosted on Azure. The AZURE_OPENAI_API_BASE_URL needs to be given without the /chat/completions
path and without the api-version parameter, e.g. https://<my_prefix>.openai.azure.com/openai/deployments/<my_deployment>
{
"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>",
"developerMessageSettings": "system"
}
],
"ai-features.agentSettings": {
"Universal": {
"languageModelRequirements": [
{
"purpose": "chat",
"identifier": "azure-deployment"
}
]
},
"Orchestrator": {
"languageModelRequirements": [
{
"purpose": "agent-selection",
"identifier": "azure-deployment"
}
]
}
}
}Additional Information
License
- Eclipse Public License 2.0
- 一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception
Trademark
"Theia" is a trademark of the Eclipse Foundation https://www.eclipse.org/theia
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago