Skip to content

Commit fb3098d

Browse files
Splits out Azure provider from OpenAI Compatible providers
1 parent 5a82e2f commit fb3098d

File tree

9 files changed

+442
-32
lines changed

9 files changed

+442
-32
lines changed

docs/telemetry-events.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
'failed.reason': 'user-declined' | 'user-cancelled' | 'error',
125125
'input.length': number,
126126
'model.id': string,
127-
'model.provider.id': 'anthropic' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
127+
'model.provider.id': 'anthropic' | 'azure' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
128128
'model.provider.name': string,
129129
'output.length': number,
130130
'retry.count': number,
@@ -155,7 +155,7 @@
155155
'failed.reason': 'user-declined' | 'user-cancelled' | 'error',
156156
'input.length': number,
157157
'model.id': string,
158-
'model.provider.id': 'anthropic' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
158+
'model.provider.id': 'anthropic' | 'azure' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
159159
'model.provider.name': string,
160160
'output.length': number,
161161
'retry.count': number,
@@ -185,7 +185,7 @@ or
185185
'failed.reason': 'user-declined' | 'user-cancelled' | 'error',
186186
'input.length': number,
187187
'model.id': string,
188-
'model.provider.id': 'anthropic' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
188+
'model.provider.id': 'anthropic' | 'azure' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
189189
'model.provider.name': string,
190190
'output.length': number,
191191
'retry.count': number,
@@ -214,7 +214,7 @@ or
214214
'failed.reason': 'user-declined' | 'user-cancelled' | 'error',
215215
'input.length': number,
216216
'model.id': string,
217-
'model.provider.id': 'anthropic' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
217+
'model.provider.id': 'anthropic' | 'azure' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
218218
'model.provider.name': string,
219219
'output.length': number,
220220
'retry.count': number,
@@ -243,7 +243,7 @@ or
243243
'failed.reason': 'user-declined' | 'user-cancelled' | 'error',
244244
'input.length': number,
245245
'model.id': string,
246-
'model.provider.id': 'anthropic' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
246+
'model.provider.id': 'anthropic' | 'azure' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
247247
'model.provider.name': string,
248248
'output.length': number,
249249
'retry.count': number,
@@ -272,7 +272,7 @@ or
272272
'failed.reason': 'user-declined' | 'user-cancelled' | 'error',
273273
'input.length': number,
274274
'model.id': string,
275-
'model.provider.id': 'anthropic' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
275+
'model.provider.id': 'anthropic' | 'azure' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
276276
'model.provider.name': string,
277277
'output.length': number,
278278
'retry.count': number,
@@ -295,7 +295,7 @@ or
295295
```typescript
296296
{
297297
'model.id': string,
298-
'model.provider.id': 'anthropic' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
298+
'model.provider.id': 'anthropic' | 'azure' | 'deepseek' | 'gemini' | 'github' | 'gitkraken' | 'huggingface' | 'ollama' | 'openai' | 'openaicompatible' | 'openrouter' | 'vscode' | 'xai',
299299
'model.provider.name': string
300300
}
301301
```

package.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4047,7 +4047,7 @@
40474047
"null"
40484048
],
40494049
"default": null,
4050-
"pattern": "^((anthropic|deepseek|gemini|github|huggingface|ollama|openai|openaicompatible|openrouter|xai):([\\w.-:]+)|gitkraken|vscode)$",
4050+
"pattern": "^((anthropic|azure|deepseek|gemini|github|huggingface|ollama|openai|openaicompatible|openrouter|xai):([\\w.-:]+)|gitkraken|vscode)$",
40514051
"markdownDescription": "Specifies the AI provider and model to use for GitLens' AI features. Should be formatted as `provider:model` (e.g. `openai:gpt-4o` or `anthropic:claude-3-5-sonnet-latest`), `gitkraken` for GitKraken AI provided models, or `vscode` for models provided by the VS Code extension API (e.g. Copilot)",
40524052
"scope": "window",
40534053
"order": 10,
@@ -4102,22 +4102,35 @@
41024102
"null"
41034103
],
41044104
"default": null,
4105-
"markdownDescription": "Specifies a custom URL to use for access to an OpenAI model via Azure. Azure URLs should be in the following format: https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}/chat/completions?api-version={api-version}",
4105+
"markdownDescription": "Specifies a custom URL to use for access to an OpenAI model.",
41064106
"scope": "window",
41074107
"order": 31,
41084108
"tags": [
41094109
"preview"
41104110
]
41114111
},
4112+
"gitlens.ai.azure.url": {
4113+
"type": [
4114+
"string",
4115+
"null"
4116+
],
4117+
"default": null,
4118+
"markdownDescription": "Specifies a custom URL to use for access to an Azure OpenAI model. Azure URLs should be in the following format: https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}/chat/completions?api-version={api-version}",
4119+
"scope": "window",
4120+
"order": 32,
4121+
"tags": [
4122+
"preview"
4123+
]
4124+
},
41124125
"gitlens.ai.openaicompatible.url": {
41134126
"type": [
41144127
"string",
41154128
"null"
41164129
],
41174130
"default": null,
4118-
"markdownDescription": "Specifies a custom URL to use for access to an OpenAI-compatible model. Azure URLs should be in the following format: https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}/chat/completions?api-version={api-version}",
4131+
"markdownDescription": "Specifies a custom URL to use for access to an OpenAI-compatible model.",
41194132
"scope": "window",
4120-
"order": 31,
4133+
"order": 33,
41214134
"tags": [
41224135
"preview"
41234136
]

src/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ export interface AdvancedConfig {
210210
}
211211

212212
interface AIConfig {
213+
readonly azure: {
214+
readonly url: string | null;
215+
};
213216
readonly explainChanges: {
214217
readonly customInstructions: string;
215218
};

src/constants.ai.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { AIProviderDescriptor } from './plus/ai/models/model';
22

33
export type AIProviders =
44
| 'anthropic'
5+
| 'azure'
56
| 'deepseek'
67
| 'gemini'
78
| 'github'
@@ -39,9 +40,16 @@ export const openAIProviderDescriptor: AIProviderDescriptor<'openai'> = {
3940
requiresAccount: true,
4041
requiresUserKey: true,
4142
} as const;
43+
export const azureProviderDescriptor: AIProviderDescriptor<'azure'> = {
44+
id: 'azure',
45+
name: 'Azure',
46+
primary: false,
47+
requiresAccount: true,
48+
requiresUserKey: true,
49+
} as const;
4250
export const openAICompatibleProviderDescriptor: AIProviderDescriptor<'openaicompatible'> = {
4351
id: 'openaicompatible',
44-
name: 'OpenAI-Compatible Provider (Azure, etc.)',
52+
name: 'OpenAI-Compatible Provider',
4553
primary: false,
4654
requiresAccount: true,
4755
requiresUserKey: true,

src/plus/ai/aiProviderService.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { CancellationTokenSource, env, EventEmitter, window } from 'vscode';
33
import type { AIPrimaryProviders, AIProviderAndModel, AIProviders, SupportedAIModels } from '../../constants.ai';
44
import {
55
anthropicProviderDescriptor,
6+
azureProviderDescriptor,
67
deepSeekProviderDescriptor,
78
geminiProviderDescriptor,
89
githubProviderDescriptor,
@@ -149,6 +150,13 @@ const supportedAIProviders = new Map<AIProviders, AIProviderDescriptorWithType>(
149150
type: lazy(async () => (await import(/* webpackChunkName: "ai" */ './openaiProvider')).OpenAIProvider),
150151
},
151152
],
153+
[
154+
'azure',
155+
{
156+
...azureProviderDescriptor,
157+
type: lazy(async () => (await import(/* webpackChunkName: "ai" */ './azureProvider')).AzureProvider),
158+
},
159+
],
152160
[
153161
'openaicompatible',
154162
{

0 commit comments

Comments
 (0)