Registry for managing prompt templates

Provides centralized storage and retrieval of prompt templates with:

  • Version management
  • Tag-based search
  • Bulk loading from files/directories
const registry: PromptRegistry = new InMemoryPromptRegistry();

// Register a template
registry.register(template);

// Get specific version
const v1 = registry.get('customer-support-greeting', '1.0.0');

// Get latest version
const latest = registry.getLatest('customer-support-greeting');

// Search by tags
const supportPrompts = registry.findByTags(['support']);
interface PromptRegistry {
    register(template: PromptTemplate): void;
    get(id: string, version?: string): undefined | PromptTemplate;
    getLatest(id: string): undefined | PromptTemplate;
    list(): PromptTemplate[];
    findByTags(tags: string[]): PromptTemplate[];
    findByModel(model: string): PromptTemplate[];
    has(id: string, version?: string): boolean;
    remove(id: string, version?: string): boolean;
    getVersions(id: string): PromptTemplate[];
    clear(): void;
}

Methods

  • Check if prompt exists

    Parameters

    • id: string

      Prompt identifier

    • Optionalversion: string

      Specific version (optional)

    Returns boolean

    True if exists

  • Remove a prompt

    Parameters

    • id: string

      Prompt identifier

    • Optionalversion: string

      Specific version (removes all versions if not specified)

    Returns boolean

    True if removed