mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-06-13 07:10:26 +08:00
Chat Agent Sample -> Chat Sample
fyi @roblourens
This commit is contained in:
52
chat-sample/src/vscode.proposed.chatVariableResolver.d.ts
vendored
Normal file
52
chat-sample/src/vscode.proposed.chatVariableResolver.d.ts
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'vscode' {
|
||||
|
||||
export namespace chat {
|
||||
|
||||
/**
|
||||
* Register a variable which can be used in a chat request to any participant.
|
||||
* @param name The name of the variable, to be used in the chat input as `#name`.
|
||||
* @param description A description of the variable for the chat input suggest widget.
|
||||
* @param resolver Will be called to provide the chat variable's value when it is used.
|
||||
*/
|
||||
export function registerChatVariableResolver(name: string, description: string, resolver: ChatVariableResolver): Disposable;
|
||||
}
|
||||
|
||||
export interface ChatVariableValue {
|
||||
/**
|
||||
* The detail level of this chat variable value. If possible, variable resolvers should try to offer shorter values that will consume fewer tokens in an LLM prompt.
|
||||
*/
|
||||
level: ChatVariableLevel;
|
||||
|
||||
/**
|
||||
* The variable's value, which can be included in an LLM prompt as-is, or the chat participant may decide to read the value and do something else with it.
|
||||
*/
|
||||
value: string | Uri;
|
||||
|
||||
/**
|
||||
* A description of this value, which could be provided to the LLM as a hint.
|
||||
*/
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface ChatVariableContext {
|
||||
/**
|
||||
* The message entered by the user, which includes this variable.
|
||||
*/
|
||||
prompt: string;
|
||||
}
|
||||
|
||||
export interface ChatVariableResolver {
|
||||
/**
|
||||
* A callback to resolve the value of a chat variable.
|
||||
* @param name The name of the variable.
|
||||
* @param context Contextual information about this chat request.
|
||||
* @param token A cancellation token.
|
||||
*/
|
||||
resolve(name: string, context: ChatVariableContext, token: CancellationToken): ProviderResult<ChatVariableValue[]>;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user