-
Notifications
You must be signed in to change notification settings - Fork 0
/
vscode.proposed.chatProvider.d.ts
86 lines (63 loc) · 3.05 KB
/
vscode.proposed.chatProvider.d.ts
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
/*---------------------------------------------------------------------------------------------
* 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 interface ChatResponseFragment {
index: number;
part: string;
}
export interface ChatResponseFragment2 {
index: number;
part: LanguageModelChatResponseTextPart | LanguageModelChatResponseToolCallPart;
}
// @API extension ship a d.ts files for their options
/**
* Represents a large language model that accepts ChatML messages and produces a streaming response
*/
export interface LanguageModelChatProvider {
onDidReceiveLanguageModelResponse2?: Event<{ readonly extensionId: string; readonly participant?: string; readonly tokenCount?: number }>;
provideLanguageModelResponse(messages: LanguageModelChatMessage[], options: { [name: string]: any }, extensionId: string, progress: Progress<ChatResponseFragment>, token: CancellationToken): Thenable<any>;
provideLanguageModelResponse2?(messages: LanguageModelChatMessage[], options: LanguageModelChatRequestOptions, extensionId: string, progress: Progress<ChatResponseFragment2>, token: CancellationToken): Thenable<any>;
provideTokenCount(text: string | LanguageModelChatMessage, token: CancellationToken): Thenable<number>;
}
export type ChatResponseProvider = LanguageModelChatProvider;
export interface ChatResponseProviderMetadata {
readonly vendor: string;
/**
* Human-readable name of the language model.
*/
readonly name: string;
/**
* Opaque family-name of the language model. Values might be `gpt-3.5-turbo`, `gpt4`, `phi2`, or `llama`
* but they are defined by extensions contributing languages and subject to change.
*/
readonly family: string;
/**
* Opaque version string of the model. This is defined by the extension contributing the language model
* and subject to change while the identifier is stable.
*/
readonly version: string;
readonly maxInputTokens: number;
readonly maxOutputTokens: number;
/**
* 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.
*/
auth?: true | { label: string };
}
export interface ChatResponseProviderMetadata {
// limit this provider to some extensions
extensions?: string[];
}
export namespace chat {
/**
* @deprecated use `lm.registerChatResponseProvider` instead
*/
export function registerChatResponseProvider(id: string, provider: ChatResponseProvider, metadata: ChatResponseProviderMetadata): Disposable;
}
export namespace lm {
export function registerChatModelProvider(id: string, provider: LanguageModelChatProvider, metadata: ChatResponseProviderMetadata): Disposable;
}
}