@@ -14,7 +14,7 @@ declare module 'vscode' {
14
14
15
15
16
16
// TODO@API name scheme
17
- export interface LanguageModelChatResponseOptions {
17
+ export interface LanguageModelChatRequestHandleOptions {
18
18
19
19
// initiator
20
20
readonly extensionId : string ;
@@ -44,17 +44,99 @@ declare module 'vscode' {
44
44
toolMode ?: LanguageModelChatToolMode ;
45
45
}
46
46
47
- export interface LanguageModelChatData {
48
- // like ChatResponseProviderMetadata
47
+ // TODO@API names: LanguageModelChatMetadata, LanguageModelChatItem
48
+ export interface LanguageModelChatInformation {
49
+
50
+ // TODO@API IMPLICT from package-json registration
51
+ // readonly vendor: string;
52
+
53
+ readonly id : string ;
54
+
55
+ /**
56
+ * Human-readable name of the language model.
57
+ */
58
+ readonly name : string ;
59
+ /**
60
+ * Opaque family-name of the language model. Values might be `gpt-3.5-turbo`, `gpt4`, `phi2`, or `llama`
61
+ * but they are defined by extensions contributing languages and subject to change.
62
+ */
63
+ readonly family : string ;
64
+
65
+ /**
66
+ * An optional, human-readable description of the language model.
67
+ */
68
+ readonly description ?: string ;
69
+
70
+ /**
71
+ * An optional, human-readable string representing the cost of using the language model.
72
+ */
73
+ readonly cost ?: string ;
74
+
75
+ /**
76
+ * Opaque version string of the model. This is defined by the extension contributing the language model
77
+ * and subject to change while the identifier is stable.
78
+ */
79
+ readonly version : string ;
80
+
81
+ readonly maxInputTokens : number ;
82
+
83
+ readonly maxOutputTokens : number ;
84
+
85
+ /**
86
+ * When present, this gates the use of `requestLanguageModelAccess` behind an authorization flow where
87
+ * the user must approve of another extension accessing the models contributed by this extension.
88
+ * Additionally, the extension can provide a label that will be shown in the UI.
89
+ */
90
+ auth ?: true | { label : string } ;
91
+
92
+ // TODO@API maybe an enum, LanguageModelChatProviderPickerAvailability?
93
+ // TODO@API isPreselected proposed
94
+ readonly isDefault ?: boolean ;
95
+
96
+ // TODO@API nuke
97
+ readonly isUserSelectable ?: boolean ;
98
+
99
+ readonly capabilities ?: {
100
+
101
+ // TODO@API have mimeTypes that you support
102
+ readonly vision ?: boolean ;
103
+
104
+ // TODO@API should be `boolean | number` so extensions can express how many tools they support
105
+ readonly toolCalling ?: boolean | number ;
106
+
107
+ // TODO@API DO NOT SUPPORT THIS
108
+ // readonly agentMode?: boolean;
109
+
110
+ // TODO@API support prompt TSX style messages, MAYBE leave it out for now
111
+ readonly promptTsx ?: boolean ;
112
+ } ;
113
+
114
+ /**
115
+ * Optional category to group models by in the model picker.
116
+ * The lower the order, the higher the category appears in the list.
117
+ * Has no effect if `isUserSelectable` is `false`.
118
+ * If not specified, the model will appear in the "Other Models" category.
119
+ */
120
+ readonly category ?: { label : string ; order : number } ;
49
121
}
50
122
51
- export interface LanguageModelChatProvider2 {
123
+ export interface LanguageModelChatProvider2 < T extends LanguageModelChatInformation = LanguageModelChatInformation > {
124
+
125
+ // signals a change from the provider to the editor so that prepareLanguageModelChat is called again
126
+ onDidChange ?: Event < void > ;
52
127
53
- provideLanguageModelChatData ( options : { force : boolean } , token : CancellationToken ) : ProviderResult < LanguageModelChatData [ ] > ;
128
+ // NOT cacheable (between reloads)
129
+ prepareLanguageModelChat ( options : { silent : boolean } , token : CancellationToken ) : ProviderResult < T [ ] > ;
54
130
55
- provideResponse ( model : LanguageModelChatData , messages : Array < LanguageModelChatMessage | LanguageModelChatMessage2 > , options : LanguageModelChatResponseOptions , progress : Progress < LanguageModelTextPart | LanguageModelToolCallPart > , token : CancellationToken ) : Thenable < any > ;
131
+ provideLanguageModelChatResponse ( model : T , messages : Array < LanguageModelChatMessage | LanguageModelChatMessage2 > , options : LanguageModelChatRequestHandleOptions , progress : Progress < LanguageModelTextPart | LanguageModelToolCallPart > , token : CancellationToken ) : Thenable < any > ;
132
+
133
+ provideTokenCount ( model : T , text : string | LanguageModelChatMessage | LanguageModelChatMessage2 , token : CancellationToken ) : Thenable < number > ;
134
+ }
135
+
136
+ export namespace lm {
56
137
57
- provideTokenCount ( model : LanguageModelChatData , text : string | LanguageModelChatMessage | LanguageModelChatMessage2 , token : CancellationToken ) : Thenable < number > ;
138
+ //
139
+ // export function registerChatModelProvider(vendor: string, provider: LanguageModelChatProvider2): Disposable;
58
140
}
59
141
60
142
0 commit comments