import { Interaction, IPromptConfig, Prompt, IPromptEngine, Context, Dialog } from "./types"; export declare const DefaultPromptConfig: IPromptConfig; export declare class PromptEngine implements IPromptEngine { promptConfig: IPromptConfig; protected description?: string; protected examples: Interaction[]; protected flowResetText?: string; protected dialog: Interaction[]; constructor(description?: string, examples?: Interaction[], flowResetText?: string, promptConfig?: Partial); /** * * @param context ongoing context to add description to * @returns context with description added to it */ protected insertDescription(context: string): string; /** * * @param yaml * **/ loadYAML(yamlData: string): void; /** * * @param parsedYAML Yaml dict to load config from * **/ protected loadConfigYAML(parsedYAML: Record): void; /** * * @returns the stringified yaml representation of the prompt engine * **/ saveYAML(): string; /** * * @param context ongoing context to add examples to * @returns context with examples added to it */ protected insertExamples(context: string): string; /** * * @param context ongoing context to add description to * @returns context with description added to it */ protected insertFlowResetText(context: string): string; /** * @param context ongoing context to add dialogs to * @returns context with dialog added to it, only appending the last interactions if the context becomes too long */ protected insertInteractions(context: string, userInput?: string): string; /** * Throws an error if the context is longer than the max tokens */ private throwContextOverflowError; /** * * @param input Interaction input to add to the ongoing dialog * @param response Interaction response to add to the ongoing dialog */ addInteraction(input: string, response: string): void; /** * * @param interactions Interactions to add to the ongoing dialog */ addInteractions(interactions: Interaction[]): void; /** * Removes the first interaction from the dialog */ removeFirstInteraction(): Interaction; /** * Removes the last interaction from the dialog */ removeLastInteraction(): Interaction; /** * * @param input Example input to add to the examples * @param response Example output to add to the examples */ addExample(input: string, response: string): void; /** * * @param inputLength Length of the input string - used to determine how long the context can be * @returns A context string containing description, examples and ongoing interactions with the model */ buildContext(userInput?: string, multiTurn?: boolean): Context; /** * * @returns A reset context string containing description and examples without any previous interactions with the model */ resetContext(): Context; /** * * @param input Natural Language input from user * @returns A prompt string to pass a language model. This prompt * includes the description of the task and few shot examples of input -> response. * It then appends the current interaction history and the current input, * to effectively coax a new response from the model. */ buildPrompt(input: string, multiTurn?: boolean): Prompt; /** * * @returns It returns the built interaction history */ buildDialog(): Dialog; /** * @param naturalLanguage Natural Language input, e.g. 'Make a cube"' * @returns Natural Language formatted as a comment, e.g. /* Make a cube *\/ */ private formatInput; private formatOutput; protected stringifyInteraction: (interaction: Interaction) => string; protected stringifyInteractions: (interactions: Interaction[]) => string; protected assertTokenLimit(context?: string, userInput?: string): boolean; }