Path: blob/main/src/vscode-dts/vscode.proposed.chatProvider.d.ts
5257 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*--------------------------------------------------------------------------------------------*/45// version: 467declare module 'vscode' {89/**10* The provider version of {@linkcode LanguageModelChatRequestOptions}11*/12export interface ProvideLanguageModelChatResponseOptions {1314/**15* What extension initiated the request to the language model16*/17readonly requestInitiator: string;18}1920/**21* All the information representing a single language model contributed by a {@linkcode LanguageModelChatProvider}.22*/23export interface LanguageModelChatInformation {2425/**26* When present, this gates the use of `requestLanguageModelAccess` behind an authorization flow where27* the user must approve of another extension accessing the models contributed by this extension.28* Additionally, the extension can provide a label that will be shown in the UI.29* A common example of a label is an account name that is signed in.30*31*/32requiresAuthorization?: true | { label: string };3334/**35* A multiplier indicating how many requests this model counts towards a quota.36* For example, "2x" means each request counts twice.37*/38readonly multiplier?: string;3940/**41* A numeric form of the `multiplier` label42*/43readonly multiplierNumeric?: number;4445/**46* Whether or not this will be selected by default in the model picker47* NOT BEING FINALIZED48*/49readonly isDefault?: boolean | { [K in ChatLocation]?: boolean };5051/**52* Whether or not the model will show up in the model picker immediately upon being made known via {@linkcode LanguageModelChatProvider.provideLanguageModelChatInformation}.53* NOT BEING FINALIZED54*/55readonly isUserSelectable?: boolean;5657/**58* Optional category to group models by in the model picker.59* The lower the order, the higher the category appears in the list.60* Has no effect if `isUserSelectable` is `false`.61*62* WONT BE FINALIZED63*/64readonly category?: { label: string; order: number };6566readonly statusIcon?: ThemeIcon;67}6869export interface LanguageModelChatCapabilities {70/**71* The tools the model prefers for making file edits. If not provided or if none of the tools,72* are recognized, the editor will try multiple edit tools and pick the best one. The available73* edit tools WILL change over time and this capability only serves as a hint to the editor.74*75* Edit tools currently recognized include:76* - 'find-replace': Find and replace text in a document.77* - 'multi-find-replace': Find and replace multiple text snippets across documents.78* - 'apply-patch': A file-oriented diff format used by some OpenAI models79* - 'code-rewrite': A general but slower editing tool that allows the model80* to rewrite and code snippet and provide only the replacement to the editor.81*82* The order of edit tools in this array has no significance; all of the recognized edit83* tools will be made available to the model.84*/85readonly editTools?: string[];86}8788export type LanguageModelResponsePart2 = LanguageModelResponsePart | LanguageModelDataPart | LanguageModelThinkingPart;8990export interface LanguageModelChatProvider<T extends LanguageModelChatInformation = LanguageModelChatInformation> {91provideLanguageModelChatInformation(options: PrepareLanguageModelChatModelOptions, token: CancellationToken): ProviderResult<T[]>;92provideLanguageModelChatResponse(model: T, messages: readonly LanguageModelChatRequestMessage[], options: ProvideLanguageModelChatResponseOptions, progress: Progress<LanguageModelResponsePart2>, token: CancellationToken): Thenable<void>;93}9495/**96* The list of options passed into {@linkcode LanguageModelChatProvider.provideLanguageModelChatInformation}97*/98export interface PrepareLanguageModelChatModelOptions {99/**100* Configuration for the model. This is only present if the provider has declared that it requires configuration via the `configuration` property.101* The object adheres to the schema that the extension provided during declaration.102*/103readonly configuration?: {104readonly [key: string]: any;105};106}107}108109110