-
Notifications
You must be signed in to change notification settings - Fork 39.3k
Expand file tree
/
Copy pathvscode.proposed.lmTools.d.ts
More file actions
91 lines (69 loc) · 2.59 KB
/
vscode.proposed.lmTools.d.ts
File metadata and controls
91 lines (69 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// version: 2
// https://github.com/microsoft/vscode/issues/213274
declare module 'vscode' {
// TODO@API capabilities
export type JSONSchema = object;
// API -> LM: an tool/function that is available to the language model
export interface LanguageModelChatFunction {
name: string;
description: string;
parametersSchema?: JSONSchema;
}
// API -> LM: add tools as request option
export interface LanguageModelChatRequestOptions {
// TODO@API this will a heterogeneous array of different types of tools
tools?: LanguageModelChatFunction[];
}
// LM -> USER: function that should be used
export class LanguageModelChatResponseFunctionUsePart {
name: string;
parameters: any;
constructor(name: string, parameters: any);
}
// LM -> USER: text chunk
export class LanguageModelChatResponseTextPart {
value: string;
constructor(value: string);
}
export interface LanguageModelChatResponse {
stream: AsyncIterable<LanguageModelChatResponseTextPart | LanguageModelChatResponseFunctionUsePart>;
}
// USER -> LM: the result of a function call
export class LanguageModelChatMessageFunctionResultPart {
name: string;
content: string;
isError: boolean;
constructor(name: string, content: string, isError?: boolean);
}
export interface LanguageModelChatMessage {
content2: string | LanguageModelChatMessageFunctionResultPart;
}
// Tool registration/invoking between extensions
export namespace lm {
/**
* Register a LanguageModelTool. The tool must also be registered in the package.json `languageModelTools` contribution point.
*/
export function registerTool(name: string, tool: LanguageModelTool): Disposable;
/**
* A list of all available tools.
*/
export const tools: ReadonlyArray<LanguageModelToolDescription>;
/**
* Invoke a tool with the given parameters.
*/
export function invokeTool(name: string, parameters: Object, token: CancellationToken): Thenable<string>;
}
// Is the same as LanguageModelChatFunction now, but could have more details in the future
export interface LanguageModelToolDescription {
name: string;
description: string;
parametersSchema?: JSONSchema;
}
export interface LanguageModelTool {
invoke(parameters: any, token: CancellationToken): Thenable<string>;
}
}