mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-14 07:12:00 +01:00
@@ -86,9 +86,11 @@ describe('OpenAIEndpoint - Reasoning Properties', () => {
|
||||
|
||||
describe('CAPI mode (useResponsesApi = false)', () => {
|
||||
it('should set cot_id and cot_summary properties when processing thinking content', () => {
|
||||
accessor.get(IConfigurationService).setConfig(ConfigKey.UseResponsesApi, false);
|
||||
const endpoint = instaService.createInstance(OpenAIEndpoint,
|
||||
modelMetadata,
|
||||
{
|
||||
...modelMetadata,
|
||||
supported_endpoints: [ModelSupportedEndpoint.ChatCompletions]
|
||||
},
|
||||
'test-api-key',
|
||||
'https://api.openai.com/v1/chat/completions');
|
||||
|
||||
@@ -105,9 +107,11 @@ describe('OpenAIEndpoint - Reasoning Properties', () => {
|
||||
});
|
||||
|
||||
it('should handle multiple messages with thinking content', () => {
|
||||
accessor.get(IConfigurationService).setConfig(ConfigKey.UseResponsesApi, false);
|
||||
const endpoint = instaService.createInstance(OpenAIEndpoint,
|
||||
modelMetadata,
|
||||
{
|
||||
...modelMetadata,
|
||||
supported_endpoints: [ModelSupportedEndpoint.ChatCompletions]
|
||||
},
|
||||
'test-api-key',
|
||||
'https://api.openai.com/v1/chat/completions');
|
||||
|
||||
@@ -136,7 +140,6 @@ describe('OpenAIEndpoint - Reasoning Properties', () => {
|
||||
|
||||
describe('Responses API mode (useResponsesApi = true)', () => {
|
||||
it('should preserve reasoning object when thinking is supported', () => {
|
||||
accessor.get(IConfigurationService).setConfig(ConfigKey.UseResponsesApi, true);
|
||||
accessor.get(IConfigurationService).setConfig(ConfigKey.ResponsesApiReasoningEffort, 'medium');
|
||||
accessor.get(IConfigurationService).setConfig(ConfigKey.ResponsesApiReasoningSummary, 'detailed');
|
||||
const endpoint = instaService.createInstance(OpenAIEndpoint,
|
||||
@@ -167,7 +170,6 @@ describe('OpenAIEndpoint - Reasoning Properties', () => {
|
||||
}
|
||||
};
|
||||
|
||||
accessor.get(IConfigurationService).setConfig(ConfigKey.UseResponsesApi, true);
|
||||
accessor.get(IConfigurationService).setConfig(ConfigKey.ResponsesApiReasoningEffort, 'medium');
|
||||
accessor.get(IConfigurationService).setConfig(ConfigKey.ResponsesApiReasoningSummary, 'detailed');
|
||||
const endpoint = instaService.createInstance(OpenAIEndpoint,
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { ConfigKey, IConfigurationService } from '../../../platform/configuration/common/configurationService';
|
||||
import { IChatModelInformation, ModelSupportedEndpoint } from '../../../platform/endpoint/common/endpointProvider';
|
||||
import { ILogService } from '../../../platform/log/common/logService';
|
||||
import { IFetcherService } from '../../../platform/networking/common/fetcherService';
|
||||
import { IExperimentationService } from '../../../platform/telemetry/common/nullExperimentationService';
|
||||
import { IInstantiationService } from '../../../util/vs/platform/instantiation/common/instantiation';
|
||||
import { BYOKAuthType, BYOKKnownModels, BYOKModelCapabilities } from '../common/byokProvider';
|
||||
import { BaseOpenAICompatibleLMProvider } from './baseOpenAICompatibleProvider';
|
||||
@@ -21,8 +19,6 @@ export class OAIBYOKLMProvider extends BaseOpenAICompatibleLMProvider {
|
||||
@IFetcherService _fetcherService: IFetcherService,
|
||||
@ILogService _logService: ILogService,
|
||||
@IInstantiationService _instantiationService: IInstantiationService,
|
||||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||
@IExperimentationService private readonly _expService: IExperimentationService
|
||||
) {
|
||||
super(
|
||||
BYOKAuthType.GlobalApiKey,
|
||||
@@ -38,13 +34,10 @@ export class OAIBYOKLMProvider extends BaseOpenAICompatibleLMProvider {
|
||||
|
||||
protected override async getModelInfo(modelId: string, apiKey: string | undefined, modelCapabilities?: BYOKModelCapabilities): Promise<IChatModelInformation> {
|
||||
const modelInfo = await super.getModelInfo(modelId, apiKey, modelCapabilities);
|
||||
const enableResponsesApi = this._configurationService.getExperimentBasedConfig(ConfigKey.UseResponsesApi, this._expService);
|
||||
if (enableResponsesApi) {
|
||||
modelInfo.supported_endpoints = [
|
||||
ModelSupportedEndpoint.ChatCompletions,
|
||||
ModelSupportedEndpoint.Responses
|
||||
];
|
||||
}
|
||||
modelInfo.supported_endpoints = [
|
||||
ModelSupportedEndpoint.ChatCompletions,
|
||||
ModelSupportedEndpoint.Responses
|
||||
];
|
||||
|
||||
return modelInfo;
|
||||
}
|
||||
|
||||
@@ -196,8 +196,7 @@ export class ChatEndpoint implements IChatEndpoint {
|
||||
return true;
|
||||
}
|
||||
|
||||
const enableResponsesApi = this._configurationService.getExperimentBasedConfig(ConfigKey.UseResponsesApi, this._expService);
|
||||
return !!(enableResponsesApi && this.modelMetadata.supported_endpoints?.includes(ModelSupportedEndpoint.Responses));
|
||||
return !!this.modelMetadata.supported_endpoints?.includes(ModelSupportedEndpoint.Responses);
|
||||
}
|
||||
|
||||
protected get useMessagesApi(): boolean {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TokenizerType } from '../../../../util/common/tokenizer';
|
||||
import { IInstantiationService } from '../../../../util/vs/platform/instantiation/common/instantiation';
|
||||
import { IAuthenticationService } from '../../../authentication/common/authentication';
|
||||
import { IChatMLFetcher } from '../../../chat/common/chatMLFetcher';
|
||||
import { ConfigKey, IConfigurationService } from '../../../configuration/common/configurationService';
|
||||
import { IConfigurationService } from '../../../configuration/common/configurationService';
|
||||
import { IEnvService } from '../../../env/common/envService';
|
||||
import { ILogService } from '../../../log/common/logService';
|
||||
import { isOpenAiFunctionTool } from '../../../networking/common/fetch';
|
||||
@@ -119,10 +119,6 @@ export class OpenAICompatibleTestEndpoint extends ChatEndpoint {
|
||||
? modelConfig.supported_endpoints
|
||||
: [ModelSupportedEndpoint.ChatCompletions]
|
||||
};
|
||||
// configurationService.useResponsesApi should be set to true if ModelSupportedEndpoint.Responses is in modelConfig.supported_endpoints
|
||||
if (modelInfo.supported_endpoints?.includes(ModelSupportedEndpoint.Responses)) {
|
||||
configurationService.setConfig(ConfigKey.UseResponsesApi, true);
|
||||
}
|
||||
|
||||
super(
|
||||
modelInfo,
|
||||
|
||||
Reference in New Issue
Block a user