@memberjunction/ai-prompts 6.2.0-edge.1 → 6.2.0-edge.2
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 +41 -0
- package/dist/AIModelRunner.d.ts +9 -88
- package/dist/AIModelRunner.d.ts.map +1 -1
- package/dist/AIModelRunner.js +11 -283
- package/dist/AIModelRunner.js.map +1 -1
- package/dist/BaseModelRunner.d.ts +36 -1
- package/dist/BaseModelRunner.d.ts.map +1 -1
- package/dist/BaseModelRunner.js +82 -3
- package/dist/BaseModelRunner.js.map +1 -1
- package/dist/audio/AISpeechToTextRunner.d.ts +46 -0
- package/dist/audio/AISpeechToTextRunner.d.ts.map +1 -0
- package/dist/audio/AISpeechToTextRunner.js +93 -0
- package/dist/audio/AISpeechToTextRunner.js.map +1 -0
- package/dist/audio/AITextToSpeechRunner.d.ts +43 -0
- package/dist/audio/AITextToSpeechRunner.d.ts.map +1 -0
- package/dist/audio/AITextToSpeechRunner.js +80 -0
- package/dist/audio/AITextToSpeechRunner.js.map +1 -0
- package/dist/audio/audio-description.d.ts +22 -0
- package/dist/audio/audio-description.d.ts.map +1 -0
- package/dist/audio/audio-description.js +52 -0
- package/dist/audio/audio-description.js.map +1 -0
- package/dist/audio/audio-runner.types.d.ts +46 -0
- package/dist/audio/audio-runner.types.d.ts.map +1 -0
- package/dist/audio/audio-runner.types.js +7 -0
- package/dist/audio/audio-runner.types.js.map +1 -0
- package/dist/decision/AIDecisionRunner.d.ts +134 -0
- package/dist/decision/AIDecisionRunner.d.ts.map +1 -0
- package/dist/decision/AIDecisionRunner.js +498 -0
- package/dist/decision/AIDecisionRunner.js.map +1 -0
- package/dist/decision/LLMDecision.d.ts +158 -0
- package/dist/decision/LLMDecision.d.ts.map +1 -0
- package/dist/decision/LLMDecision.js +493 -0
- package/dist/decision/LLMDecision.js.map +1 -0
- package/dist/decision/decision-questions.d.ts +28 -0
- package/dist/decision/decision-questions.d.ts.map +1 -0
- package/dist/decision/decision-questions.js +123 -0
- package/dist/decision/decision-questions.js.map +1 -0
- package/dist/decision/decision-runner.types.d.ts +29 -0
- package/dist/decision/decision-runner.types.d.ts.map +1 -0
- package/dist/decision/decision-runner.types.js +14 -0
- package/dist/decision/decision-runner.types.js.map +1 -0
- package/dist/embedding/AIEmbeddingRunner.d.ts +115 -0
- package/dist/embedding/AIEmbeddingRunner.d.ts.map +1 -0
- package/dist/embedding/AIEmbeddingRunner.js +462 -0
- package/dist/embedding/AIEmbeddingRunner.js.map +1 -0
- package/dist/embedding/embedding-runner.types.d.ts +72 -0
- package/dist/embedding/embedding-runner.types.d.ts.map +1 -0
- package/dist/embedding/embedding-runner.types.js +2 -0
- package/dist/embedding/embedding-runner.types.js.map +1 -0
- package/dist/image/AIImageGenerationRunner.d.ts +101 -0
- package/dist/image/AIImageGenerationRunner.d.ts.map +1 -0
- package/dist/image/AIImageGenerationRunner.js +355 -0
- package/dist/image/AIImageGenerationRunner.js.map +1 -0
- package/dist/image/image-runner.types.d.ts +90 -0
- package/dist/image/image-runner.types.d.ts.map +1 -0
- package/dist/image/image-runner.types.js +7 -0
- package/dist/image/image-runner.types.js.map +1 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/media/BaseMediaRunner.d.ts +143 -0
- package/dist/media/BaseMediaRunner.d.ts.map +1 -0
- package/dist/media/BaseMediaRunner.js +448 -0
- package/dist/media/BaseMediaRunner.js.map +1 -0
- package/dist/media/media-runner.types.d.ts +128 -0
- package/dist/media/media-runner.types.d.ts.map +1 -0
- package/dist/media/media-runner.types.js +8 -0
- package/dist/media/media-runner.types.js.map +1 -0
- package/dist/media/media-usage.d.ts +13 -0
- package/dist/media/media-usage.d.ts.map +1 -0
- package/dist/media/media-usage.js +18 -0
- package/dist/media/media-usage.js.map +1 -0
- package/dist/video/AIVideoRunner.d.ts +46 -0
- package/dist/video/AIVideoRunner.d.ts.map +1 -0
- package/dist/video/AIVideoRunner.js +88 -0
- package/dist/video/AIVideoRunner.js.map +1 -0
- package/dist/video/video-runner.types.d.ts +29 -0
- package/dist/video/video-runner.types.d.ts.map +1 -0
- package/dist/video/video-runner.types.js +7 -0
- package/dist/video/video-runner.types.js.map +1 -0
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -202,6 +202,47 @@ Hierarchical credential resolution for API keys:
|
|
|
202
202
|
|
|
203
203
|
When a model fails due to rate limiting, authentication errors, or other transient issues, the runner can automatically retry with alternate models from the selection candidates.
|
|
204
204
|
|
|
205
|
+
### Media Runners
|
|
206
|
+
|
|
207
|
+
Non-chat models run through runners built on the same `BaseModelRunner`, so they get the same model selection, credential resolution, failover and `MJ: AI Prompt Runs` row as a chat prompt. Each requires one model type, and uses a default carrier prompt, found by name, unless the caller passes a `PromptID`. A `ModelID` pins the model, and failover then stays within its vendors. The run row never holds media bytes.
|
|
208
|
+
|
|
209
|
+
| Runner | Model type | Method | Default prompt | Usage recorded |
|
|
210
|
+
|---|---|---|---|---|
|
|
211
|
+
| `AIImageGenerationRunner` | `Image Generator` | `RunImageGeneration`, `RunImageEdit` | `Default Image Generation` | the driver's, else images returned (`Images`) |
|
|
212
|
+
| `AITextToSpeechRunner` | `TTS` | `RunTextToSpeech` | `Default Text To Speech` | the driver's, else characters sent (`Characters`) |
|
|
213
|
+
| `AISpeechToTextRunner` | `Speech to Text` | `RunSpeechToText` | `Default Speech To Text` | the driver's: audio seconds (`Seconds`) when reported, otherwise nothing |
|
|
214
|
+
| `AIVideoRunner` | `Video` | `RunAvatarVideo` | `Default Video Generation` | the driver's: video seconds (`Seconds`) when reported, otherwise nothing |
|
|
215
|
+
|
|
216
|
+
The text-to-speech, speech-to-text and video runners share their lifecycle through `BaseMediaRunner`. It follows the carrier prompt's `FailoverStrategy`, narrowing `SameModelDifferentVendor` to the selected model's vendors.
|
|
217
|
+
|
|
218
|
+
Whether a failed call fails over is `ErrorAnalyzer`'s decision, as it is for chat prompts. The shipped audio and video drivers report it on `SpeechResult.errorInfo` / `VideoResult.errorInfo`, from the error their SDK threw, so it keeps the HTTP status:
|
|
219
|
+
|
|
220
|
+
- a rate limit, an outage, a server error or a timeout fails over;
|
|
221
|
+
- a request the vendor rejected as invalid (a 400 or 422, such as an unknown voice or an unsupported audio format) does not, since every other candidate would reject it too;
|
|
222
|
+
- a 400 whose message reads as vendor-specific validation (`required`, `must be`, …) fails over to another vendor, as it does for chat;
|
|
223
|
+
- a 401 stops failover, as it does for chat.
|
|
224
|
+
|
|
225
|
+
A driver that reports only `errorMessage` is classified from the message, which recognizes rate limits, outages and a few malformed requests; any other message reads as `Unknown`, which fails over. A driver should set `errorInfo` with `ErrorAnalyzer.AnalyzeError(error)` on the error it caught.
|
|
226
|
+
|
|
227
|
+
`TimeoutMS` and `CancellationToken` bound each driver call as `timeoutMS` and `cancellationToken` bound a chat call. A call that exceeds `TimeoutMS` fails with an `AIPromptTimeoutError` and fails over. A cancelled call ends at once, never fails over, and its run row is recorded as `Cancelled`. The media drivers take no abort signal, so in both cases the request already sent is abandoned rather than torn down.
|
|
228
|
+
|
|
229
|
+
Video generation is asynchronous at the provider, and the primitive offers no status call, so `AIVideoRunner` does not wait for a render. A successful run means the provider accepted the request; the row records the video ID (for HeyGen, the render job's ID) and records the video's length only if a driver reports it.
|
|
230
|
+
|
|
231
|
+
Usage is recorded with `BaseModelRunner.ApplyUsageToRunRecord`, which writes non-token quantities as `InputUnitsUsed` / `OutputUnitsUsed` with the `MJ: AI Usage Types` row that names their measure. The runners never set a cost. The row's save prices it from the model's cost rows, and declines when no price unit type claims the measure, as none yet does for `Characters`.
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
import { AITextToSpeechRunner } from '@memberjunction/ai-prompts';
|
|
235
|
+
|
|
236
|
+
const result = await new AITextToSpeechRunner().RunTextToSpeech({
|
|
237
|
+
text: 'Your report is ready.',
|
|
238
|
+
voice: 'alloy',
|
|
239
|
+
ContextUser: contextUser,
|
|
240
|
+
});
|
|
241
|
+
if (result.Success) {
|
|
242
|
+
const audio = result.SpeechResult?.data; // the run row describes the audio but never stores it
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
205
246
|
## Usage
|
|
206
247
|
|
|
207
248
|
### Basic Prompt Execution
|
package/dist/AIModelRunner.d.ts
CHANGED
|
@@ -1,109 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
export interface EmbeddingRunResult {
|
|
6
|
-
/** Whether the embedding call succeeded */
|
|
7
|
-
Success: boolean;
|
|
8
|
-
/** The embedding vectors (one per input text) */
|
|
9
|
-
Vectors: number[][];
|
|
10
|
-
/** The AIPromptRun ID created for tracking */
|
|
11
|
-
PromptRunID: string | null;
|
|
12
|
-
/** Total tokens used */
|
|
13
|
-
TokensUsed: number;
|
|
14
|
-
/** Cost of the call */
|
|
15
|
-
Cost: number;
|
|
16
|
-
/** Error message if failed */
|
|
17
|
-
ErrorMessage: string | null;
|
|
18
|
-
/** Execution time in milliseconds */
|
|
19
|
-
ExecutionTimeMs: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Parameters for running an embedding via AIModelRunner.
|
|
23
|
-
*/
|
|
24
|
-
export interface EmbeddingRunParams {
|
|
25
|
-
/** The texts to embed */
|
|
26
|
-
Texts: string[];
|
|
27
|
-
/** Optional: specific AIPrompt ID for this embedding operation (type=Embedding).
|
|
28
|
-
* If not provided, uses the first active Embedding prompt found. */
|
|
29
|
-
PromptID?: string;
|
|
30
|
-
/** Optional: specific model ID to use. If not provided, uses the prompt's model configuration. */
|
|
31
|
-
ModelID?: string;
|
|
32
|
-
/** The user context for permissions and audit */
|
|
33
|
-
ContextUser: UserInfo;
|
|
34
|
-
/** Optional: parent prompt run ID (e.g. parent parallel run) for hierarchical tracking */
|
|
35
|
-
ParentRunID?: string;
|
|
36
|
-
/** Optional: human-readable description for the AIPromptRun record */
|
|
37
|
-
Description?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Optional: reduced embedding dimensions. Forwarded to the embedding provider's EmbedTexts call
|
|
40
|
-
* for models that support dimension reduction (e.g. OpenAI text-embedding-3-*); ignored by
|
|
41
|
-
* models that don't. The authoritative source is `MJ: Vector Indexes.Dimensions` — callers
|
|
42
|
-
* should read it from there and pass it here.
|
|
43
|
-
*/
|
|
44
|
-
Dimensions?: number;
|
|
45
|
-
}
|
|
1
|
+
import { IMetadataProvider } from '@memberjunction/core';
|
|
2
|
+
import { EmbeddingRunParams, EmbeddingRunResult } from './embedding/embedding-runner.types.js';
|
|
3
|
+
export type { EmbeddingRunResult, EmbeddingRunParams } from './embedding/embedding-runner.types.js';
|
|
46
4
|
/**
|
|
47
5
|
* AIModelRunner — Lightweight AI model execution tracker for non-LLM model types.
|
|
48
6
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* infrastructure as AIPromptRunner but without template rendering or validation.
|
|
52
|
-
*
|
|
53
|
-
* Architecture:
|
|
54
|
-
* - @memberjunction/ai (no MJ infra): BaseEmbeddings, ModelUsage
|
|
55
|
-
* - @memberjunction/ai-core-plus (this class): AIModelRunner — creates AIPromptRun records
|
|
56
|
-
* - @memberjunction/ai-prompts: AIPromptRunner — LLM-specific (template rendering, validation)
|
|
57
|
-
*
|
|
58
|
-
* Usage:
|
|
59
|
-
* ```typescript
|
|
60
|
-
* const runner = new AIModelRunner();
|
|
61
|
-
* const result = await runner.RunEmbedding({
|
|
62
|
-
* Texts: ['Hello world', 'How are you'],
|
|
63
|
-
* ContextUser: currentUser,
|
|
64
|
-
* Description: 'Content item vectorization'
|
|
65
|
-
* });
|
|
66
|
-
* // result.PromptRunID links to the AIPromptRun record with token/cost data
|
|
67
|
-
* ```
|
|
7
|
+
* @deprecated Use {@link AIEmbeddingRunner} instead. AIModelRunner is retained for backward
|
|
8
|
+
* compatibility and delegates all execution and prompt-run queuing to AIEmbeddingRunner.
|
|
68
9
|
*/
|
|
69
10
|
export declare class AIModelRunner {
|
|
70
|
-
private
|
|
11
|
+
private _embeddingRunner;
|
|
71
12
|
/**
|
|
72
|
-
*
|
|
73
|
-
* embedding/model run record is observability — the caller gets its vectors regardless of whether
|
|
74
|
-
* the tracking row persists — so saves are queued, not awaited, and the embedding call is never
|
|
75
|
-
* blocked on a DB round-trip. The queue sequences saves per entity (the initial 'Running' INSERT
|
|
76
|
-
* always completes before the 'Completed'/'Failed' UPDATE). `PromptRunID` is returned immediately
|
|
77
|
-
* because `NewRecord()` client-generates the UUID.
|
|
78
|
-
*/
|
|
79
|
-
private _promptRunQueue;
|
|
80
|
-
/**
|
|
81
|
-
* Optional metadata provider override. Callers should set
|
|
82
|
-
* `instance.Provider = providerToUse` before invoking run methods
|
|
83
|
-
* in multi-provider contexts. Falls back to the global default provider when unset.
|
|
13
|
+
* Optional metadata provider override.
|
|
84
14
|
*/
|
|
85
15
|
get Provider(): IMetadataProvider;
|
|
86
16
|
set Provider(value: IMetadataProvider | null);
|
|
87
17
|
/**
|
|
88
18
|
* Execute an embedding call with full AIPromptRun tracking.
|
|
89
|
-
*
|
|
90
|
-
* Creates an AIPromptRun record before the call, invokes the embedding model,
|
|
91
|
-
* stores tokens/cost/timing on the run record, and returns the result.
|
|
19
|
+
* Delegates to {@link AIEmbeddingRunner.RunEmbedding}.
|
|
92
20
|
*
|
|
93
21
|
* @param params - Embedding execution parameters
|
|
94
22
|
* @returns Result with vectors, run ID, and usage metrics
|
|
95
23
|
*/
|
|
96
24
|
RunEmbedding(params: EmbeddingRunParams): Promise<EmbeddingRunResult>;
|
|
97
|
-
private resolveEmbeddingModel;
|
|
98
|
-
private findBestVendor;
|
|
99
|
-
private createRunRecord;
|
|
100
25
|
/**
|
|
101
|
-
* Awaits all in-flight prompt-run saves queued by this runner.
|
|
102
|
-
* call this — persistence is intentionally fire-and-forget. For tests / durability needs.
|
|
26
|
+
* Awaits all in-flight prompt-run saves queued by this runner.
|
|
103
27
|
*/
|
|
104
28
|
WaitForPendingPromptRunSaves(): Promise<void>;
|
|
105
|
-
private completeRunRecord;
|
|
106
|
-
private failRunRecord;
|
|
107
|
-
private errorResult;
|
|
108
29
|
}
|
|
109
30
|
//# sourceMappingURL=AIModelRunner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIModelRunner.d.ts","sourceRoot":"","sources":["../src/AIModelRunner.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AIModelRunner.d.ts","sourceRoot":"","sources":["../src/AIModelRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAE5F,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAEjG;;;;;GAKG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,gBAAgB,CAA2B;IAEnD;;OAEG;IACH,IAAW,QAAQ,IAAI,iBAAiB,CAEvC;IACD,IAAW,QAAQ,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,EAElD;IAED;;;;;;OAMG;IACU,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIlF;;OAEG;IACU,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7D"}
|
package/dist/AIModelRunner.js
CHANGED
|
@@ -1,310 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MJGlobal, UUIDsEqual } from '@memberjunction/global';
|
|
3
|
-
import { BaseEmbeddings, GetAIAPIKey } from '@memberjunction/ai';
|
|
4
|
-
import { AIEngineBase } from '@memberjunction/ai-engine-base';
|
|
5
|
-
import { ResolvePromptRunUserID } from '@memberjunction/ai-core-plus';
|
|
1
|
+
import { AIEmbeddingRunner } from './embedding/AIEmbeddingRunner.js';
|
|
6
2
|
/**
|
|
7
3
|
* AIModelRunner — Lightweight AI model execution tracker for non-LLM model types.
|
|
8
4
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* infrastructure as AIPromptRunner but without template rendering or validation.
|
|
12
|
-
*
|
|
13
|
-
* Architecture:
|
|
14
|
-
* - @memberjunction/ai (no MJ infra): BaseEmbeddings, ModelUsage
|
|
15
|
-
* - @memberjunction/ai-core-plus (this class): AIModelRunner — creates AIPromptRun records
|
|
16
|
-
* - @memberjunction/ai-prompts: AIPromptRunner — LLM-specific (template rendering, validation)
|
|
17
|
-
*
|
|
18
|
-
* Usage:
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const runner = new AIModelRunner();
|
|
21
|
-
* const result = await runner.RunEmbedding({
|
|
22
|
-
* Texts: ['Hello world', 'How are you'],
|
|
23
|
-
* ContextUser: currentUser,
|
|
24
|
-
* Description: 'Content item vectorization'
|
|
25
|
-
* });
|
|
26
|
-
* // result.PromptRunID links to the AIPromptRun record with token/cost data
|
|
27
|
-
* ```
|
|
5
|
+
* @deprecated Use {@link AIEmbeddingRunner} instead. AIModelRunner is retained for backward
|
|
6
|
+
* compatibility and delegates all execution and prompt-run queuing to AIEmbeddingRunner.
|
|
28
7
|
*/
|
|
29
8
|
export class AIModelRunner {
|
|
30
9
|
constructor() {
|
|
31
|
-
this.
|
|
32
|
-
/**
|
|
33
|
-
* Fire-and-forget AIPromptRun persistence via the shared {@link BaseEntitySaveQueue}. The
|
|
34
|
-
* embedding/model run record is observability — the caller gets its vectors regardless of whether
|
|
35
|
-
* the tracking row persists — so saves are queued, not awaited, and the embedding call is never
|
|
36
|
-
* blocked on a DB round-trip. The queue sequences saves per entity (the initial 'Running' INSERT
|
|
37
|
-
* always completes before the 'Completed'/'Failed' UPDATE). `PromptRunID` is returned immediately
|
|
38
|
-
* because `NewRecord()` client-generates the UUID.
|
|
39
|
-
*/
|
|
40
|
-
this._promptRunQueue = new BaseEntitySaveQueue();
|
|
10
|
+
this._embeddingRunner = new AIEmbeddingRunner();
|
|
41
11
|
}
|
|
42
12
|
/**
|
|
43
|
-
* Optional metadata provider override.
|
|
44
|
-
* `instance.Provider = providerToUse` before invoking run methods
|
|
45
|
-
* in multi-provider contexts. Falls back to the global default provider when unset.
|
|
13
|
+
* Optional metadata provider override.
|
|
46
14
|
*/
|
|
47
15
|
get Provider() {
|
|
48
|
-
return this.
|
|
16
|
+
return this._embeddingRunner.Provider;
|
|
49
17
|
}
|
|
50
18
|
set Provider(value) {
|
|
51
|
-
this.
|
|
19
|
+
this._embeddingRunner.Provider = value;
|
|
52
20
|
}
|
|
53
21
|
/**
|
|
54
22
|
* Execute an embedding call with full AIPromptRun tracking.
|
|
55
|
-
*
|
|
56
|
-
* Creates an AIPromptRun record before the call, invokes the embedding model,
|
|
57
|
-
* stores tokens/cost/timing on the run record, and returns the result.
|
|
23
|
+
* Delegates to {@link AIEmbeddingRunner.RunEmbedding}.
|
|
58
24
|
*
|
|
59
25
|
* @param params - Embedding execution parameters
|
|
60
26
|
* @returns Result with vectors, run ID, and usage metrics
|
|
61
27
|
*/
|
|
62
28
|
async RunEmbedding(params) {
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
// Ensure AIEngine is loaded
|
|
66
|
-
await AIEngineBase.Instance.Config(false, params.ContextUser);
|
|
67
|
-
// Resolve the embedding prompt and model
|
|
68
|
-
const { prompt, modelInfo } = await this.resolveEmbeddingModel(params);
|
|
69
|
-
if (!modelInfo) {
|
|
70
|
-
return this.errorResult('No embedding model available', startTime);
|
|
71
|
-
}
|
|
72
|
-
// Create AIPromptRun record (before the call)
|
|
73
|
-
const promptRun = await this.createRunRecord(prompt, modelInfo.ModelID, modelInfo.VendorID, params, startTime);
|
|
74
|
-
// Execute the embedding call
|
|
75
|
-
const embeddingInstance = MJGlobal.Instance.ClassFactory.CreateInstance(BaseEmbeddings, modelInfo.DriverClass, GetAIAPIKey(modelInfo.DriverClass));
|
|
76
|
-
if (!embeddingInstance) {
|
|
77
|
-
await this.failRunRecord(promptRun, 'Failed to create embedding instance', startTime);
|
|
78
|
-
return this.errorResult(`No embedding provider for driver: ${modelInfo.DriverClass}`, startTime);
|
|
79
|
-
}
|
|
80
|
-
const embedResult = await embeddingInstance.EmbedTexts({
|
|
81
|
-
texts: params.Texts,
|
|
82
|
-
model: modelInfo.APIName,
|
|
83
|
-
dimensions: params.Dimensions
|
|
84
|
-
});
|
|
85
|
-
if (!embedResult || !embedResult.vectors || embedResult.vectors.length === 0) {
|
|
86
|
-
await this.failRunRecord(promptRun, 'Embedding returned no vectors', startTime);
|
|
87
|
-
return this.errorResult('Embedding returned no vectors', startTime);
|
|
88
|
-
}
|
|
89
|
-
// Update AIPromptRun with usage data
|
|
90
|
-
await this.completeRunRecord(promptRun, embedResult, startTime);
|
|
91
|
-
return {
|
|
92
|
-
Success: true,
|
|
93
|
-
Vectors: embedResult.vectors,
|
|
94
|
-
PromptRunID: promptRun?.ID ?? null,
|
|
95
|
-
TokensUsed: embedResult.ModelUsage?.totalTokens ?? 0,
|
|
96
|
-
Cost: embedResult.ModelUsage?.cost ?? 0,
|
|
97
|
-
ErrorMessage: null,
|
|
98
|
-
ExecutionTimeMs: Date.now() - startTime,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
103
|
-
LogError(`AIModelRunner.RunEmbedding failed: ${msg}`);
|
|
104
|
-
return this.errorResult(msg, startTime);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
// ================================================================
|
|
108
|
-
// Private: Model Resolution
|
|
109
|
-
// ================================================================
|
|
110
|
-
async resolveEmbeddingModel(params) {
|
|
111
|
-
const aiEngine = AIEngineBase.Instance;
|
|
112
|
-
// Find the embedding prompt
|
|
113
|
-
let prompt = null;
|
|
114
|
-
if (params.PromptID) {
|
|
115
|
-
prompt = aiEngine.Prompts.find(p => UUIDsEqual(p.ID, params.PromptID)) ?? null;
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
// Find first active Embedding-type prompt
|
|
119
|
-
prompt = aiEngine.Prompts.find(p => p.Type?.toLowerCase() === 'embedding' && p.Status === 'Active') ?? null;
|
|
120
|
-
}
|
|
121
|
-
// If explicit model ID provided, use it directly
|
|
122
|
-
if (params.ModelID) {
|
|
123
|
-
const model = aiEngine.Models.find(m => UUIDsEqual(m.ID, params.ModelID));
|
|
124
|
-
if (model) {
|
|
125
|
-
const vendor = this.findBestVendor(model.ID);
|
|
126
|
-
if (vendor) {
|
|
127
|
-
return {
|
|
128
|
-
prompt,
|
|
129
|
-
modelInfo: {
|
|
130
|
-
ModelID: model.ID,
|
|
131
|
-
VendorID: vendor.VendorID,
|
|
132
|
-
DriverClass: vendor.DriverClass,
|
|
133
|
-
APIName: vendor.APIName ?? model.APIName ?? model.Name,
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
// Use prompt's model configuration if available
|
|
140
|
-
if (prompt) {
|
|
141
|
-
const promptModels = aiEngine.PromptModels
|
|
142
|
-
.filter(pm => pm.PromptID === prompt.ID)
|
|
143
|
-
.sort((a, b) => (b.Priority ?? 0) - (a.Priority ?? 0));
|
|
144
|
-
for (const pm of promptModels) {
|
|
145
|
-
// Look up model vendor to get driver class
|
|
146
|
-
const vendor = this.findBestVendor(pm.ModelID);
|
|
147
|
-
if (vendor) {
|
|
148
|
-
return {
|
|
149
|
-
prompt,
|
|
150
|
-
modelInfo: {
|
|
151
|
-
ModelID: pm.ModelID,
|
|
152
|
-
VendorID: vendor.VendorID,
|
|
153
|
-
DriverClass: vendor.DriverClass,
|
|
154
|
-
APIName: vendor.APIName ?? '',
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
// Fallback: find smallest active embedding model
|
|
161
|
-
const embeddingModels = aiEngine.Models.filter(m => {
|
|
162
|
-
const modelType = typeof m.AIModelType === 'string' ? m.AIModelType.trim().toLowerCase() : '';
|
|
163
|
-
return modelType === 'embeddings';
|
|
164
|
-
});
|
|
165
|
-
if (embeddingModels.length === 0)
|
|
166
|
-
return { prompt, modelInfo: null };
|
|
167
|
-
const sorted = [...embeddingModels].sort((a, b) => (a.InputTokenLimit ?? Number.MAX_SAFE_INTEGER) - (b.InputTokenLimit ?? Number.MAX_SAFE_INTEGER));
|
|
168
|
-
for (const model of sorted) {
|
|
169
|
-
const vendor = this.findBestVendor(model.ID);
|
|
170
|
-
if (vendor) {
|
|
171
|
-
return {
|
|
172
|
-
prompt,
|
|
173
|
-
modelInfo: {
|
|
174
|
-
ModelID: model.ID,
|
|
175
|
-
VendorID: vendor.VendorID,
|
|
176
|
-
DriverClass: vendor.DriverClass,
|
|
177
|
-
APIName: vendor.APIName ?? model.APIName ?? model.Name,
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return { prompt, modelInfo: null };
|
|
183
|
-
}
|
|
184
|
-
findBestVendor(modelID) {
|
|
185
|
-
const aiEngine = AIEngineBase.Instance;
|
|
186
|
-
const vendors = aiEngine.ModelVendors
|
|
187
|
-
.filter(mv => mv.ModelID === modelID && mv.Status === 'Active' && mv.DriverClass != null)
|
|
188
|
-
.sort((a, b) => (b.Priority ?? 0) - (a.Priority ?? 0));
|
|
189
|
-
for (const v of vendors) {
|
|
190
|
-
const apiKey = GetAIAPIKey(v.DriverClass);
|
|
191
|
-
if (apiKey) {
|
|
192
|
-
return { VendorID: v.VendorID ?? '', DriverClass: v.DriverClass, APIName: v.APIName };
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
// ================================================================
|
|
198
|
-
// Private: AIPromptRun CRUD
|
|
199
|
-
// ================================================================
|
|
200
|
-
async createRunRecord(prompt, modelID, vendorID, params, startTime) {
|
|
201
|
-
try {
|
|
202
|
-
const md = this.Provider;
|
|
203
|
-
const promptRun = await md.GetEntityObject('MJ: AI Prompt Runs', params.ContextUser);
|
|
204
|
-
promptRun.NewRecord();
|
|
205
|
-
if (prompt) {
|
|
206
|
-
promptRun.PromptID = prompt.ID;
|
|
207
|
-
}
|
|
208
|
-
promptRun.ModelID = modelID;
|
|
209
|
-
promptRun.VendorID = vendorID || null;
|
|
210
|
-
promptRun.Status = 'Running';
|
|
211
|
-
promptRun.RunAt = new Date(startTime);
|
|
212
|
-
promptRun.Cancelled = false;
|
|
213
|
-
promptRun.CacheHit = false;
|
|
214
|
-
promptRun.StreamingEnabled = false;
|
|
215
|
-
if (params.ParentRunID) {
|
|
216
|
-
promptRun.ParentID = params.ParentRunID;
|
|
217
|
-
}
|
|
218
|
-
promptRun.UserID = ResolvePromptRunUserID({ ContextUser: params.ContextUser });
|
|
219
|
-
// Store description in Messages field as context
|
|
220
|
-
if (params.Description) {
|
|
221
|
-
promptRun.Messages = JSON.stringify({
|
|
222
|
-
description: params.Description,
|
|
223
|
-
textCount: params.Texts.length,
|
|
224
|
-
totalChars: params.Texts.reduce((sum, t) => sum + t.length, 0),
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
// Fire-and-forget the initial 'Running' INSERT — ID is already assigned by NewRecord()
|
|
228
|
-
// so the returned PromptRunID is valid immediately; the UPDATE chains after this.
|
|
229
|
-
this._promptRunQueue.Insert(promptRun);
|
|
230
|
-
return promptRun;
|
|
231
|
-
}
|
|
232
|
-
catch (error) {
|
|
233
|
-
LogError(`AIModelRunner: Error creating AIPromptRun: ${error}`);
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
29
|
+
return this._embeddingRunner.RunEmbedding(params);
|
|
236
30
|
}
|
|
237
31
|
/**
|
|
238
|
-
* Awaits all in-flight prompt-run saves queued by this runner.
|
|
239
|
-
* call this — persistence is intentionally fire-and-forget. For tests / durability needs.
|
|
32
|
+
* Awaits all in-flight prompt-run saves queued by this runner.
|
|
240
33
|
*/
|
|
241
34
|
async WaitForPendingPromptRunSaves() {
|
|
242
|
-
await this.
|
|
243
|
-
}
|
|
244
|
-
async completeRunRecord(promptRun, embedResult, startTime) {
|
|
245
|
-
if (!promptRun)
|
|
246
|
-
return;
|
|
247
|
-
try {
|
|
248
|
-
promptRun.Status = 'Completed';
|
|
249
|
-
promptRun.Success = true;
|
|
250
|
-
promptRun.CompletedAt = new Date();
|
|
251
|
-
promptRun.ExecutionTimeMS = Date.now() - startTime;
|
|
252
|
-
// Store token/cost from ModelUsage
|
|
253
|
-
if (embedResult.ModelUsage) {
|
|
254
|
-
// TokensPrompt = UNCACHED ("net-new") input; cache reads/writes tracked separately.
|
|
255
|
-
// TokensUsed = totalTokens = promptTokens + completionTokens (EXCLUDES cache), to
|
|
256
|
-
// satisfy the AIPromptRun invariant TokensUsed === TokensPrompt + TokensCompletion.
|
|
257
|
-
// (Embeddings don't cache, so cache buckets are 0 here regardless.)
|
|
258
|
-
promptRun.TokensPrompt = embedResult.ModelUsage.promptTokens ?? 0;
|
|
259
|
-
promptRun.TokensCompletion = embedResult.ModelUsage.completionTokens ?? 0;
|
|
260
|
-
promptRun.TokensUsed = embedResult.ModelUsage.totalTokens ?? 0;
|
|
261
|
-
promptRun.TokensCacheRead = embedResult.ModelUsage.cacheReadTokens ?? 0;
|
|
262
|
-
promptRun.TokensCacheWrite = embedResult.ModelUsage.cacheWriteTokens ?? 0;
|
|
263
|
-
promptRun.Cost = embedResult.ModelUsage.cost ?? 0;
|
|
264
|
-
promptRun.CostCurrency = embedResult.ModelUsage.costCurrency ?? 'USD';
|
|
265
|
-
promptRun.QueueTime = embedResult.ModelUsage.queueTime ?? 0;
|
|
266
|
-
promptRun.PromptTime = embedResult.ModelUsage.promptTime ?? 0;
|
|
267
|
-
promptRun.CompletionTime = embedResult.ModelUsage.completionTime ?? 0;
|
|
268
|
-
}
|
|
269
|
-
// Store vector count in Result
|
|
270
|
-
promptRun.Result = JSON.stringify({
|
|
271
|
-
vectorCount: embedResult.vectors?.length ?? 0,
|
|
272
|
-
dimensions: embedResult.vectors?.[0]?.length ?? 0,
|
|
273
|
-
});
|
|
274
|
-
this._promptRunQueue.Update(promptRun); // fire-and-forget UPDATE; the INSERT landed during the embedding call
|
|
275
|
-
}
|
|
276
|
-
catch (error) {
|
|
277
|
-
LogError(`AIModelRunner: Error completing AIPromptRun: ${error}`);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
async failRunRecord(promptRun, errorMessage, startTime) {
|
|
281
|
-
if (!promptRun)
|
|
282
|
-
return;
|
|
283
|
-
try {
|
|
284
|
-
promptRun.Status = 'Failed';
|
|
285
|
-
promptRun.Success = false;
|
|
286
|
-
promptRun.ErrorMessage = errorMessage;
|
|
287
|
-
promptRun.CompletedAt = new Date();
|
|
288
|
-
promptRun.ExecutionTimeMS = Date.now() - startTime;
|
|
289
|
-
this._promptRunQueue.Update(promptRun); // fire-and-forget UPDATE; the INSERT landed during the embedding call
|
|
290
|
-
}
|
|
291
|
-
catch (error) {
|
|
292
|
-
LogError(`AIModelRunner: Error failing AIPromptRun: ${error}`);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
// ================================================================
|
|
296
|
-
// Private: Helpers
|
|
297
|
-
// ================================================================
|
|
298
|
-
errorResult(message, startTime) {
|
|
299
|
-
return {
|
|
300
|
-
Success: false,
|
|
301
|
-
Vectors: [],
|
|
302
|
-
PromptRunID: null,
|
|
303
|
-
TokensUsed: 0,
|
|
304
|
-
Cost: 0,
|
|
305
|
-
ErrorMessage: message,
|
|
306
|
-
ExecutionTimeMs: Date.now() - startTime,
|
|
307
|
-
};
|
|
35
|
+
await this._embeddingRunner.WaitForPendingPromptRunSaves();
|
|
308
36
|
}
|
|
309
37
|
}
|
|
310
38
|
//# sourceMappingURL=AIModelRunner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIModelRunner.js","sourceRoot":"","sources":["../src/AIModelRunner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AIModelRunner.js","sourceRoot":"","sources":["../src/AIModelRunner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAKlE;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAA1B;QACY,qBAAgB,GAAG,IAAI,iBAAiB,EAAE,CAAC;IA6BvD,CAAC;IA3BG;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC;IAC1C,CAAC;IACD,IAAW,QAAQ,CAAC,KAA+B;QAC/C,IAAI,CAAC,gBAAgB,CAAC,QAAQ,GAAG,KAAK,CAAC;IAC3C,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,YAAY,CAAC,MAA0B;QAChD,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,4BAA4B;QACrC,MAAM,IAAI,CAAC,gBAAgB,CAAC,4BAA4B,EAAE,CAAC;IAC/D,CAAC;CACJ"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { BaseEntitySaveQueue, Metadata, IMetadataProvider } from '@memberjunction/core';
|
|
15
15
|
import { MJAIModelVendorEntity } from '@memberjunction/core-entities';
|
|
16
16
|
import { MJAIModelEntityExtended, MJAIPromptEntityExtended, MJAIPromptRunEntityExtended, AIPromptParams, AIModelSelectionInfo } from '@memberjunction/ai-core-plus';
|
|
17
|
-
import { BaseResult, AIPromptConfiguration } from '@memberjunction/ai';
|
|
17
|
+
import { BaseResult, AIPromptConfiguration, ModelUsage } from '@memberjunction/ai';
|
|
18
18
|
/**
|
|
19
19
|
* The composed bound applied to a single model call: the caller's cancellation token (if any) merged
|
|
20
20
|
* with the prompt's configured `AIPrompt.TimeoutMS` (if any).
|
|
@@ -80,6 +80,13 @@ export interface FailoverAttempt {
|
|
|
80
80
|
duration: number;
|
|
81
81
|
timestamp: Date;
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* The `MJ: AI Prompt Runs` columns that {@link BaseModelRunner.ApplyUsageToRunRecord} writes, with
|
|
85
|
+
* the row's `ID` for its log line. Narrower than the entity, so the helper states exactly what it
|
|
86
|
+
* touches. Exported because it names a protected method's parameter, which a subclass outside this
|
|
87
|
+
* package must be able to write.
|
|
88
|
+
*/
|
|
89
|
+
export type PromptRunUsageFields = Pick<MJAIPromptRunEntityExtended, 'ID' | 'TokensPrompt' | 'TokensCompletion' | 'TokensUsed' | 'UsageTypeID' | 'InputUnitsUsed' | 'OutputUnitsUsed' | 'Cost' | 'CostCurrency'>;
|
|
83
90
|
/**
|
|
84
91
|
* Shared machinery for runners that invoke a model and record the call as an `MJ: AI Prompt Runs`
|
|
85
92
|
* row: candidate model/vendor selection, credential resolution, execution bounds (timeout and
|
|
@@ -490,6 +497,34 @@ export declare abstract class BaseModelRunner {
|
|
|
490
497
|
* inside the queued save task, and anything it sets after an `await` can miss the UPDATE.
|
|
491
498
|
*/
|
|
492
499
|
protected FinalizeRunRecord(promptRun: MJAIPromptRunEntityExtended, success: boolean, endTime: Date, executionTimeMS: number, applyResultFields: (promptRun: MJAIPromptRunEntityExtended) => void): Promise<void>;
|
|
500
|
+
/**
|
|
501
|
+
* The usage to record for one call: the driver's when it reports a quantity (tokens, or units in
|
|
502
|
+
* a measure), otherwise the runner's own count, which keeps any cost the driver gave. With neither,
|
|
503
|
+
* the driver's usage (possibly undefined) is returned, and nothing is invented.
|
|
504
|
+
*
|
|
505
|
+
* A runner counts what it can see without the driver: the images returned, or the characters it
|
|
506
|
+
* sent. The driver's figure wins because it is the vendor's own measure.
|
|
507
|
+
*
|
|
508
|
+
* @param reported The usage the driver returned, if any.
|
|
509
|
+
* @param counted The runner's own count as `ModelUsage.ForMedia`, or undefined when it has none.
|
|
510
|
+
*/
|
|
511
|
+
protected ResolveUsageToRecord(reported: ModelUsage | undefined, counted: ModelUsage | undefined): ModelUsage | undefined;
|
|
512
|
+
/**
|
|
513
|
+
* Records one call's usage on its run row, for runners whose calls are not chat calls: tokens;
|
|
514
|
+
* continuous units (seconds, characters, images) with the `MJ: AI Usage Types` row that names
|
|
515
|
+
* their measure; and a cost only when the driver gave one. With no usage nothing is recorded, so
|
|
516
|
+
* the cost stays empty and the row's save prices it from the model's cost rows, or declines to.
|
|
517
|
+
*
|
|
518
|
+
* Call it from the {@link FinalizeRunRecord} callback.
|
|
519
|
+
*/
|
|
520
|
+
protected ApplyUsageToRunRecord(run: PromptRunUsageFields, usage: ModelUsage | undefined): void;
|
|
521
|
+
/** Whether the usage names any quantity: tokens, or units in a measure other than tokens. */
|
|
522
|
+
private reportsUsageQuantity;
|
|
523
|
+
/**
|
|
524
|
+
* Records continuous units with the usage type that names their measure. Units without a
|
|
525
|
+
* resolvable usage type would be read as tokens, so they are skipped with a log line.
|
|
526
|
+
*/
|
|
527
|
+
private applyUnitUsage;
|
|
493
528
|
/**
|
|
494
529
|
* Estimates the number of tokens in a rendered prompt and conversation messages.
|
|
495
530
|
* This is a rough estimation based on character count and typical token ratios.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseModelRunner.d.ts","sourceRoot":"","sources":["../src/BaseModelRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,mBAAmB,EAKnB,QAAQ,EACR,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAEL,qBAAqB,EAGtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,EAC3B,cAAc,EACd,oBAAoB,EAErB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,UAAU,EAIV,qBAAqB,
|
|
1
|
+
{"version":3,"file":"BaseModelRunner.d.ts","sourceRoot":"","sources":["../src/BaseModelRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,mBAAmB,EAKnB,QAAQ,EACR,iBAAiB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