Path: blob/main/extensions/copilot/src/extension/byok/vscode-node/openAIProvider.ts
13399 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/4import { IConfigurationService } from '../../../platform/configuration/common/configurationService';5import { IChatModelInformation, ModelSupportedEndpoint } from '../../../platform/endpoint/common/endpointProvider';6import { ILogService } from '../../../platform/log/common/logService';7import { IFetcherService } from '../../../platform/networking/common/fetcherService';8import { IExperimentationService } from '../../../platform/telemetry/common/nullExperimentationService';9import { IInstantiationService } from '../../../util/vs/platform/instantiation/common/instantiation';10import { BYOKKnownModels } from '../common/byokProvider';11import { AbstractOpenAICompatibleLMProvider } from './abstractLanguageModelChatProvider';12import { IBYOKStorageService } from './byokStorageService';1314export class OAIBYOKLMProvider extends AbstractOpenAICompatibleLMProvider {15public static readonly providerName = 'OpenAI';1617constructor(18knownModels: BYOKKnownModels,19byokStorageService: IBYOKStorageService,20@IFetcherService fetcherService: IFetcherService,21@ILogService logService: ILogService,22@IInstantiationService instantiationService: IInstantiationService,23@IConfigurationService configurationService: IConfigurationService,24@IExperimentationService expService: IExperimentationService25) {26super(27OAIBYOKLMProvider.providerName.toLowerCase(),28OAIBYOKLMProvider.providerName,29knownModels,30byokStorageService,31fetcherService,32logService,33instantiationService,34configurationService,35expService36);37}3839protected override getModelsBaseUrl(): string {40return 'https://api.openai.com/v1';41}4243protected override getModelInfo(modelId: string, modelUrl: string): IChatModelInformation {44const modelInfo = super.getModelInfo(modelId, modelUrl);45modelInfo.supported_endpoints = [46ModelSupportedEndpoint.ChatCompletions,47ModelSupportedEndpoint.Responses48];49return modelInfo;50}51}525354