UNPKG

promptforge

Version:

Adaptive Prompt Intelligence & Orchestration SDK - Manage, optimize, and serve prompts for LLMs with versioning, feedback loops, and multi-provider support

75 lines 1.96 kB
import { PromptTemplate } from '../types.js'; export interface TemplateContext { [key: string]: string | number | boolean | undefined; } export declare class TemplateEngine { /** * Render a template with provided context */ render(template: PromptTemplate, context: TemplateContext): string; /** * Render with system prompt if provided */ renderWithSystem(template: PromptTemplate, context: TemplateContext): { system?: string; user: string; }; /** * Parse template from YAML format */ parseYAML(content: string): { content: string; variables?: string[]; systemPrompt?: string; examples?: Array<{ input: Record<string, string>; output: string; }>; }; /** * Parse template from JSON format */ parseJSON(content: string): { content: string; variables?: string[]; systemPrompt?: string; examples?: Array<{ input: Record<string, string>; output: string; }>; }; /** * Validate template syntax */ validate(template: PromptTemplate): { valid: boolean; errors: string[]; }; /** * Extract variables from template content */ extractVariables(content: string): string[]; /** * Render variables in a string */ private renderVariables; /** * Create a template string from examples */ createFromExamples(examples: Array<{ input: Record<string, string>; output: string; }>): string; /** * Merge multiple templates */ merge(templates: PromptTemplate[], separator?: string): string; /** * Create a chain of templates */ chain(templates: PromptTemplate[], context: TemplateContext): Array<{ step: number; content: string; }>; } //# sourceMappingURL=template-engine.d.ts.map