diff --git a/src/vs/platform/extensions/common/extensionsApiProposals.ts b/src/vs/platform/extensions/common/extensionsApiProposals.ts index 1b5e8eb0eca..60cbefc0ffb 100644 --- a/src/vs/platform/extensions/common/extensionsApiProposals.ts +++ b/src/vs/platform/extensions/common/extensionsApiProposals.ts @@ -52,7 +52,7 @@ const _allApiProposals = { }, chatProvider: { proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatProvider.d.ts', - version: 1 + version: 2 }, chatReferenceBinaryData: { proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatReferenceBinaryData.d.ts', diff --git a/src/vs/workbench/api/common/extHostLanguageModels.ts b/src/vs/workbench/api/common/extHostLanguageModels.ts index 075f231de50..c2ce6c8a004 100644 --- a/src/vs/workbench/api/common/extHostLanguageModels.ts +++ b/src/vs/workbench/api/common/extHostLanguageModels.ts @@ -197,7 +197,7 @@ export class ExtHostLanguageModels implements ExtHostLanguageModelsShape { isUserSelectable: m.isUserSelectable, modelPickerCategory: m.category ?? DEFAULT_MODEL_PICKER_CATEGORY, capabilities: m.capabilities ? { - vision: m.capabilities.vision, + vision: m.capabilities.imageInput, toolCalling: !!m.capabilities.toolCalling, agentMode: !!m.capabilities.toolCalling } : undefined, @@ -278,7 +278,7 @@ export class ExtHostLanguageModels implements ExtHostLanguageModelsShape { value = data.provider.provideLanguageModelChatResponse( knownModel.info, messages.value.map(typeConvert.LanguageModelChatMessage2.to), - { ...options, modelOptions: options.modelOptions ?? {}, extensionId: ExtensionIdentifier.toKey(from) }, + { ...options, modelOptions: options.modelOptions ?? {}, requestInitiator: ExtensionIdentifier.toKey(from) }, progress, token ); diff --git a/src/vscode-dts/vscode.proposed.chatProvider.d.ts b/src/vscode-dts/vscode.proposed.chatProvider.d.ts index b8a4eaa6d78..424f10bfa86 100644 --- a/src/vscode-dts/vscode.proposed.chatProvider.d.ts +++ b/src/vscode-dts/vscode.proposed.chatProvider.d.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -// version: 1 +// version: 2 declare module 'vscode' { @@ -12,15 +12,16 @@ declare module 'vscode' { */ export interface LanguageModelChatRequestHandleOptions { - // initiator - // TODO@API Do we need this? - readonly extensionId: string; + /** + * What extension initiated the request to the language model + */ + readonly requestInitiator: string; /** * A set of options that control the behavior of the language model. These options are specific to the language model * and need to be looked up in the respective documentation. */ - readonly modelOptions: { readonly [name: string]: any }; + readonly modelOptions?: { readonly [name: string]: any }; /** * An optional list of tools that are available to the language model. These could be registered tools available via @@ -92,11 +93,25 @@ declare module 'vscode' { * When present, this gates the use of `requestLanguageModelAccess` behind an authorization flow where * the user must approve of another extension accessing the models contributed by this extension. * Additionally, the extension can provide a label that will be shown in the UI. - * The label should indicate why the user is being asked to approve access. */ requiresAuthorization?: true | { label: string }; - // TODO@API isPreselected proposed + + readonly capabilities?: { + + /** + * Whether image input is supported by the model. + * Common supported images are jpg and png, but each model will vary in supported mimetypes. + */ + readonly imageInput?: boolean; + + /** + * Whether tool calling is supported by the model. + * If a number is provided, that is the maximum number of tools a model can call. + */ + readonly toolCalling?: boolean | number; + }; + /** * Whether or not this will be selected by default in the model picker * NOT BEING FINALIZED @@ -109,18 +124,6 @@ declare module 'vscode' { */ readonly isUserSelectable?: boolean; - readonly capabilities?: { - - // TODO@API have mimeTypes that you support - readonly vision?: boolean; - - /** - * Whether tool calling is supported by the model. - * If a number is provided, that is the maximum number of tools a model can call. - */ - readonly toolCalling?: boolean | number; - }; - /** * Optional category to group models by in the model picker. * The lower the order, the higher the category appears in the list. @@ -132,7 +135,7 @@ declare module 'vscode' { } /** - * The provider version of { @link LanguageModelChatMessage}. + * The provider version of {@linkcode LanguageModelChatMessage}. */ export interface LanguageModelChatRequestMessage { /** @@ -152,6 +155,8 @@ declare module 'vscode' { readonly name: string | undefined; } + export type LanguageModelResponsePart = LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart | LanguageModelDataPart | LanguageModelThinkingPart; + /** * Represents a Language model chat provider. This provider provides multiple models in a 1 provider to many model relationship * An example of this would be how an OpenAI provider would provide models like gpt-5, o3, etc. @@ -172,14 +177,15 @@ declare module 'vscode' { prepareLanguageModelChatInformation(options: PrepareLanguageModelChatModelOptions, token: CancellationToken): ProviderResult; /** - * Returns the response for a chat request + * Returns the response for a chat request, passing the results to the progress callback * @param model The language model to use * @param messages The messages to include in the request * @param options Options for the request * @param progress The progress to emit the streamed response chunks to * @param token A cancellation token for the request + * @returns A promise that resolves when the response is complete. Results are actually passed to the progress callback. */ - provideLanguageModelChatResponse(model: T, messages: readonly LanguageModelChatRequestMessage[], options: LanguageModelChatRequestHandleOptions, progress: Progress, token: CancellationToken): Thenable; + provideLanguageModelChatResponse(model: T, messages: readonly LanguageModelChatRequestMessage[], options: LanguageModelChatRequestHandleOptions, progress: Progress, token: CancellationToken): Thenable; /** * Returns the number of tokens for a given text using the model specific tokenizer logic