@memberjunction/ai-prompts 3.4.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,64 @@
1
- /// <reference types="node" />
2
1
  import { ChatResult, ChatMessage } from '@memberjunction/ai';
3
2
  import { AIPromptRunResult } from '@memberjunction/ai-core-plus';
4
3
  import { AIModelEntityExtended, AIPromptEntityExtended, AIPromptRunEntityExtended } from "@memberjunction/ai-core-plus";
5
4
  import { TemplateMessageRole, AIPromptParams } from '@memberjunction/ai-core-plus';
5
+ /**
6
+ * Advanced AI Prompt execution engine with comprehensive template support, hierarchical template composition,
7
+ * sophisticated model selection, parallelization, output validation, and execution tracking.
8
+ *
9
+ * ## Core Features
10
+ * - **Template-based prompt generation** using MJ Templates system
11
+ * - **Hierarchical template composition** with depth-first rendering and parallel template processing
12
+ * - **Advanced model selection** strategies (Default, Specific, ByPower)
13
+ * - **Parallel execution** with multiple models and execution groups
14
+ * - **Structured output validation** and type conversion with retry logic
15
+ * - **Comprehensive execution tracking** with agent run linking
16
+ * - **Configuration-driven behavior** with caching and performance optimization
17
+ * - **Real-time progress updates** and streaming response support
18
+ *
19
+ * ## Hierarchical Template Composition
20
+ * When `childPrompts` array is provided in {@link AIPromptParams}:
21
+ * 1. Renders child prompt templates in depth-first manner (children before parents)
22
+ * 2. At each level, renders sibling templates in parallel for optimal performance
23
+ * 3. Recursively handles grandchild templates (unlimited nesting depth)
24
+ * 4. Substitutes rendered child templates into corresponding placeholders in parent template
25
+ * 5. Executes the final composed prompt as a single operation
26
+ *
27
+ * This enables complex prompt composition patterns where templates can be built from reusable
28
+ * sub-templates, creating sophisticated prompts through hierarchical template inheritance.
29
+ *
30
+ * ## Agent Integration
31
+ * - Links executions to agent runs via `agentRunId` parameter
32
+ * - Supports agent decision-making workflows with structured JSON responses
33
+ * - Enables hierarchical template patterns in AI agents
34
+ *
35
+ * @example Basic Usage
36
+ * ```typescript
37
+ * const runner = new AIPromptRunner();
38
+ * const params = new AIPromptParams();
39
+ * params.prompt = aiPrompt;
40
+ * params.data = { key: 'value' };
41
+ * const result = await runner.ExecutePrompt(params);
42
+ * ```
43
+ *
44
+ * @example Hierarchical Template Composition
45
+ * ```typescript
46
+ * const params = new AIPromptParams();
47
+ * params.prompt = parentPrompt;
48
+ * params.childPrompts = [
49
+ * new ChildPromptParam(analysisPrompt, 'analysis'),
50
+ * new ChildPromptParam(summaryPrompt, 'summary'),
51
+ * new ChildPromptParam(complexChild, 'complex') // This can have its own child templates
52
+ * ];
53
+ * params.data = { userInput: 'complex data to process' };
54
+ * const result = await runner.ExecutePrompt(params);
55
+ * // Child templates render first, then parent template uses {{ analysis }}, {{ summary }}, {{ complex }}
56
+ * // Final composed prompt is executed once
57
+ * ```
58
+ */
59
+ /**
60
+ * Represents a model-vendor pair candidate for execution
61
+ */
6
62
  interface ModelVendorCandidate {
7
63
  model: AIModelEntityExtended;
8
64
  vendorId?: string;
@@ -15,6 +71,9 @@ interface ModelVendorCandidate {
15
71
  priority: number;
16
72
  source: 'explicit' | 'prompt-model' | 'model-type' | 'power-rank';
17
73
  }
74
+ /**
75
+ * Configuration for failover behavior when primary model fails
76
+ */
18
77
  interface FailoverConfiguration {
19
78
  strategy: 'SameModelDifferentVendor' | 'NextBestModel' | 'PowerRank' | 'None';
20
79
  maxAttempts: number;
@@ -22,6 +81,9 @@ interface FailoverConfiguration {
22
81
  modelStrategy?: 'PreferSameModel' | 'PreferDifferentModel' | 'RequireSameModel';
23
82
  errorScope?: 'All' | 'NetworkOnly' | 'RateLimitOnly' | 'ServiceErrorOnly';
24
83
  }
84
+ /**
85
+ * Tracks information about a failover attempt
86
+ */
25
87
  interface FailoverAttempt {
26
88
  attemptNumber: number;
27
89
  modelId: string;
@@ -38,8 +100,21 @@ export declare class AIPromptRunner {
38
100
  private _parallelCoordinator;
39
101
  private _jsonValidator;
40
102
  constructor();
103
+ /**
104
+ * Performs robust validation of an API key
105
+ * @returns true if the API key is valid (not null, undefined, or empty/whitespace)
106
+ */
41
107
  private isValidAPIKey;
108
+ /**
109
+ * Internal logging helper that wraps LogStatusEx with verbose control
110
+ * @param message The message to log
111
+ * @param verboseOnly Whether this is a verbose-only message
112
+ * @param params Optional prompt parameters for custom verbose check
113
+ */
42
114
  protected logStatus(message: string, verboseOnly?: boolean, params?: AIPromptParams): void;
115
+ /**
116
+ * Helper method for enhanced error logging with metadata
117
+ */
43
118
  protected logError(error: Error | string, options?: {
44
119
  category?: string;
45
120
  metadata?: Record<string, any>;
@@ -48,78 +123,541 @@ export declare class AIPromptRunner {
48
123
  severity?: 'warning' | 'error' | 'critical';
49
124
  maxErrorLength?: number;
50
125
  }): void;
126
+ /**
127
+ * Checks if a model vendor is configured as an inference provider
128
+ * @param modelVendor The model vendor to check
129
+ * @returns true if the vendor is an inference provider
130
+ */
51
131
  private isInferenceProvider;
132
+ /**
133
+ * Resolves credentials for AI model execution using a hierarchical resolution system.
134
+ *
135
+ * Resolution priority (highest to lowest):
136
+ * 1. Per-request override: params.credentialId
137
+ * 2. Prompt-Model specific: AIPromptModel.CredentialID
138
+ * 3. Model-Vendor specific: AIModelVendor.CredentialID
139
+ * 4. Vendor default: AIVendor.CredentialID
140
+ * 5. Legacy: params.apiKeys[] array
141
+ * 6. Legacy: AI_VENDOR_API_KEY__<DRIVER> environment variables
142
+ *
143
+ * IMPORTANT: When ANY credential ID is found (priorities 1-4), the system uses
144
+ * the Credentials path and ignores legacy methods (priorities 5-6).
145
+ *
146
+ * @param driverClass - The driver class name (e.g., 'OpenAILLM')
147
+ * @param promptId - The prompt ID for looking up AIPromptModel credentials
148
+ * @param modelId - The model ID for looking up AIPromptModel and AIModelVendor credentials
149
+ * @param vendorId - The vendor ID for looking up AIModelVendor and AIVendor credentials
150
+ * @param params - The prompt execution parameters containing contextUser and optional credentialId
151
+ * @returns The API key/configuration string to pass to the LLM constructor
152
+ */
52
153
  private resolveCredentialForExecution;
154
+ /**
155
+ * Attempts to resolve credentials from bindings with priority-based failover.
156
+ * Tries each binding in priority order until one succeeds.
157
+ */
53
158
  private tryCredentialBindingsWithFailover;
159
+ /**
160
+ * Attempts to resolve a single credential, returning null on failure for failover support.
161
+ */
54
162
  private tryResolveCredential;
163
+ /**
164
+ * Resolves a credential by its explicit ID (used for per-request override).
165
+ * This does not support failover since it's an explicit choice.
166
+ */
55
167
  private resolveCredentialById;
168
+ /**
169
+ * Finds a default credential matching a specific credential type.
170
+ */
56
171
  private findDefaultCredentialByType;
172
+ /**
173
+ * Checks if credentials are available for a given model-vendor combination.
174
+ * This is a pre-flight check used during model selection to determine which
175
+ * candidates have valid authentication configured.
176
+ *
177
+ * Checks the credential hierarchy:
178
+ * 1. Per-request override: params.credentialId
179
+ * 2. PromptModel bindings: AICredentialBinding WHERE BindingType='PromptModel'
180
+ * 3. ModelVendor bindings: AICredentialBinding WHERE BindingType='ModelVendor'
181
+ * 4. Vendor bindings: AICredentialBinding WHERE BindingType='Vendor'
182
+ * 5. Type-based default: Credential.IsDefault=1 matching AIVendor.CredentialTypeID
183
+ * 6. Legacy: params.apiKeys[] array
184
+ * 7. Legacy: AI_VENDOR_API_KEY__<DRIVER> environment variables
185
+ *
186
+ * @param driverClass - The driver class name (e.g., 'OpenAILLM')
187
+ * @param promptId - The prompt ID for looking up AIPromptModel bindings
188
+ * @param modelId - The model ID for looking up AIPromptModel and AIModelVendor bindings
189
+ * @param vendorId - The vendor ID for looking up AIModelVendor and AIVendor bindings
190
+ * @param params - The prompt execution parameters
191
+ * @returns true if credentials are available, false otherwise
192
+ */
57
193
  private hasCredentialsAvailable;
194
+ /**
195
+ * Executes an AI prompt with full support for templates, model selection, and validation.
196
+ *
197
+ * @param params Parameters for prompt execution
198
+ * @returns Promise<AIPromptRunResult<T>> The execution result with tracking information
199
+ *
200
+ * @example
201
+ * ```typescript
202
+ * // Execute with specific result type
203
+ * interface AnalysisResult {
204
+ * sentiment: string;
205
+ * score: number;
206
+ * keywords: string[];
207
+ * }
208
+ *
209
+ * const result = await promptRunner.ExecutePrompt<AnalysisResult>({
210
+ * prompt: sentimentPrompt,
211
+ * data: { text: "Customer feedback text" }
212
+ * });
213
+ *
214
+ * if (result.success && result.result) {
215
+ * // result.result is typed as AnalysisResult
216
+ * console.log(`Sentiment: ${result.result.sentiment}, Score: ${result.result.score}`);
217
+ * }
218
+ * ```
219
+ */
58
220
  ExecutePrompt<T = unknown>(params: AIPromptParams): Promise<AIPromptRunResult<T>>;
221
+ /**
222
+ * Executes a single prompt (non-parallel) using traditional model selection.
223
+ *
224
+ * @param prompt - The AI prompt to execute
225
+ * @param renderedPromptText - The rendered prompt text
226
+ * @param params - Original execution parameters
227
+ * @param startTime - Execution start time
228
+ * @returns Promise<AIPromptRunResult<T>> - The execution result
229
+ */
59
230
  private executeSinglePrompt;
231
+ /**
232
+ * Executes a prompt using parallel execution with multiple models/tasks.
233
+ *
234
+ * @param prompt - The AI prompt to execute
235
+ * @param renderedPromptText - The rendered prompt text
236
+ * @param params - Original execution parameters
237
+ * @param startTime - Execution start time
238
+ * @returns Promise<AIPromptRunResult<T>> - The aggregated execution result
239
+ */
60
240
  private executePromptInParallel;
241
+ /**
242
+ * Loads a template entity by ID
243
+ */
61
244
  private loadTemplate;
245
+ /**
246
+ * Renders child prompt templates in a depth-first manner, composing them into a final template.
247
+ *
248
+ * @param childPrompts - Array of child prompts to render templates for
249
+ * @param params - Original execution parameters for context
250
+ * @param cancellationToken - Cancellation token for aborting rendering
251
+ * @returns Promise with rendered templates map
252
+ */
62
253
  private renderChildPromptTemplates;
254
+ /**
255
+ * Renders a prompt template with child prompt templates merged into the data context.
256
+ *
257
+ * @param prompt - The AI prompt to render
258
+ * @param params - Original execution parameters
259
+ * @param childTemplates - Map of placeholder names to rendered child prompt templates
260
+ * @returns Promise<string> - The rendered prompt text with child templates embedded
261
+ */
63
262
  private renderPromptWithChildTemplates;
263
+ /**
264
+ * Selects the appropriate AI model based on prompt configuration and parameters.
265
+ * Uses the unified buildModelVendorCandidates method to create an ordered list of candidates,
266
+ * then selects the first one with an available API key.
267
+ */
64
268
  private selectModel;
269
+ /**
270
+ * Builds a unified, ordered list of model-vendor candidates based on all selection criteria.
271
+ * Uses a 3-phase approach to properly handle SelectionStrategy='Specific' with AIPromptModel priorities.
272
+ *
273
+ * Phase 1: Handle explicit model ID (highest priority)
274
+ * Phase 2: Check if SelectionStrategy='Specific' with AIPromptModel entries - use ONLY those with AIPromptModel priorities
275
+ * Phase 3: Use general selection strategy (fallback) - blended priorities from legacy behavior
276
+ *
277
+ * @param prompt - The AI prompt with selection criteria
278
+ * @param explicitModelId - Explicitly specified model ID (highest priority)
279
+ * @param configurationId - Configuration ID for filtering
280
+ * @param preferredVendorId - Preferred vendor ID
281
+ * @returns Ordered array of model-vendor candidates (highest priority first)
282
+ */
65
283
  private buildModelVendorCandidates;
284
+ /**
285
+ * PHASE 1: Build candidates for explicitly specified model ID.
286
+ * Returns candidates for the single model if it's active and compatible.
287
+ */
66
288
  private buildCandidatesForExplicitModel;
289
+ /**
290
+ * PHASE 2: Build candidates for 'Specific' selection strategy.
291
+ * Uses AIPromptModel configuration with clean ranking:
292
+ * 1. Config-matching models first (by priority DESC)
293
+ * 2. Then universal (null config) models (by priority DESC)
294
+ */
67
295
  private buildCandidatesForSpecificStrategy;
296
+ /**
297
+ * PHASE 3: Build candidates for general selection strategies ('Default' or 'ByPower').
298
+ * Uses configuration-aware fallback hierarchy with legacy blended priority calculation.
299
+ */
68
300
  private buildCandidatesForGeneralSelection;
301
+ /**
302
+ * Helper: Filter prompt models by configuration matching rules.
303
+ * Supports configuration inheritance - includes models from the entire inheritance chain.
304
+ */
69
305
  private filterPromptModelsByConfiguration;
306
+ /**
307
+ * Helper: Sort prompt models for 'Specific' strategy.
308
+ * Respects configuration inheritance chain - child configs first, then parents, then null-config.
309
+ * Within each config level, sorts by priority DESC.
310
+ */
70
311
  private sortPromptModelsForSpecificStrategy;
312
+ /**
313
+ * Helper: Build candidates from sorted AIPromptModel records.
314
+ * Expands VendorID=null to all vendors for that model.
315
+ */
71
316
  private buildCandidatesFromPromptModels;
317
+ /**
318
+ * Helper: Create candidate for specific vendor from AIPromptModel.
319
+ */
72
320
  private createCandidateForSpecificVendor;
321
+ /**
322
+ * Helper: Create candidates for all vendors of a model, sorted by vendor priority.
323
+ */
73
324
  private createCandidatesForAllVendors;
325
+ /**
326
+ * Helper: Get prompt models for configuration with inheritance chain fallback.
327
+ * Walks the configuration inheritance chain looking for prompt models.
328
+ * Returns models from the first config in the chain that has any, or falls back to null-config.
329
+ */
74
330
  private getPromptModelsForConfiguration;
331
+ /**
332
+ * Helper: Add prompt-specific candidates with blended priorities (legacy behavior).
333
+ */
75
334
  private addPromptSpecificCandidates;
335
+ /**
336
+ * Helper: Add configuration fallback candidates from the inheritance chain.
337
+ * Adds models from parent configs (with decreasing priority) and null-config models as final fallback.
338
+ */
76
339
  private addConfigurationFallbackCandidates;
340
+ /**
341
+ * Helper: Add strategy-based candidates when no prompt models exist.
342
+ */
77
343
  private addStrategyBasedCandidates;
344
+ /**
345
+ * Helper: Get model pool filtered for strategy.
346
+ */
78
347
  private getModelPoolForStrategy;
348
+ /**
349
+ * Helper: Sort model pool by selection strategy.
350
+ */
79
351
  private sortModelPoolByStrategy;
352
+ /**
353
+ * Helper: Sort models by power preference.
354
+ */
80
355
  private sortByPowerPreference;
356
+ /**
357
+ * Helper: Create candidates for a model with AIModelVendor priorities (legacy behavior).
358
+ */
81
359
  private createCandidatesForModel;
360
+ /**
361
+ * Creates a properly typed AIModelSelectionInfo instance.
362
+ * TypeScript requires instantiating the class to get the getValidCandidates() method.
363
+ */
82
364
  private createSelectionInfo;
365
+ /**
366
+ * Converts model selection info into ModelVendorCandidate array for retry logic.
367
+ * Extracts only the valid candidates (those with available API keys) from the selection info.
368
+ *
369
+ * @param selectionInfo - Model selection information containing considered models
370
+ * @returns Array of valid model-vendor candidates sorted by priority
371
+ */
83
372
  private buildCandidatesFromSelectionInfo;
373
+ /**
374
+ * Enhanced version of selectModelWithAPIKey that tracks all considered models
375
+ * for model selection reporting. Uses the hierarchical credential resolution
376
+ * system to check for available credentials.
377
+ *
378
+ * @param candidates - Ordered array of model-vendor candidates
379
+ * @param promptId - The prompt ID for credential resolution
380
+ * @param params - Optional prompt parameters for verbose logging and credential override
381
+ * @returns Object containing selected candidate and all considered models
382
+ */
84
383
  private selectModelWithAPIKeyTracked;
384
+ /**
385
+ * Creates an AIPromptRun entity for execution tracking
386
+ */
85
387
  private createPromptRun;
388
+ /**
389
+ * Renders the prompt template with provided data
390
+ */
86
391
  private renderPromptTemplate;
392
+ /**
393
+ * Executes the AI model with failover support
394
+ *
395
+ * @remarks
396
+ * This method wraps the core executeModel functionality with intelligent failover
397
+ * capabilities. It will attempt to execute with different models/vendors according
398
+ * to the configured failover strategy when errors occur.
399
+ *
400
+ * The method calls several smaller, focused helper methods:
401
+ * - buildFailoverCandidates: Creates candidate models based on type restrictions
402
+ * - createCandidatesFromModels: Converts models to vendor-specific candidates
403
+ * - updatePromptRunWithFailoverSuccess: Records successful failover metadata
404
+ * - updatePromptRunWithFailoverFailure: Records failed failover metadata
405
+ * - createFailoverErrorResult: Creates standardized error response
406
+ */
87
407
  protected executeModelWithFailover(model: AIModelEntityExtended, renderedPrompt: string, prompt: AIPromptEntityExtended, params: AIPromptParams, vendorId: string | null, conversationMessages?: ChatMessage[], templateMessageRole?: TemplateMessageRole, cancellationToken?: AbortSignal, allCandidates?: ModelVendorCandidate[], promptRun?: AIPromptRunEntityExtended, vendorDriverClass?: string, vendorApiName?: string, vendorSupportsEffortLevel?: boolean, modelEffortLevel?: number): Promise<ChatResult>;
408
+ /**
409
+ * Builds failover candidates for a prompt based on available models and type restrictions
410
+ */
88
411
  protected buildFailoverCandidates(prompt: AIPromptEntityExtended): Promise<ModelVendorCandidate[]>;
412
+ /**
413
+ * Creates model-vendor candidates from a list of models
414
+ */
89
415
  protected createCandidatesFromModels(models: AIModelEntityExtended[]): ModelVendorCandidate[];
416
+ /**
417
+ * Updates prompt run with successful failover tracking data
418
+ */
90
419
  protected updatePromptRunWithFailoverSuccess(promptRun: AIPromptRunEntityExtended, failoverAttempts: FailoverAttempt[], currentModel: AIModelEntityExtended, currentVendorId: string | null): void;
420
+ /**
421
+ * Updates prompt run with failover failure tracking data
422
+ */
91
423
  private updatePromptRunWithFailoverFailure;
424
+ /**
425
+ * Creates an error result for failed failover attempts
426
+ */
92
427
  private createFailoverErrorResult;
428
+ /**
429
+ * Executes the AI model with the rendered prompt
430
+ */
93
431
  private executeModel;
432
+ /**
433
+ * Builds the message array combining rendered prompt with conversation messages
434
+ */
94
435
  private buildMessageArray;
436
+ /**
437
+ * Executes the model with retry logic for validation failures
438
+ */
95
439
  private executeWithValidationRetries;
440
+ /**
441
+ * Applies retry delay based on the prompt's retry strategy
442
+ */
443
+ /**
444
+ * Calculates retry delay for rate limit and other retriable errors.
445
+ * Uses the prompt's RetryStrategy and can respect suggested delays from provider.
446
+ */
96
447
  private calculateRetryDelay;
97
448
  private applyRetryDelay;
449
+ /**
450
+ * Filters out all candidates from a vendor when a vendor-level error occurs.
451
+ * Vendor-level errors affect all models from that vendor:
452
+ * - Authentication: Invalid API key
453
+ * - VendorValidationError: API schema/validation requirements
454
+ */
98
455
  private filterVendorCandidates;
456
+ /**
457
+ * Handles rate limit errors by retrying the same model/vendor with backoff.
458
+ * Returns true if the caller should continue (retry), false if should proceed to failover.
459
+ */
99
460
  private handleRateLimitRetry;
461
+ /**
462
+ * Processes a failover error (either from catch block or from failed ChatResult).
463
+ * Handles vendor filtering, rate limit retries, fatal error detection, and failover logic.
464
+ *
465
+ * @returns Decision object indicating whether to retry same model, continue to next candidate, or stop
466
+ */
100
467
  private processFailoverError;
468
+ /**
469
+ * Transitions to the next failover candidate.
470
+ * Returns the next candidate info or null if no candidates are available.
471
+ */
101
472
  private transitionToNextCandidate;
473
+ /**
474
+ * Provides a human-readable description of the validation decision
475
+ */
102
476
  private getValidationDecisionDescription;
477
+ /**
478
+ * Generates a JSON schema from an example object for validation
479
+ */
103
480
  private generateSchemaFromExample;
481
+ /**
482
+ * Detects if a key/value pair looks like a placeholder or example value
483
+ */
104
484
  private isLikelyPlaceholder;
485
+ /**
486
+ * Detects if an entire object looks like it contains only placeholder/example data
487
+ */
105
488
  private isObjectLikelyPlaceholder;
489
+ /**
490
+ * Generates schema for a specific value type
491
+ */
106
492
  private generateSchemaForValue;
493
+ /**
494
+ * Enhanced parsing and validation with detailed error reporting and JSON repair capabilities.
495
+ *
496
+ * @param modelResult - The raw result from the AI model
497
+ * @param prompt - The AI prompt entity containing configuration
498
+ * @param skipValidation - Whether to skip validation
499
+ * @param cleanValidationSyntax - Whether to clean validation syntax from results
500
+ * @param params - Optional prompt parameters containing additional configuration like attemptJSONRepair
501
+ * @returns Parsed result with optional validation results and errors
502
+ */
107
503
  private parseAndValidateResultEnhanced;
504
+ /**
505
+ * Parses a string output value.
506
+ *
507
+ * @param rawOutput - The raw output from the model
508
+ * @returns The parsed string value
509
+ */
108
510
  private parseStringOutput;
511
+ /**
512
+ * Parses a number output value with validation.
513
+ *
514
+ * @param rawOutput - The raw output from the model
515
+ * @param skipValidation - Whether to skip validation
516
+ * @param validationErrors - Array to collect validation errors
517
+ * @returns The parsed number value
518
+ * @throws Error if the value cannot be parsed as a number and validation is enabled
519
+ */
109
520
  private parseNumberOutput;
521
+ /**
522
+ * Parses a boolean output value with flexible input handling.
523
+ *
524
+ * @param rawOutput - The raw output from the model
525
+ * @param skipValidation - Whether to skip validation
526
+ * @param validationErrors - Array to collect validation errors
527
+ * @returns The parsed boolean value
528
+ * @throws Error if the value cannot be parsed as a boolean and validation is enabled
529
+ */
110
530
  private parseBooleanOutput;
531
+ /**
532
+ * Parses a date output value with validation.
533
+ *
534
+ * @param rawOutput - The raw output from the model
535
+ * @param skipValidation - Whether to skip validation
536
+ * @param validationErrors - Array to collect validation errors
537
+ * @returns The parsed Date value
538
+ * @throws Error if the value cannot be parsed as a date and validation is enabled
539
+ */
111
540
  private parseDateOutput;
541
+ /**
542
+ * Parses an object (JSON) output value with optional repair capabilities.
543
+ *
544
+ * @param rawOutput - The raw output from the model
545
+ * @param prompt - The AI prompt entity containing configuration
546
+ * @param skipValidation - Whether to skip validation
547
+ * @param cleanValidationSyntax - Whether to clean validation syntax
548
+ * @param validationErrors - Array to collect validation errors
549
+ * @param params - Optional prompt parameters containing attemptJSONRepair flag
550
+ * @returns The parsed object value
551
+ * @throws Error if the value cannot be parsed as JSON and validation is enabled
552
+ */
112
553
  private parseObjectOutput;
554
+ /**
555
+ * Attempts to repair malformed JSON using a two-step process.
556
+ *
557
+ * @param rawOutput - The malformed JSON string
558
+ * @param originalError - The original parsing error
559
+ * @param params - Prompt parameters containing contextUser
560
+ * @returns The repaired and parsed JSON object
561
+ * @throws Error if JSON repair fails
562
+ */
113
563
  private attemptJSONRepair;
564
+ /**
565
+ * Validates parsed result against JSON schema derived from OutputExample
566
+ */
114
567
  private validateAgainstSchema;
568
+ /**
569
+ * Updates the AIPromptRun entity with execution results
570
+ */
115
571
  private updatePromptRun;
572
+ /**
573
+ * Estimates the number of tokens in a rendered prompt and conversation messages.
574
+ * This is a rough estimation based on character count and typical token ratios.
575
+ *
576
+ * @param renderedPrompt - The rendered prompt text
577
+ * @param conversationMessages - Optional conversation messages
578
+ * @returns Estimated token count
579
+ */
580
+ /**
581
+ * Retrieves failover configuration from the prompt entity.
582
+ *
583
+ * @param prompt - The AI prompt entity containing failover settings
584
+ * @returns FailoverConfiguration object with strategy and settings
585
+ *
586
+ * @remarks
587
+ * This method extracts failover configuration from the prompt entity and provides
588
+ * default values when configuration is not specified. Override this method to
589
+ * implement custom failover configuration logic.
590
+ */
116
591
  protected getFailoverConfiguration(prompt: AIPromptEntityExtended): FailoverConfiguration;
592
+ /**
593
+ * Determines whether a failover attempt should be made based on the error and configuration.
594
+ *
595
+ * @param error - The error that occurred during execution
596
+ * @param config - The failover configuration
597
+ * @param attemptNumber - The current attempt number (1-based)
598
+ * @returns True if failover should be attempted, false otherwise
599
+ *
600
+ * @remarks
601
+ * This method uses the ErrorAnalyzer to classify errors and determine if they are
602
+ * eligible for failover based on the configured error scope. Override this method
603
+ * to implement custom failover decision logic.
604
+ */
117
605
  protected shouldAttemptFailover(error: Error, config: FailoverConfiguration, attemptNumber: number): boolean;
606
+ /**
607
+ * Checks if an error type matches the configured error scope
608
+ *
609
+ * @param errorType - The error type from ErrorAnalyzer
610
+ * @param scope - The configured error scope
611
+ * @returns True if the error matches the scope
612
+ */
118
613
  private errorMatchesScope;
614
+ /**
615
+ * Calculates the delay before the next failover attempt.
616
+ *
617
+ * @param attemptNumber - The current attempt number (1-based)
618
+ * @param baseDelaySeconds - The base delay in seconds from configuration
619
+ * @param previousError - The error from the previous attempt
620
+ * @returns Delay in milliseconds before the next attempt
621
+ *
622
+ * @remarks
623
+ * Implements exponential backoff with jitter by default. The delay increases
624
+ * exponentially with each attempt and includes random jitter to prevent
625
+ * thundering herd problems. Override this method to implement custom delay logic.
626
+ */
119
627
  protected calculateFailoverDelay(attemptNumber: number, baseDelaySeconds: number): number;
628
+ /**
629
+ * Selects candidate models for failover based on the strategy and current failure.
630
+ *
631
+ * @param currentModel - The model that just failed
632
+ * @param currentVendorId - The vendor ID that just failed
633
+ * @param strategy - The failover strategy to use
634
+ * @param modelStrategy - The model selection preference
635
+ * @param allCandidates - All available model-vendor candidates
636
+ * @param attemptHistory - History of previous failover attempts
637
+ * @returns Array of candidates sorted by priority (highest first)
638
+ *
639
+ * @remarks
640
+ * This method implements different strategies for selecting failover candidates:
641
+ * - SameModelDifferentVendor: Try the same model with different vendors
642
+ * - NextBestModel: Try different models in order of preference
643
+ * - PowerRank: Use the global power ranking of models
644
+ *
645
+ * Override this method to implement custom candidate selection logic.
646
+ */
120
647
  protected selectFailoverCandidates(currentModel: AIModelEntityExtended, currentVendorId: string | undefined, strategy: FailoverConfiguration['strategy'], modelStrategy: FailoverConfiguration['modelStrategy'], allCandidates: ModelVendorCandidate[], attemptHistory: FailoverAttempt[]): ModelVendorCandidate[];
648
+ /**
649
+ * Logs a failover attempt for tracking and debugging.
650
+ *
651
+ * @param promptId - The ID of the prompt being executed
652
+ * @param attempt - The failover attempt details
653
+ * @param willRetry - Whether another attempt will be made
654
+ *
655
+ * @remarks
656
+ * This method logs detailed information about each failover attempt to help with
657
+ * debugging and monitoring. Override this method to implement custom logging or
658
+ * integrate with external monitoring systems.
659
+ */
121
660
  protected logFailoverAttempt(promptId: string, attempt: FailoverAttempt, willRetry: boolean): void;
122
661
  }
123
- export declare function LoadAIPromptRunner(): void;
124
662
  export {};
125
663
  //# sourceMappingURL=AIPromptRunner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AIPromptRunner.d.ts","sourceRoot":"","sources":["../src/AIPromptRunner.ts"],"names":[],"mappings":";AAAA,OAAO,EAAuB,UAAU,EAAmB,WAAW,EAA2C,MAAM,oBAAoB,CAAC;AAC5I,OAAO,EAAqB,iBAAiB,EAAwB,MAAM,8BAA8B,CAAC;AAI1G,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AASxH,OAAO,EACH,mBAAmB,EAEnB,cAAc,EACjB,MAAM,8BAA8B,CAAC;AAkEtC,UAAU,oBAAoB;IAC5B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,YAAY,GAAG,YAAY,CAAC;CACnE;AAMD,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,0BAA0B,GAAG,eAAe,GAAG,WAA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