/** * @module teams-ai */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { Message } from './Message'; import { PromptFunctions } from './PromptFunctions'; import { RenderedPromptSection, PromptSection } from './PromptSection'; import { TurnContext } from 'botbuilder'; import { Tokenizer } from '../tokenizers'; import { Memory } from '../MemoryFork'; /** * Base layout engine that renders a set of `auto`, `fixed`, or `proportional` length sections. * @remarks * This class is used internally by the `Prompt` and `GroupSection` classes to render their sections. */ export declare class LayoutEngine implements PromptSection { readonly sections: PromptSection[]; readonly required: boolean; readonly tokens: number; readonly separator: string; /** * * @param {PromptSection[]} sections List of sections to layout. * @param {number} tokens Sizing strategy for this section. * @param {boolean} required Indicates if this section is required. * @param {string} separator Separator to use between sections when rendering as text. */ constructor(sections: PromptSection[], tokens: number, required: boolean, separator: string); /** * @private * @param {TurnContext} context Context for the current turn of conversation with the user. * @param {Memory} memory The current memory. * @param {PromptFunctions} functions The functions available to use in the prompt. * @param {Tokenizer} tokenizer Tokenizer to use when rendering as text. * @param {number} maxTokens Maximum number of tokens allowed. * @returns {Promise>} Rendered section. */ renderAsText(context: TurnContext, memory: Memory, functions: PromptFunctions, tokenizer: Tokenizer, maxTokens: number): Promise>; /** * @private * @param {TurnContext} context Context for the current turn of conversation with the user. * @param {Memory} memory The current memory. * @param {PromptFunctions} functions The functions available to use in the prompt. * @param {Tokenizer} tokenizer Tokenizer to use when rendering as text. * @param {number} maxTokens Maximum number of tokens allowed. * @returns {Promise>} Rendered section. */ renderAsMessages(context: TurnContext, memory: Memory, functions: PromptFunctions, tokenizer: Tokenizer, maxTokens: number): Promise>; /** * @private * @template T * @param {PromptSection[]} sections Sections to add to the layout. * @param {PromptSectionLayout[]} layout Layout to add the sections to. */ private addSectionsToLayout; /** * @private * @template T * @param {PromptSectionLayout[]} layout Layout to render. * @param {number} maxTokens Maximum number of tokens allowed. * @param {Function} cbFixed Callback to render a fixed section. * @param {Function} cbProportional Callback to render a proportional section. * @param {boolean} textLayout Indicates if the layout is being rendered as text. * @param {Tokenizer} tokenizer Tokenizer to use when rendering as text. * @returns {Promise} Number of tokens remaining. */ private layoutSections; /** * @private * @template T * @param {PromptSectionLayout[]} layout Layout to render. * @param {Function} callback Callback to render a fixed section of the layout. */ private layoutFixedSections; /** * @private * @template T * @param {PromptSectionLayout[]} layout Layout to render. * @param {Function} callback Callback to render a proportional section of the layout. */ private layoutProportionalSections; /** * @private * @template T * @param {PromptSectionLayout[]} layout Layout to get the length of. * @param {boolean} textLayout Indicates if the layout is being rendered as text. * @param {Tokenizer} tokenizer Tokenizer to use when rendering as text. * @returns {number} Length of the layout. */ private getLayoutLength; /** * @private * @template T * @param {PromptSectionLayout[]} layout Layout to drop the last optional section from. * @returns {boolean} True if an optional section was dropped, false otherwise. */ private dropLastOptionalSection; /** * @private * @template T * @param {PromptSectionLayout[]} layout Layout to check. * @returns {boolean} True if the layout needs more rendering, false otherwise. */ private needsMoreLayout; } //# sourceMappingURL=LayoutEngine.d.ts.map