contentTypes for tools

This commit is contained in:
Rob Lourens 2024-06-19 18:52:02 -07:00
parent 484cd68eff
commit 9d809f4def

View File

@ -5,6 +5,15 @@
declare module 'vscode' {
export interface LanguageModelToolResult {
/**
* The result can contain arbitrary representations of the content. An example might be 'prompt-tsx' to indicate an element that can be rendered with the @vscode/prompt-tsx library.
*/
[contentType: string]: any;
string: string;
}
export namespace lm {
/**
* Register a LanguageModelTool. The tool must also be registered in the package.json `languageModelTools` contribution point.
@ -18,8 +27,9 @@ declare module 'vscode' {
/**
* Invoke a tool with the given parameters.
* Could request a set of contentTypes to be returned so they don't all need to be computed.
*/
export function invokeTool(toolId: string, parameters: Object, token: CancellationToken): Thenable<string>;
export function invokeTool(toolId: string, parameters: Object, token: CancellationToken): Thenable<LanguageModelToolResult>;
}
export interface LanguageModelToolDescription {
@ -30,6 +40,6 @@ declare module 'vscode' {
}
export interface LanguageModelTool {
invoke(parameters: any, token: CancellationToken): Thenable<string>;
invoke(parameters: any, token: CancellationToken): Thenable<LanguageModelToolResult>;
}
}