Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/platform/endpoint/node/proxyModelHelper.ts
13400 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { ExperimentBasedConfig, IConfigurationService } from '../../configuration/common/configurationService';
7
import { IProxyModelsService } from '../../proxyModels/common/proxyModelsService';
8
import { IExperimentationService } from '../../telemetry/common/nullExperimentationService';
9
10
/**
11
* Determines which model to use for instant apply endpoints.
12
* Uses the proxy models service when available, falling back to the config-based model name.
13
*/
14
export function getInstantApplyModel(
15
configurationService: IConfigurationService,
16
experimentationService: IExperimentationService,
17
proxyModelsService: IProxyModelsService,
18
modelNameConfig: ExperimentBasedConfig<string>,
19
): string {
20
const instantApplyModels = proxyModelsService.instantApplyModels;
21
22
return (instantApplyModels && instantApplyModels.length > 0)
23
? instantApplyModels[0].name
24
: configurationService.getExperimentBasedConfig(modelNameConfig, experimentationService);
25
}
26
27