/** * @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 } from './PromptSection'; import { PromptSectionBase } from './PromptSectionBase'; import { TurnContext } from 'botbuilder'; import { Tokenizer } from '../tokenizers'; import { Memory } from '../MemoryFork'; /** * A template section that will be rendered as a message. * @remarks * This section type is used to render a template as a message. The template can contain * parameters that will be replaced with values from memory or call functions to generate * dynamic content. * * Template syntax: * - `{{$memoryKey}}` - Renders the value of the specified memory key. * - `{{functionName}}` - Calls the specified function and renders the result. * - `{{functionName arg1 arg2 ...}}` - Calls the specified function with the provided list of arguments. * * Function arguments are optional and separated by spaces. They can be quoted using `'`, `"`, or `\`` delimiters. */ export declare class TemplateSection extends PromptSectionBase { private _parts; readonly template: string; readonly role: string; /** * Creates a new 'TemplateSection' instance. * @param {string} template - Template to use for this section. * @param {string} role - Message role to use for this section. * @param {number} tokens - Optional. Sizing strategy for this section. Defaults to `auto`. * @param {boolean} required - Optional. Indicates if this section is required. Defaults to `true`. * @param {string} separator - Optional. Separator to use between sections when rendering as text. Defaults to `\n`. * @param {string} textPrefix - Optional. Prefix to use for text output. Defaults to `undefined`. */ constructor(template: string, role: string, tokens?: number, required?: boolean, separator?: string, textPrefix?: string); /** * @private * @param {TurnContext} context - Context for the current turn of conversation with the user. * @param {Memory} memory - An interface for accessing state values. * @param {PromptFunctions} functions - An interface for calling functions. * @param {Tokenizer} tokenizer - Tokenizer to use when rendering the section. * @param {number} maxTokens - Maximum number of tokens allowed to be rendered. * @returns {Promise>} A promise that resolves to the rendered section. */ renderAsMessages(context: TurnContext, memory: Memory, functions: PromptFunctions, tokenizer: Tokenizer, maxTokens: number): Promise>; /** * @private */ private parseTemplate; /** * @private * @param {string} text - Text to render. * @returns {PartRenderer} A renderer that will render the specified text. */ private createTextRenderer; /** * @private * @param {string} name - Name of the variable to render. * @returns {PartRenderer} A renderer that will render the specified variable. */ private createVariableRenderer; /** * @private * @param {string} param - Function to render. * @returns {PartRenderer} A renderer that will render the specified function. */ private createFunctionRenderer; } //# sourceMappingURL=TemplateSection.d.ts.map