Type alias PromptTemplateFunction

PromptTemplateFunction: ((components, modelInfo, selectedContextualElements, config, estimateTokenCountFn) => Promise<FormattedPrompt>)

Function signature for prompt template implementations. Templates are responsible for taking all processed prompt components and formatting them into the final FormattedPrompt structure required by a specific LLM provider or model type.

Type declaration

    • (components, modelInfo, selectedContextualElements, config, estimateTokenCountFn): Promise<FormattedPrompt>
    • Parameters

      • components: Readonly<PromptComponents>

        The core and augmented prompt components.

      • modelInfo: Readonly<ModelTargetInfo>

        Information about the target AI model.

      • selectedContextualElements: ReadonlyArray<ContextualPromptElement>

        Contextual elements chosen for this prompt.

      • config: Readonly<PromptEngineConfig>

        A read-only view of the PromptEngine's current configuration.

      • estimateTokenCountFn: ((content, modelId?) => Promise<number>)

        A function to estimate token counts, useful within templates.

          • (content, modelId?): Promise<number>
          • Parameters

            • content: string
            • Optional modelId: string

            Returns Promise<number>

      Returns Promise<FormattedPrompt>

Returns

A promise that resolves to the final, formatted prompt.