UNPKG

@convo-lang/convo-lang

Version:
44 lines (43 loc) 2.32 kB
import { Scope, ScopeRegistration } from "@iyio/common"; import { ConvoRagSearch, ConvoRagSearchResult, ConvoRagService } from "./convo-rag-types"; 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[]>, ConvoRagService { readonly serviceId = "http"; static fromScope(scope: Scope, endpoint?: string | string[]): 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>; relayConvertConvoToInputAsync(flat: FlatConvoConversationBase, inputType?: string): Promise<FlatConvoConversationBase>; searchAsync(search: ConvoRagSearch): Promise<ConvoRagSearchResult>; }