UNPKG

adpa-enterprise-framework-automation

Version:

Modular, standards-compliant Node.js/TypeScript automation framework for enterprise requirements, project, and data management. Provides CLI and API for BABOK v3, PMBOK 7th Edition, and DMBOK 2.0 (in progress). Production-ready Express.js API with TypeSpe

138 lines 4.04 kB
/** * Prompt Manager for AI Document Generation * * Manages prompt selection, context building, and prompt customization * for tailored AI content generation across different document types. * * @version 1.0.0 * @author Requirements Gathering Agent Team * @created 2024 * * Key Features: * - Intelligent prompt selection based on document type * - Context-aware prompt building * - Dynamic prompt customization * - Performance optimization and caching * * @filepath src/modules/ai/prompts/PromptManager.ts */ import { PromptTemplate } from './PromptRegistry.js'; import { ChatMessage } from '../types.js'; export interface PromptSelectionCriteria { /** Document type to generate */ documentType: string; /** Category preference */ category?: string; /** Required tags */ requiredTags?: string[]; /** Preferred tags for scoring */ preferredTags?: string[]; /** Maximum tokens allowed */ maxTokens?: number; /** Priority threshold */ minPriority?: number; } export interface PromptBuildOptions { /** Include enhanced context from related documents */ includeRelatedContext?: boolean; /** Maximum context length */ maxContextLength?: number; /** Custom context variables */ customVariables?: Record<string, string>; /** Override default structure instructions */ customStructure?: string; /** Override default quality criteria */ customQuality?: string; /** Enable metrics collection for prompt generation */ enableMetrics?: boolean; } export interface PromptMetrics { /** Prompt selection time in milliseconds */ selectionTime: number; /** Context building time in milliseconds */ contextBuildTime: number; /** Final prompt length in characters */ promptLength: number; /** Number of context sources used */ contextSources: number; /** Prompt template version used */ templateVersion: string; } /** * Manages AI prompt selection, building, and optimization */ export declare class PromptManager { private static instance; private promptRegistry; private contextCache; private promptMetrics; private constructor(); static getInstance(): PromptManager; /** * Build complete prompt for document generation */ buildPromptForDocument(documentType: string, projectContext: string, options?: PromptBuildOptions): Promise<{ messages: ChatMessage[]; metrics: PromptMetrics; } | null>; /** * Select the best prompt template for given criteria */ selectPromptTemplate(criteria: PromptSelectionCriteria): Promise<PromptTemplate | null>; /** * Build comprehensive context for prompt */ private buildPromptContext; /** * Select best prompt from candidates based on criteria */ private selectBestPromptFromCandidates; /** * Score a prompt template based on selection criteria */ private scorePromptTemplate; /** * Get generic prompt for document type as fallback */ private getGenericPromptForDocumentType; /** * Get related documents context */ private getRelatedDocumentsContext; /** * Extract stakeholder context from project context */ private getStakeholderContext; /** * Extract business domain context */ private getBusinessDomainContext; /** * Extract technical context */ private getTechnicalContext; /** * Count context sources used */ private countContextSources; /** * Get prompt performance metrics */ getPromptMetrics(documentType?: string): PromptMetrics[]; /** * Clear metrics cache */ clearMetrics(): void; /** * Get available document types */ getAvailableDocumentTypes(): string[]; /** * Validate prompt template */ validatePromptTemplate(template: PromptTemplate): { isValid: boolean; errors: string[]; }; } //# sourceMappingURL=PromptManager.d.ts.map