@memberjunction/ai-prompts 2.47.0 → 2.49.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.
- package/README.md +565 -29
- package/dist/AIPromptCategoryExtended.d.ts.map +1 -1
- package/dist/AIPromptCategoryExtended.js +2 -2
- package/dist/AIPromptCategoryExtended.js.map +1 -1
- package/dist/AIPromptRunner.d.ts +4 -85
- package/dist/AIPromptRunner.d.ts.map +1 -1
- package/dist/AIPromptRunner.js +235 -103
- package/dist/AIPromptRunner.js.map +1 -1
- package/dist/ParallelExecutionCoordinator.d.ts +1 -1
- package/dist/ParallelExecutionCoordinator.d.ts.map +1 -1
- package/dist/ParallelExecutionCoordinator.js +14 -11
- package/dist/ParallelExecutionCoordinator.js.map +1 -1
- package/dist/SystemPlaceholders.d.ts +18 -0
- package/dist/SystemPlaceholders.d.ts.map +1 -0
- package/dist/SystemPlaceholders.js +239 -0
- package/dist/SystemPlaceholders.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +101 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +14 -0
- package/dist/types.js.map +1 -0
- package/package.json +10 -7
|
@@ -7,9 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.AIPromptCategoryEntityExtended = void 0;
|
|
10
|
+
const core_1 = require("@memberjunction/core");
|
|
10
11
|
const core_entities_1 = require("@memberjunction/core-entities");
|
|
11
12
|
const global_1 = require("@memberjunction/global");
|
|
12
|
-
const typeorm_1 = require("typeorm");
|
|
13
13
|
let AIPromptCategoryEntityExtended = class AIPromptCategoryEntityExtended extends core_entities_1.AIPromptCategoryEntity {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
@@ -21,6 +21,6 @@ let AIPromptCategoryEntityExtended = class AIPromptCategoryEntityExtended extend
|
|
|
21
21
|
};
|
|
22
22
|
exports.AIPromptCategoryEntityExtended = AIPromptCategoryEntityExtended;
|
|
23
23
|
exports.AIPromptCategoryEntityExtended = AIPromptCategoryEntityExtended = __decorate([
|
|
24
|
-
(0, global_1.RegisterClass)(
|
|
24
|
+
(0, global_1.RegisterClass)(core_1.BaseEntity, 'AI Prompt Categories')
|
|
25
25
|
], AIPromptCategoryEntityExtended);
|
|
26
26
|
//# sourceMappingURL=AIPromptCategoryExtended.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIPromptCategoryExtended.js","sourceRoot":"","sources":["../src/AIPromptCategoryExtended.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iEAAuF;AACvF,mDAAuD;
|
|
1
|
+
{"version":3,"file":"AIPromptCategoryExtended.js","sourceRoot":"","sources":["../src/AIPromptCategoryExtended.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAkD;AAClD,iEAAuF;AACvF,mDAAuD;AAGhD,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,sCAAsB;IAAnE;;QACG,aAAQ,GAAqB,EAAE,CAAC;IAI1C,CAAC;IAHC,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF,CAAA;AALY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,sBAAa,EAAC,iBAAU,EAAE,sBAAsB,CAAC;GACrC,8BAA8B,CAK1C"}
|
package/dist/AIPromptRunner.d.ts
CHANGED
|
@@ -1,87 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { UserInfo, ValidationResult, ValidationErrorInfo } from '@memberjunction/core';
|
|
4
|
-
import { AIPromptEntity, AIPromptRunEntity } from '@memberjunction/core-entities';
|
|
5
|
-
export type ExecutionProgressCallback = (progress: {
|
|
6
|
-
step: 'template_rendering' | 'model_selection' | 'execution' | 'validation' | 'parallel_coordination' | 'result_selection';
|
|
7
|
-
percentage: number;
|
|
8
|
-
message: string;
|
|
9
|
-
metadata?: Record<string, unknown>;
|
|
10
|
-
}) => void;
|
|
11
|
-
export type ExecutionStreamingCallback = (chunk: {
|
|
12
|
-
content: string;
|
|
13
|
-
isComplete: boolean;
|
|
14
|
-
taskId?: string;
|
|
15
|
-
modelName?: string;
|
|
16
|
-
}) => void;
|
|
17
|
-
export type TemplateMessageRole = 'system' | 'user' | 'none';
|
|
18
|
-
export declare class AIPromptParams {
|
|
19
|
-
prompt: AIPromptEntity;
|
|
20
|
-
data?: Record<string, unknown>;
|
|
21
|
-
modelId?: string;
|
|
22
|
-
vendorId?: string;
|
|
23
|
-
configurationId?: string;
|
|
24
|
-
contextUser?: UserInfo;
|
|
25
|
-
skipValidation?: boolean;
|
|
26
|
-
templateData?: Record<string, unknown>;
|
|
27
|
-
conversationMessages?: ChatMessage[];
|
|
28
|
-
templateMessageRole?: TemplateMessageRole;
|
|
29
|
-
cancellationToken?: AbortSignal;
|
|
30
|
-
onProgress?: ExecutionProgressCallback;
|
|
31
|
-
onStreaming?: ExecutionStreamingCallback;
|
|
32
|
-
}
|
|
33
|
-
export type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
34
|
-
export type CancellationReason = 'user_requested' | 'timeout' | 'error' | 'resource_limit';
|
|
35
|
-
export interface ModelInfo {
|
|
36
|
-
modelId: string;
|
|
37
|
-
modelName: string;
|
|
38
|
-
vendorId?: string;
|
|
39
|
-
vendorName?: string;
|
|
40
|
-
powerRank?: number;
|
|
41
|
-
modelType?: string;
|
|
42
|
-
}
|
|
43
|
-
export interface JudgeMetadata {
|
|
44
|
-
judgePromptId: string;
|
|
45
|
-
judgeExecutionTimeMS: number;
|
|
46
|
-
judgeTokensUsed?: number;
|
|
47
|
-
judgeCancelled?: boolean;
|
|
48
|
-
judgeErrorMessage?: string;
|
|
49
|
-
}
|
|
50
|
-
export interface ValidationAttempt {
|
|
51
|
-
attemptNumber: number;
|
|
52
|
-
success: boolean;
|
|
53
|
-
errorMessage?: string;
|
|
54
|
-
validationErrors?: ValidationErrorInfo[];
|
|
55
|
-
rawOutput: string;
|
|
56
|
-
parsedOutput?: unknown;
|
|
57
|
-
timestamp: Date;
|
|
58
|
-
}
|
|
59
|
-
export declare class AIPromptRunResult<T = unknown> {
|
|
60
|
-
success: boolean;
|
|
61
|
-
status?: ExecutionStatus;
|
|
62
|
-
cancelled?: boolean;
|
|
63
|
-
cancellationReason?: CancellationReason;
|
|
64
|
-
rawResult?: string;
|
|
65
|
-
result?: T;
|
|
66
|
-
chatResult: ChatResult;
|
|
67
|
-
errorMessage?: string;
|
|
68
|
-
promptRun?: AIPromptRunEntity;
|
|
69
|
-
executionTimeMS?: number;
|
|
70
|
-
tokensUsed?: number;
|
|
71
|
-
validationResult?: ValidationResult;
|
|
72
|
-
validationAttempts?: ValidationAttempt[];
|
|
73
|
-
additionalResults?: AIPromptRunResult<T>[];
|
|
74
|
-
ranking?: number;
|
|
75
|
-
judgeRationale?: string;
|
|
76
|
-
modelInfo?: ModelInfo;
|
|
77
|
-
judgeMetadata?: JudgeMetadata;
|
|
78
|
-
wasStreamed?: boolean;
|
|
79
|
-
cacheInfo?: {
|
|
80
|
-
cacheHit: boolean;
|
|
81
|
-
cacheKey?: string;
|
|
82
|
-
cacheSource?: string;
|
|
83
|
-
};
|
|
84
|
-
}
|
|
1
|
+
import { AIPromptParams, AIPromptRunResult } from './types';
|
|
2
|
+
export { TemplateMessageRole, AIPromptParams } from './types';
|
|
85
3
|
export declare class AIPromptRunner {
|
|
86
4
|
private _metadata;
|
|
87
5
|
private _templateEngine;
|
|
@@ -100,6 +18,8 @@ export declare class AIPromptRunner {
|
|
|
100
18
|
private executeSinglePrompt;
|
|
101
19
|
private executePromptInParallel;
|
|
102
20
|
private loadTemplate;
|
|
21
|
+
private renderChildPromptTemplates;
|
|
22
|
+
private renderPromptWithChildTemplates;
|
|
103
23
|
private selectModel;
|
|
104
24
|
private createPromptRun;
|
|
105
25
|
private renderPromptTemplate;
|
|
@@ -113,7 +33,6 @@ export declare class AIPromptRunner {
|
|
|
113
33
|
private generateSchemaForValue;
|
|
114
34
|
private parseAndValidateResultEnhanced;
|
|
115
35
|
private validateAgainstSchema;
|
|
116
|
-
private parseAndValidateResult;
|
|
117
36
|
private updatePromptRun;
|
|
118
37
|
}
|
|
119
38
|
export declare function LoadAIPromptRunner(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIPromptRunner.d.ts","sourceRoot":"","sources":["../src/AIPromptRunner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AIPromptRunner.d.ts","sourceRoot":"","sources":["../src/AIPromptRunner.ts"],"names":[],"mappings":"AAYA,OAAO,EAKH,cAAc,EAMd,iBAAiB,EACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAmE9D,qBAAa,cAAc;IACzB,OAAO,CAAC,SAAS,CAAW;IAC5B,OAAO,CAAC,eAAe,CAAuB;IAC9C,OAAO,CAAC,iBAAiB,CAAmB;IAC5C,OAAO,CAAC,oBAAoB,CAA+B;IAC3D,OAAO,CAAC,IAAI,CAAM;IAGlB,OAAO,CAAC,MAAM,CAAC,YAAY,CAA4C;IACvE,OAAO,CAAC,MAAM,CAAC,YAAY,CAAoB;;WAkBjC,gBAAgB,IAAI,IAAI;WAQxB,mBAAmB,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE;IAiCxD,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;YA6IhF,mBAAmB;YA8EnB,uBAAuB;YAkOvB,YAAY;YAoBZ,0BAA0B;YAoI1B,8BAA8B;YA+D9B,WAAW;YA8GX,eAAe;YA8Df,oBAAoB;YAkCpB,YAAY;IAwD1B,OAAO,CAAC,iBAAiB;YAwCX,4BAA4B;YAoH5B,eAAe;YAyBf,oCAAoC;IA2ClD,OAAO,CAAC,gCAAgC;IA0BxC,OAAO,CAAC,yBAAyB;IAuBjC,OAAO,CAAC,sBAAsB;YAiChB,8BAA8B;YAqI9B,qBAAqB;YAuErB,eAAe;CAmF9B;AAED,wBAAgB,kBAAkB,SAEjC"}
|