@convo-lang/convo-lang
Version:
A Conversational Language
40 lines (39 loc) • 1.96 kB
TypeScript
import { Scope, ScopeRegistration } from "@iyio/common";
import { ConvoCompletionMessage, ConvoCompletionService, ConvoModelInfo, FlatConvoConversationBase } from "./convo-types";
export declare const defaultConvoHttpEndpointPrefix = "/convo-lang";
export declare const defaultConvoHttpApiEndpointPrefix: string;
export declare const httpConvoCompletionEndpointParam: import("@iyio/common").ParamTypeDef<string>;
export declare const convoHttpRelayModule: (scope: ScopeRegistration) => void;
export interface HttpConvoCompletionServiceOptions {
/**
* Endpoint to relay messages to. If an array is provided load balancing will be preformed
* by evenly distributing request between each URL.
*/
endpoint: string | string[];
}
/**
* Forwards messages to an convo-lang api endpoint or pool of convo-lang api endpoints.
*
* ## Endpoint structure
*
* ### POST /completion (flat:FlatConvoConversationBase) => ConvoCompletionMessage[]
* Completes a posted flat conversation and returns the completed messages.
*
* ### POST /convo (convo:string) => string
* Completes a convo conversation as a string and returns the completed messages as a string
*
* ### GET /models ()=>ConvoModelInfo[]
* Returns all models known to the server
*/
export declare class HttpConvoCompletionService implements ConvoCompletionService<FlatConvoConversationBase, ConvoCompletionMessage[]> {
static fromScope(scope: Scope): HttpConvoCompletionService;
readonly inputType = "FlatConvoConversation";
readonly outputType = "ConvoCompletionMessageAry";
private readonly endpoint;
constructor({ endpoint }: HttpConvoCompletionServiceOptions);
canComplete(model: string | undefined, flat: FlatConvoConversationBase): boolean;
private endpointIndex;
private getEndpoint;
completeConvoAsync(flat: FlatConvoConversationBase): Promise<ConvoCompletionMessage[]>;
getModelsAsync(): Promise<ConvoModelInfo[] | undefined>;
}