some comments for concepts

This commit is contained in:
Johannes
2023-07-19 18:33:12 +02:00
parent 3cfa5b9ad4
commit 238c332119
2 changed files with 19 additions and 6 deletions
+14 -5
View File
@@ -5,6 +5,7 @@
declare module 'vscode' {
// ChatML
export enum ChatMessageRole {
System = 0,
User = 1,
@@ -12,6 +13,7 @@ declare module 'vscode' {
Function = 3,
}
// ChatML
export class ChatMessage {
role: ChatMessageRole;
content: string;
@@ -20,16 +22,14 @@ declare module 'vscode' {
constructor(role: ChatMessageRole, content: string);
}
// TODO: chat response builder
export interface ChatResponse {
message: ChatMessage;
}
export interface ChatResponseFragment {
index: number;
part: string;
}
/**
* Represents a large language model that accepts ChatML messages and produces a streaming response
*/
export interface ChatResponseProvider {
provideChatResponse(messages: ChatMessage[], options: { [name: string]: any }, progress: Progress<ChatResponseFragment>, token: CancellationToken): Thenable<any>;
}
@@ -40,6 +40,15 @@ declare module 'vscode' {
}
export namespace llm {
/**
* Register a LLM as chat response provider to the editor.
*
*
* @param id
* @param provider
* @param metadata
*/
export function registerChatResponseProvider(id: string, provider: ChatResponseProvider, metadata: ChatResponseProviderMetadata): Disposable;
}
+5 -1
View File
@@ -5,6 +5,10 @@
declare module 'vscode' {
/**
* Represents access to using a chat provider (LLM). Access is granted and temporary, usually only valid
* for the duration of an user interaction.
*/
export interface ChatAccess {
/**
@@ -31,7 +35,7 @@ declare module 'vscode' {
*
* *Note* that this function will throw an error unless an user interaction is currently active.
*
* @param id The id of the chat provider, e.g `chatgpt`
* @param id The id of the chat provider, e.g `copilot`
*/
export function requestChatAccess(id: string): Thenable<ChatAccess>;
}