/** * Process Modeling Service * * High-level service that combines LLM-based generation, error handling, * and user feedback refinement for creating process models. * * This service implements the complete workflow from the paper: * 1. Generate initial model from description * 2. Validate and handle errors * 3. Incorporate user feedback * 4. Refine iteratively */ import { PowlModel } from "./index.js"; import { RefinementLoop, UserFeedback } from "./refinement-loop.js"; /** * Configuration for the process modeling service */ export interface ProcessModelingConfig { maxRefinementIterations?: number; autoFixErrors?: boolean; enableConformanceChecking?: boolean; } /** * Result of model generation */ export interface ModelGenerationResult { model: PowlModel | null; iterations: number; errors: string[]; warnings: string[]; conversationHistory: Array<{ role: string; content: string; }>; } /** * Result of model refinement */ export interface ModelRefinementResult { model: PowlModel | null; success: boolean; iterations: number; feedbackIncorporated: number; error?: string; } /** * Process Modeling Service - Main API for LLM-based process modeling */ export declare class ProcessModelingService { private powl; private errorHandler; private refinementLoop; private llmCall; private config; /** * Create a new process modeling service * * @param llmCall Async function that calls an LLM with a prompt and returns the response * @param config Optional configuration */ constructor(llmCall: (prompt: string) => Promise, config?: ProcessModelingConfig); /** * Initialize the POWL WASM module */ private ensureInitialized; /** * Generate a process model from a natural language description * * This is the main entry point for creating process models. * It handles the complete workflow: * 1. Create initial prompt with role, knowledge, examples * 2. Call LLM to generate model code * 3. Validate and handle errors * 4. Return the parsed POWL model * * @param description Natural language description of the process * @returns Generated model with metadata */ generateModel(description: string): Promise; /** * Start a refinement session for iterative model improvement * * @param originalDescription The original process description * @param initialModel The initial generated model */ startRefinementSession(originalDescription: string, initialModel: PowlModel): void; /** * Add user feedback and refine the model * * @param feedback User feedback (text or visual) * @returns Refined model */ addFeedbackAndRefine(feedback: UserFeedback): Promise; /** * Get the current refinement session state */ getRefinementSession(): RefinementLoop | null; /** * End the current refinement session */ endRefinementSession(): void; /** * Validate a model against an event log * * @param model The POWL model to validate * @param log Event log (XES or CSV) * @returns Conformance checking result */ validateModel(model: PowlModel, log: string): Promise<{ percentage: number; avgTraceFitness: number; }>; /** * Generate a summary report of the refinement session */ generateRefinementReport(): string; /** * Extract Python code from LLM response */ private extractCode; /** * Convert Python-style model generation code to POWL string * * This is a simplified implementation. In practice, you would: * 1. Parse the Python code * 2. Extract the model structure * 3. Convert to POWL string representation * * For now, we try to extract the POWL string directly or use a placeholder. */ private codeToPowlString; /** * Get the current service configuration */ getConfig(): ProcessModelingConfig; /** * Update the service configuration */ updateConfig(config: Partial): void; } /** * Convenience function to create a process modeling service * * @param llmCall Async function that calls an LLM * @param config Optional configuration * @returns Configured service instance */ export declare function createProcessModelingService(llmCall: (prompt: string) => Promise, config?: ProcessModelingConfig): ProcessModelingService; //# sourceMappingURL=process-modeling-service.d.ts.map