UNPKG

hugbot

Version:

Chatbot maker for HuggingFace Inference API and other AI API providers and backends.

77 lines 1.83 kB
/** * AI Prompt formatter. Supports most of the common models with standard tag formats. * Does NOT support Mistral, use MistralPromptConstructor instead. * @param tags Use tags param to specify the prompt tag format. * @example * ```json * tags: { * bos: "", * system: "<|im_start|>system\n", * user: "<|im_start|>user\n", * bot: "<|im_start|>assistant\n", * closing: "<|im_end|>\n", * } * ``` * @method getPromptTemplate - Takes the MemoryDump object and returns formatted AI prompt. * @example * ```json * memoryDump: { * conversation: [ * { * role: "user", * input: "hi", * }, * { * role: "ai", * input: "Hello, how can I help you?" * }, * { * role: "user", * input: "Tell me something interesting" * } * ], * systemPrompt: "You are a helpful AI assistant." * responseAffirmation: "", * userInstruction: "" * } * ``` * * ===> * * ```string * <|im_start|>system * You are a helpful AI assistant.<|im_end|> * <|im_start|>user * hi<|im_end|> * <|im_start|>assistant * Hello, how can I help you?<|im_end> * <|im_start|>user * Tell me something interesting<|im_end|> * <|im_start>assistant * ``` */ export declare class PromptConstructor { #private; readonly tags: PromptTags; constructor(tags?: PromptTags); getPromptTemplate(memoryDump: MemoryDump): string; } type PromptTags = { bos: string; system: string; user: string; bot: string; closing: string; }; type MemoryEntry = { role: "user" | "ai"; input: string; }; type MemoryDump = { conversation: MemoryEntry[]; systemPrompt: string; responseAffirmation: string; userInstruction: string; }; export {}; //# sourceMappingURL=PromptConstructor.d.ts.map