@callmedayz/ai-prompt-toolkit
Version:
Professional AI prompt engineering toolkit with advanced template features, real-time dashboards, conditional logic, template inheritance, live monitoring, OpenRouter integration, and 310+ model support
87 lines • 2.52 kB
TypeScript
import { PromptTemplate } from './prompt-template';
import { AdvancedTemplateOptions, ConditionalResult, LoopResult } from './types';
/**
* Advanced Prompt Template System with Conditional Logic and Branching
* Extends the basic PromptTemplate with support for:
* - Conditional blocks (if/else)
* - Loops (for each)
* - Template inheritance
* - Custom functions
* - Dynamic composition
*/
export declare class AdvancedPromptTemplate extends PromptTemplate {
private advancedOptions;
private context;
private baseTemplate?;
constructor(options: AdvancedTemplateOptions);
/**
* Render the advanced template with conditional logic and loops
*/
render(variables?: Record<string, any>): string;
/**
* Process conditional blocks in the template
* Syntax: {{#if condition}}content{{#else}}alternative{{/if}}
*/
private processConditionals;
/**
* Process loop blocks in the template
* Syntax: {{#each items as item}}{{item.name}}{{/each}}
*/
private processLoops;
/**
* Process function calls in the template
* Syntax: {{function_name(arg1, arg2)}}
*/
private processFunctions;
/**
* Evaluate a conditional expression
*/
private evaluateCondition;
/**
* Safe evaluation of simple expressions
*/
private safeEvaluate;
/**
* Parse a value from string representation
*/
private parseValue;
/**
* Parse function arguments
*/
private parseArguments;
/**
* Build default functions available in templates
*/
private buildDefaultFunctions;
/**
* Set up template inheritance
*/
private setupInheritance;
/**
* Process template inheritance
* Syntax: {{#extends base}}...{{#block name}}content{{/block}}...{{/extends}}
*/
private processInheritance;
/**
* Get the effective template (considering inheritance)
*/
private getEffectiveTemplate;
/**
* Add custom function to the template context
*/
addFunction(name: string, func: Function): void;
/**
* Get all variable names used in the template (overrides parent method)
*/
getVariables(): string[];
/**
* Get template analysis including conditional and loop blocks
*/
analyze(): {
variables: string[];
conditionals: ConditionalResult[];
loops: LoopResult[];
functions: string[];
};
}
//# sourceMappingURL=advanced-prompt-template.d.ts.map