{"version":3,"file":"length_based.d.ts","names":["Example","BaseExampleSelector","PromptTemplate","LengthBasedExampleSelectorInput","LengthBasedExampleSelector","Promise"],"sources":["../../src/example_selectors/length_based.d.ts"],"sourcesContent":["import { Example } from \"../prompts/base.js\";\nimport { BaseExampleSelector } from \"./base.js\";\nimport { PromptTemplate } from \"../prompts/prompt.js\";\n/**\n * Interface for the input parameters of the LengthBasedExampleSelector\n * class.\n */\nexport interface LengthBasedExampleSelectorInput {\n    examplePrompt: PromptTemplate;\n    maxLength?: number;\n    getTextLength?: (text: string) => number;\n}\n/**\n * A specialized example selector that selects examples based on their\n * length, ensuring that the total length of the selected examples does\n * not exceed a specified maximum length.\n * @example\n * ```typescript\n * const exampleSelector = new LengthBasedExampleSelector(\n *   [\n *     { input: \"happy\", output: \"sad\" },\n *     { input: \"tall\", output: \"short\" },\n *     { input: \"energetic\", output: \"lethargic\" },\n *     { input: \"sunny\", output: \"gloomy\" },\n *     { input: \"windy\", output: \"calm\" },\n *   ],\n *   {\n *     examplePrompt: new PromptTemplate({\n *       inputVariables: [\"input\", \"output\"],\n *       template: \"Input: {input}\\nOutput: {output}\",\n *     }),\n *     maxLength: 25,\n *   },\n * );\n * const dynamicPrompt = new FewShotPromptTemplate({\n *   exampleSelector,\n *   examplePrompt: new PromptTemplate({\n *     inputVariables: [\"input\", \"output\"],\n *     template: \"Input: {input}\\nOutput: {output}\",\n *   }),\n *   prefix: \"Give the antonym of every input\",\n *   suffix: \"Input: {adjective}\\nOutput:\",\n *   inputVariables: [\"adjective\"],\n * });\n * console.log(dynamicPrompt.format({ adjective: \"big\" }));\n * console.log(\n *   dynamicPrompt.format({\n *     adjective:\n *       \"big and huge and massive and large and gigantic and tall and much much much much much bigger than everything else\",\n *   }),\n * );\n * ```\n */\nexport declare class LengthBasedExampleSelector extends BaseExampleSelector {\n    protected examples: Example[];\n    examplePrompt!: PromptTemplate;\n    getTextLength: (text: string) => number;\n    maxLength: number;\n    exampleTextLengths: number[];\n    constructor(data: LengthBasedExampleSelectorInput);\n    /**\n     * Adds an example to the list of examples and calculates its length.\n     * @param example The example to be added.\n     * @returns Promise that resolves when the example has been added and its length calculated.\n     */\n    addExample(example: Example): Promise<void>;\n    /**\n     * Calculates the lengths of the examples.\n     * @param v Array of lengths of the examples.\n     * @param values Instance of LengthBasedExampleSelector.\n     * @returns Promise that resolves with an array of lengths of the examples.\n     */\n    calculateExampleTextLengths(v: number[], values: LengthBasedExampleSelector): Promise<number[]>;\n    /**\n     * Selects examples until the total length of the selected examples\n     * reaches the maxLength.\n     * @param inputVariables The input variables for the examples.\n     * @returns Promise that resolves with an array of selected examples.\n     */\n    selectExamples(inputVariables: Example): Promise<Example[]>;\n    /**\n     * Creates a new instance of LengthBasedExampleSelector and adds a list of\n     * examples to it.\n     * @param examples Array of examples to be added.\n     * @param args Input parameters for the LengthBasedExampleSelector.\n     * @returns Promise that resolves with a new instance of LengthBasedExampleSelector with the examples added.\n     */\n    static fromExamples(examples: Example[], args: LengthBasedExampleSelectorInput): Promise<LengthBasedExampleSelector>;\n}\n"],"mappings":";;;;;;;;AAOA;AA8CA;AAA+C,UA9C9BG,+BAAAA,CA8C8B;EAAA,aACvBH,EA9CLE,cA8CKF;EAAO,SACXE,CAAAA,EAAAA,MAAAA;EAAc,aAIZC,CAAAA,EAAAA,CAAAA,IAAAA,EAAAA,MAAAA,EAAAA,GAAAA,MAAAA;;;;;;;;;;;;;AANqD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAtDC,0BAAAA,SAAmCH,mBAAAA;sBAChCD;kBACJE;;;;oBAIEC;;;;;;sBAMEH,UAAUK;;;;;;;mDAOmBD,6BAA6BC;;;;;;;iCAO/CL,UAAUK,QAAQL;;;;;;;;gCAQnBA,iBAAiBG,kCAAkCE,QAAQD"}