@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.
Files changed (82) hide show
  1. package/README.md +41 -0
  2. package/dist/AIModelRunner.d.ts +9 -88
  3. package/dist/AIModelRunner.d.ts.map +1 -1
  4. package/dist/AIModelRunner.js +11 -283
  5. package/dist/AIModelRunner.js.map +1 -1
  6. package/dist/BaseModelRunner.d.ts +36 -1
  7. package/dist/BaseModelRunner.d.ts.map +1 -1
  8. package/dist/BaseModelRunner.js +82 -3
  9. package/dist/BaseModelRunner.js.map +1 -1
  10. package/dist/audio/AISpeechToTextRunner.d.ts +46 -0
  11. package/dist/audio/AISpeechToTextRunner.d.ts.map +1 -0
  12. package/dist/audio/AISpeechToTextRunner.js +93 -0
  13. package/dist/audio/AISpeechToTextRunner.js.map +1 -0
  14. package/dist/audio/AITextToSpeechRunner.d.ts +43 -0
  15. package/dist/audio/AITextToSpeechRunner.d.ts.map +1 -0
  16. package/dist/audio/AITextToSpeechRunner.js +80 -0
  17. package/dist/audio/AITextToSpeechRunner.js.map +1 -0
  18. package/dist/audio/audio-description.d.ts +22 -0
  19. package/dist/audio/audio-description.d.ts.map +1 -0
  20. package/dist/audio/audio-description.js +52 -0
  21. package/dist/audio/audio-description.js.map +1 -0
  22. package/dist/audio/audio-runner.types.d.ts +46 -0
  23. package/dist/audio/audio-runner.types.d.ts.map +1 -0
  24. package/dist/audio/audio-runner.types.js +7 -0
  25. package/dist/audio/audio-runner.types.js.map +1 -0
  26. package/dist/decision/AIDecisionRunner.d.ts +134 -0
  27. package/dist/decision/AIDecisionRunner.d.ts.map +1 -0
  28. package/dist/decision/AIDecisionRunner.js +498 -0
  29. package/dist/decision/AIDecisionRunner.js.map +1 -0
  30. package/dist/decision/LLMDecision.d.ts +158 -0
  31. package/dist/decision/LLMDecision.d.ts.map +1 -0
  32. package/dist/decision/LLMDecision.js +493 -0
  33. package/dist/decision/LLMDecision.js.map +1 -0
  34. package/dist/decision/decision-questions.d.ts +28 -0
  35. package/dist/decision/decision-questions.d.ts.map +1 -0
  36. package/dist/decision/decision-questions.js +123 -0
  37. package/dist/decision/decision-questions.js.map +1 -0
  38. package/dist/decision/decision-runner.types.d.ts +29 -0
  39. package/dist/decision/decision-runner.types.d.ts.map +1 -0
  40. package/dist/decision/decision-runner.types.js +14 -0
  41. package/dist/decision/decision-runner.types.js.map +1 -0
  42. package/dist/embedding/AIEmbeddingRunner.d.ts +115 -0
  43. package/dist/embedding/AIEmbeddingRunner.d.ts.map +1 -0
  44. package/dist/embedding/AIEmbeddingRunner.js +462 -0
  45. package/dist/embedding/AIEmbeddingRunner.js.map +1 -0
  46. package/dist/embedding/embedding-runner.types.d.ts +72 -0
  47. package/dist/embedding/embedding-runner.types.d.ts.map +1 -0
  48. package/dist/embedding/embedding-runner.types.js +2 -0
  49. package/dist/embedding/embedding-runner.types.js.map +1 -0
  50. package/dist/image/AIImageGenerationRunner.d.ts +101 -0
  51. package/dist/image/AIImageGenerationRunner.d.ts.map +1 -0
  52. package/dist/image/AIImageGenerationRunner.js +355 -0
  53. package/dist/image/AIImageGenerationRunner.js.map +1 -0
  54. package/dist/image/image-runner.types.d.ts +90 -0
  55. package/dist/image/image-runner.types.d.ts.map +1 -0
  56. package/dist/image/image-runner.types.js +7 -0
  57. package/dist/image/image-runner.types.js.map +1 -0
  58. package/dist/index.d.ts +16 -1
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +15 -0
  61. package/dist/index.js.map +1 -1
  62. package/dist/media/BaseMediaRunner.d.ts +143 -0
  63. package/dist/media/BaseMediaRunner.d.ts.map +1 -0
  64. package/dist/media/BaseMediaRunner.js +448 -0
  65. package/dist/media/BaseMediaRunner.js.map +1 -0
  66. package/dist/media/media-runner.types.d.ts +128 -0
  67. package/dist/media/media-runner.types.d.ts.map +1 -0
  68. package/dist/media/media-runner.types.js +8 -0
  69. package/dist/media/media-runner.types.js.map +1 -0
  70. package/dist/media/media-usage.d.ts +13 -0
  71. package/dist/media/media-usage.d.ts.map +1 -0
  72. package/dist/media/media-usage.js +18 -0
  73. package/dist/media/media-usage.js.map +1 -0
  74. package/dist/video/AIVideoRunner.d.ts +46 -0
  75. package/dist/video/AIVideoRunner.d.ts.map +1 -0
  76. package/dist/video/AIVideoRunner.js +88 -0
  77. package/dist/video/AIVideoRunner.js.map +1 -0
  78. package/dist/video/video-runner.types.d.ts +29 -0
  79. package/dist/video/video-runner.types.d.ts.map +1 -0
  80. package/dist/video/video-runner.types.js +7 -0
  81. package/dist/video/video-runner.types.js.map +1 -0
  82. package/package.json +12 -12
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @fileoverview Runner for image generation and editing on `Image Generator` models.
3
+ *
4
+ * @module @memberjunction/ai-prompts
5
+ */
6
+ import { ImageGenerationResult } from '@memberjunction/ai';
7
+ import { BaseModelRunner, FailoverAttempt } from '../BaseModelRunner.js';
8
+ import { AIImageEditRunParams, AIImageGenerationRunParams, AIImageRunResult } from './image-runner.types.js';
9
+ /**
10
+ * Runs image generation and editing on `Image Generator` models. It does for an image call what
11
+ * `AIPromptRunner` does for a chat call: selects a model from the carrier prompt's bindings (or the
12
+ * pinned `ModelID`), resolves credentials, fails over, and writes an `MJ: AI Prompt Runs` row.
13
+ *
14
+ * The row never holds image bytes: `Messages` records the prompt text and the image count, and
15
+ * `Result` the count and sizes of the images. Usage is the driver's when it reports a quantity;
16
+ * otherwise the images returned are counted in the `Images` measure, so the model's `Per Image`
17
+ * cost row prices the run when the row saves. The runner never sets a cost itself.
18
+ */
19
+ export declare class AIImageGenerationRunner extends BaseModelRunner {
20
+ /** The carrier prompt used when the caller names none. */
21
+ static readonly DEFAULT_PROMPT_NAME = "Default Image Generation";
22
+ /** Image calls run only on `Image Generator` models. */
23
+ get RequiredModelType(): string;
24
+ protected get DefaultLogCategory(): string;
25
+ /**
26
+ * Generates images from a text prompt (`BaseImageGenerator.GenerateImage`). Never throws: every
27
+ * failure is a result with `Success: false` and an `ErrorMessage`.
28
+ */
29
+ RunImageGeneration(params: AIImageGenerationRunParams): Promise<AIImageRunResult>;
30
+ /**
31
+ * Edits a source image with a text prompt and an optional mask (`BaseImageGenerator.EditImage`).
32
+ * Never throws: every failure is a result with `Success: false` and an `ErrorMessage`.
33
+ */
34
+ RunImageEdit(params: AIImageEditRunParams): Promise<AIImageRunResult>;
35
+ /**
36
+ * The shared lifecycle: validate, choose the carrier prompt and candidates, create the run row,
37
+ * call the driver with failover, then finalize the row. An exception after the row exists
38
+ * finalizes it as failed, so it never stays 'Running'.
39
+ */
40
+ private runOperation;
41
+ /** Returns an error message when the request cannot run, otherwise undefined. */
42
+ private validateParams;
43
+ /** The carrier prompt named by `PromptID`, or the default one by name; otherwise why it is missing. */
44
+ private resolvePrompt;
45
+ /**
46
+ * The base runner reads its settings from `AIPromptParams`, so the image params are mapped onto
47
+ * one: the carrier prompt, the context user, the keys, the parent run, the agent and its
48
+ * run-created hook, and the runner's provider.
49
+ */
50
+ private buildPromptParams;
51
+ /** Builds the candidates, or returns the reason there are none. The type floor throws here. */
52
+ private buildCandidates;
53
+ /** Selects the first candidate with credentials, or returns an error listing every candidate. */
54
+ private selectCandidate;
55
+ /**
56
+ * Runs the selected candidate alone when failover is off, otherwise the base failover loop. Tracks
57
+ * the candidate that produced the result, so the caller reports the model that actually answered.
58
+ */
59
+ private runOnCandidates;
60
+ /** Makes the call on one candidate: resolves its credential, builds its driver, and calls it. */
61
+ private executeOnCandidate;
62
+ /** Builds the candidate's driver through the ClassFactory, or returns why it cannot be built. */
63
+ private createDriver;
64
+ /** Calls the driver. A driver that throws gets the vendor's own error classification. */
65
+ private callDriver;
66
+ /** The model name the driver is given: the vendor's API name, else the model's, else its name. */
67
+ private apiNameFor;
68
+ /** A copy of the caller's params without the runner's own fields, so a driver never sees the user or keys. */
69
+ private driverParams;
70
+ /**
71
+ * A failed call that allows failover to the next candidate. The severity must not be 'Fatal':
72
+ * the failover loop stops on any Fatal error before it reads `canFailover`.
73
+ */
74
+ private failedImage;
75
+ /** The result returned when every failover candidate has failed. */
76
+ protected createFailoverErrorResult(lastError: Error | null, failoverAttempts: FailoverAttempt[]): ImageGenerationResult;
77
+ /** The run row's `Messages`: the operation, the prompt text and the image count, never an image. */
78
+ private describeRequest;
79
+ /** The run row's `Result`: the count, sizes and formats of the images, never the images. */
80
+ private describeImages;
81
+ /** Finalizes the run row with the image summary, the usage to record, and any error. */
82
+ private finalizeImageRun;
83
+ /** Finalizes a run row as failed, so an exception after it was created never leaves it 'Running'. */
84
+ private finalizeFailedRun;
85
+ /**
86
+ * The usage to record: the driver's when it reported a quantity (tokens or units), otherwise the
87
+ * images it returned, counted as output units in the `Images` measure. Image cost rows price
88
+ * that count (`Per Image`, rate in `OutputPricePerUnit`) when the row saves. A driver's own cost
89
+ * is kept. A call that returned no images records nothing.
90
+ */
91
+ private usageToRecord;
92
+ /** Builds the caller's result from the driver's, naming the candidate that answered. */
93
+ private buildRunResult;
94
+ /** A failed result for a request that never reached, or never finished, a model call. */
95
+ private failedRunResult;
96
+ /** The key format BaseModelRunner's failover credential cache uses. */
97
+ private candidateKey;
98
+ /** Records which candidate was chosen and why, for the run row. */
99
+ private buildSelectionInfo;
100
+ }
101
+ //# sourceMappingURL=AIImageGenerationRunner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIImageGenerationRunner.d.ts","sourceRoot":"","sources":["../../src/image/AIImageGenerationRunner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAML,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAO5B,OAAO,EACL,eAAe,EACf,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAE1B,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AA0B9B;;;;;;;;;GASG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;IAC1D,0DAA0D;IAC1D,gBAAuB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}
@@ -0,0 +1,355 @@
1
+ /**
2
+ * @fileoverview Runner for image generation and editing on `Image Generator` models.
3
+ *
4
+ * @module @memberjunction/ai-prompts
5
+ */
6
+ import { MJGlobal, UUIDsEqual, NormalizeUUID } from '@memberjunction/global';
7
+ import { AIEngine } from '@memberjunction/aiengine';
8
+ import { BaseImageGenerator, ErrorAnalyzer, ImageGenerationResult, ModelUsage, } from '@memberjunction/ai';
9
+ import { AIModelSelectionInfo, AIPromptParams, } from '@memberjunction/ai-core-plus';
10
+ import { BaseModelRunner, } from '../BaseModelRunner.js';
11
+ /**
12
+ * Runs image generation and editing on `Image Generator` models. It does for an image call what
13
+ * `AIPromptRunner` does for a chat call: selects a model from the carrier prompt's bindings (or the
14
+ * pinned `ModelID`), resolves credentials, fails over, and writes an `MJ: AI Prompt Runs` row.
15
+ *
16
+ * The row never holds image bytes: `Messages` records the prompt text and the image count, and
17
+ * `Result` the count and sizes of the images. Usage is the driver's when it reports a quantity;
18
+ * otherwise the images returned are counted in the `Images` measure, so the model's `Per Image`
19
+ * cost row prices the run when the row saves. The runner never sets a cost itself.
20
+ */
21
+ export class AIImageGenerationRunner extends BaseModelRunner {
22
+ /** The carrier prompt used when the caller names none. */
23
+ static { this.DEFAULT_PROMPT_NAME = 'Default Image Generation'; }
24
+ /** Image calls run only on `Image Generator` models. */
25
+ get RequiredModelType() {
26
+ return 'Image Generator';
27
+ }
28
+ get DefaultLogCategory() {
29
+ return 'AIImageGenerationRunner';
30
+ }
31
+ /**
32
+ * Generates images from a text prompt (`BaseImageGenerator.GenerateImage`). Never throws: every
33
+ * failure is a result with `Success: false` and an `ErrorMessage`.
34
+ */
35
+ async RunImageGeneration(params) {
36
+ return this.runOperation(params, {
37
+ Name: 'Generate',
38
+ Invoke: (driver, model) => driver.GenerateImage({ ...this.driverParams(params), model }),
39
+ });
40
+ }
41
+ /**
42
+ * Edits a source image with a text prompt and an optional mask (`BaseImageGenerator.EditImage`).
43
+ * Never throws: every failure is a result with `Success: false` and an `ErrorMessage`.
44
+ */
45
+ async RunImageEdit(params) {
46
+ return this.runOperation(params, {
47
+ Name: 'Edit',
48
+ Invalid: params?.image ? undefined : 'A source image is required (params.image)',
49
+ Invoke: (driver, model) => driver.EditImage({ ...this.driverParams(params), model }),
50
+ });
51
+ }
52
+ /**
53
+ * The shared lifecycle: validate, choose the carrier prompt and candidates, create the run row,
54
+ * call the driver with failover, then finalize the row. An exception after the row exists
55
+ * finalizes it as failed, so it never stays 'Running'.
56
+ */
57
+ async runOperation(params, operation) {
58
+ const startTime = new Date();
59
+ let promptRun;
60
+ let selected;
61
+ try {
62
+ const invalid = this.validateParams(params, operation);
63
+ if (invalid) {
64
+ return this.failedRunResult(invalid, startTime);
65
+ }
66
+ await AIEngine.Instance.Config(false, params.ContextUser);
67
+ const prompt = this.resolvePrompt(params.PromptID);
68
+ if (typeof prompt === 'string') {
69
+ return this.failedRunResult(prompt, startTime);
70
+ }
71
+ const promptParams = this.buildPromptParams(params, prompt);
72
+ const candidates = this.buildCandidates(prompt, params.ModelID, promptParams);
73
+ if (typeof candidates === 'string') {
74
+ return this.failedRunResult(candidates, startTime);
75
+ }
76
+ const selection = this.selectCandidate(prompt, candidates, promptParams);
77
+ if (typeof selection === 'string') {
78
+ return this.failedRunResult(selection, startTime);
79
+ }
80
+ selected = selection.Candidate;
81
+ const selectionInfo = this.buildSelectionInfo(prompt, candidates, selection);
82
+ promptRun = await this.CreateRunRecord(prompt, selected.model, promptParams, startTime, selected.vendorId, selectionInfo, run => {
83
+ run.Messages = this.describeRequest(params, operation);
84
+ });
85
+ const run = await this.runOnCandidates(prompt, promptParams, candidates, selection, operation, promptRun);
86
+ const endTime = new Date();
87
+ const executionTimeMS = endTime.getTime() - startTime.getTime();
88
+ await this.finalizeImageRun(promptRun, run.Result, endTime, executionTimeMS);
89
+ return this.buildRunResult(run, promptRun, executionTimeMS);
90
+ }
91
+ catch (err) {
92
+ const message = err instanceof Error ? err.message : String(err);
93
+ if (promptRun) {
94
+ await this.finalizeFailedRun(promptRun, message, startTime);
95
+ }
96
+ return this.failedRunResult(message, startTime, promptRun, selected);
97
+ }
98
+ }
99
+ /** Returns an error message when the request cannot run, otherwise undefined. */
100
+ validateParams(params, operation) {
101
+ if (!params) {
102
+ return 'Image run parameters are required';
103
+ }
104
+ if (!params.prompt || params.prompt.trim().length === 0) {
105
+ return 'Image prompt text is required (params.prompt)';
106
+ }
107
+ return operation.Invalid;
108
+ }
109
+ /** The carrier prompt named by `PromptID`, or the default one by name; otherwise why it is missing. */
110
+ resolvePrompt(promptId) {
111
+ if (promptId) {
112
+ const byId = AIEngine.Instance.Prompts.find(p => UUIDsEqual(p.ID, promptId));
113
+ return byId ?? `Image generation prompt ${promptId} was not found`;
114
+ }
115
+ const target = AIImageGenerationRunner.DEFAULT_PROMPT_NAME.toLowerCase();
116
+ const byName = AIEngine.Instance.Prompts.find(p => p.Name?.trim().toLowerCase() === target);
117
+ return byName ?? `The '${AIImageGenerationRunner.DEFAULT_PROMPT_NAME}' prompt was not found. Push the prompt metadata, or pass PromptID.`;
118
+ }
119
+ /**
120
+ * The base runner reads its settings from `AIPromptParams`, so the image params are mapped onto
121
+ * one: the carrier prompt, the context user, the keys, the parent run, the agent and its
122
+ * run-created hook, and the runner's provider.
123
+ */
124
+ buildPromptParams(params, prompt) {
125
+ const promptParams = new AIPromptParams();
126
+ promptParams.prompt = prompt;
127
+ promptParams.contextUser = params.ContextUser;
128
+ promptParams.apiKeys = params.APIKeys;
129
+ promptParams.parentPromptRunId = params.ParentRunID;
130
+ promptParams.agentId = params.AgentID;
131
+ promptParams.onPromptRunCreated = params.OnPromptRunCreated;
132
+ if (this._provider) {
133
+ promptParams.provider = this._provider;
134
+ }
135
+ return promptParams;
136
+ }
137
+ /** Builds the candidates, or returns the reason there are none. The type floor throws here. */
138
+ buildCandidates(prompt, modelId, promptParams) {
139
+ try {
140
+ const candidates = this.BuildModelVendorCandidates(prompt, modelId, undefined, undefined, promptParams.verbose);
141
+ return candidates.length > 0 ? candidates : `No Image Generator model candidates found for prompt '${prompt.Name}'`;
142
+ }
143
+ catch (err) {
144
+ return err instanceof Error ? err.message : String(err);
145
+ }
146
+ }
147
+ /** Selects the first candidate with credentials, or returns an error listing every candidate. */
148
+ selectCandidate(prompt, candidates, promptParams) {
149
+ const credentialAvailability = new Map();
150
+ let selected;
151
+ for (const candidate of candidates) {
152
+ const available = this.HasCredentialsAvailable(candidate.driverClass, prompt.ID, candidate.model.ID, candidate.vendorId, promptParams);
153
+ credentialAvailability.set(this.candidateKey(candidate), available);
154
+ if (available && !selected) {
155
+ selected = candidate;
156
+ }
157
+ }
158
+ if (!selected) {
159
+ const summary = candidates
160
+ .map(c => `[Model: ${c.model.Name}, Vendor: ${c.vendorName ?? 'default'}, Driver: ${c.driverClass}]`)
161
+ .join(', ');
162
+ return `No Image Generator model has credentials available for prompt '${prompt.Name}'. Candidates: ${summary}`;
163
+ }
164
+ return { Candidate: selected, CredentialAvailability: credentialAvailability };
165
+ }
166
+ /**
167
+ * Runs the selected candidate alone when failover is off, otherwise the base failover loop. Tracks
168
+ * the candidate that produced the result, so the caller reports the model that actually answered.
169
+ */
170
+ async runOnCandidates(prompt, promptParams, candidates, selection, operation, promptRun) {
171
+ let answeredBy = selection.Candidate;
172
+ const attempt = (candidate) => {
173
+ answeredBy = candidate;
174
+ return this.executeOnCandidate(candidate, prompt, promptParams, operation);
175
+ };
176
+ const failoverConfig = this.getFailoverConfiguration(prompt);
177
+ const result = failoverConfig.strategy === 'None'
178
+ ? await attempt(selection.Candidate)
179
+ : await this.ExecuteWithFailover(prompt, promptParams, candidates, failoverConfig, attempt, (err, attempts) => this.createFailoverErrorResult(err, attempts), promptRun, selection.CredentialAvailability);
180
+ return { Result: result, AnsweredBy: answeredBy };
181
+ }
182
+ /** Makes the call on one candidate: resolves its credential, builds its driver, and calls it. */
183
+ async executeOnCandidate(candidate, prompt, promptParams, operation) {
184
+ let apiKey;
185
+ try {
186
+ apiKey = await this.ResolveCredentialForExecution(candidate.driverClass, prompt.ID, candidate.model.ID, candidate.vendorId, promptParams);
187
+ }
188
+ catch (err) {
189
+ return this.failedImage(err instanceof Error ? err.message : String(err), 'Authentication');
190
+ }
191
+ const driver = this.createDriver(candidate, apiKey);
192
+ if (typeof driver === 'string') {
193
+ return this.failedImage(driver, 'ModelError');
194
+ }
195
+ return this.callDriver(driver, candidate, operation);
196
+ }
197
+ /** Builds the candidate's driver through the ClassFactory, or returns why it cannot be built. */
198
+ createDriver(candidate, apiKey) {
199
+ const driver = MJGlobal.Instance.ClassFactory.CreateInstance(BaseImageGenerator, candidate.driverClass, apiKey);
200
+ if (!driver || driver.constructor === BaseImageGenerator) {
201
+ return `No image generator is registered for driver class '${candidate.driverClass}'`;
202
+ }
203
+ return driver;
204
+ }
205
+ /** Calls the driver. A driver that throws gets the vendor's own error classification. */
206
+ async callDriver(driver, candidate, operation) {
207
+ try {
208
+ const result = await operation.Invoke(driver, this.apiNameFor(candidate));
209
+ return result ?? this.failedImage(`The image generator '${candidate.driverClass}' returned no result`, 'ModelError');
210
+ }
211
+ catch (err) {
212
+ const failed = this.failedImage(err instanceof Error ? err.message : String(err), 'Unknown');
213
+ failed.errorInfo = ErrorAnalyzer.AnalyzeError(err, candidate.vendorName);
214
+ return failed;
215
+ }
216
+ }
217
+ /** The model name the driver is given: the vendor's API name, else the model's, else its name. */
218
+ apiNameFor(candidate) {
219
+ return candidate.apiName || candidate.model.APIName || candidate.model.Name;
220
+ }
221
+ /** A copy of the caller's params without the runner's own fields, so a driver never sees the user or keys. */
222
+ driverParams(params) {
223
+ const driverParams = { ...params };
224
+ delete driverParams.ContextUser;
225
+ delete driverParams.ModelID;
226
+ delete driverParams.PromptID;
227
+ delete driverParams.APIKeys;
228
+ delete driverParams.ParentRunID;
229
+ delete driverParams.AgentID;
230
+ delete driverParams.OnPromptRunCreated;
231
+ delete driverParams.AgentRunID;
232
+ return driverParams;
233
+ }
234
+ /**
235
+ * A failed call that allows failover to the next candidate. The severity must not be 'Fatal':
236
+ * the failover loop stops on any Fatal error before it reads `canFailover`.
237
+ */
238
+ failedImage(message, errorType) {
239
+ const now = new Date();
240
+ const failed = new ImageGenerationResult(false, now, now);
241
+ failed.errorMessage = message;
242
+ failed.errorInfo = { errorType, severity: 'Retriable', canFailover: true };
243
+ return failed;
244
+ }
245
+ /** The result returned when every failover candidate has failed. */
246
+ createFailoverErrorResult(lastError, failoverAttempts) {
247
+ const now = new Date();
248
+ const result = new ImageGenerationResult(false, now, now);
249
+ result.errorMessage = lastError?.message || `Failover failed after ${failoverAttempts.length} attempts`;
250
+ result.exception = lastError;
251
+ if (lastError) {
252
+ result.errorInfo = ErrorAnalyzer.AnalyzeError(lastError);
253
+ }
254
+ return result;
255
+ }
256
+ /** The run row's `Messages`: the operation, the prompt text and the image count, never an image. */
257
+ describeRequest(params, operation) {
258
+ return JSON.stringify({
259
+ Operation: operation.Name,
260
+ Prompt: params.prompt,
261
+ NegativePrompt: params.negativePrompt,
262
+ ImageCount: params.n ?? 1,
263
+ AgentRunID: params.AgentRunID,
264
+ });
265
+ }
266
+ /** The run row's `Result`: the count, sizes and formats of the images, never the images. */
267
+ describeImages(result) {
268
+ const images = result?.images ?? [];
269
+ return JSON.stringify({
270
+ ImageCount: images.length,
271
+ Images: images.map(image => ({ Width: image.width ?? null, Height: image.height ?? null, Format: image.format })),
272
+ RevisedPrompt: result?.revisedPrompt,
273
+ });
274
+ }
275
+ /** Finalizes the run row with the image summary, the usage to record, and any error. */
276
+ async finalizeImageRun(promptRun, imageResult, endTime, executionTimeMS) {
277
+ await this.FinalizeRunRecord(promptRun, imageResult.success, endTime, executionTimeMS, run => {
278
+ run.Result = this.describeImages(imageResult);
279
+ this.ApplyUsageToRunRecord(run, this.usageToRecord(imageResult));
280
+ if (!imageResult.success && imageResult.errorMessage) {
281
+ run.ErrorMessage = imageResult.errorMessage;
282
+ }
283
+ });
284
+ }
285
+ /** Finalizes a run row as failed, so an exception after it was created never leaves it 'Running'. */
286
+ async finalizeFailedRun(promptRun, message, startTime) {
287
+ const endTime = new Date();
288
+ await this.FinalizeRunRecord(promptRun, false, endTime, endTime.getTime() - startTime.getTime(), run => {
289
+ run.ErrorMessage = message;
290
+ });
291
+ }
292
+ /**
293
+ * The usage to record: the driver's when it reported a quantity (tokens or units), otherwise the
294
+ * images it returned, counted as output units in the `Images` measure. Image cost rows price
295
+ * that count (`Per Image`, rate in `OutputPricePerUnit`) when the row saves. A driver's own cost
296
+ * is kept. A call that returned no images records nothing.
297
+ */
298
+ usageToRecord(result) {
299
+ const imageCount = result.images?.length ?? 0;
300
+ const counted = imageCount > 0 ? ModelUsage.ForMedia('Images', 0, imageCount) : undefined;
301
+ return this.ResolveUsageToRecord(result.usage, counted);
302
+ }
303
+ /** Builds the caller's result from the driver's, naming the candidate that answered. */
304
+ buildRunResult(run, promptRun, executionTimeMS) {
305
+ const imageResult = run.Result;
306
+ return {
307
+ Success: imageResult.success,
308
+ ErrorMessage: imageResult.success ? undefined : imageResult.errorMessage,
309
+ ImageResult: imageResult,
310
+ PromptRunID: promptRun.ID,
311
+ ModelID: run.AnsweredBy.model.ID,
312
+ ModelName: run.AnsweredBy.model.Name,
313
+ DriverClass: run.AnsweredBy.driverClass,
314
+ ExecutionTimeMS: executionTimeMS,
315
+ };
316
+ }
317
+ /** A failed result for a request that never reached, or never finished, a model call. */
318
+ failedRunResult(errorMessage, startTime, promptRun, selected) {
319
+ return {
320
+ Success: false,
321
+ ErrorMessage: errorMessage,
322
+ PromptRunID: promptRun?.ID,
323
+ ModelID: selected?.model.ID,
324
+ ModelName: selected?.model.Name,
325
+ DriverClass: selected?.driverClass,
326
+ ExecutionTimeMS: new Date().getTime() - startTime.getTime(),
327
+ };
328
+ }
329
+ /** The key format BaseModelRunner's failover credential cache uses. */
330
+ candidateKey(candidate) {
331
+ return `${candidate.driverClass}:${candidate.model.ID}:${candidate.vendorId || 'default'}`;
332
+ }
333
+ /** Records which candidate was chosen and why, for the run row. */
334
+ buildSelectionInfo(prompt, candidates, selection) {
335
+ const info = new AIModelSelectionInfo();
336
+ const selected = selection.Candidate;
337
+ info.ModelSelected = selected.model;
338
+ info.vendorSelected = selected.vendorId ? AIEngine.Instance.VendorsByID.get(NormalizeUUID(selected.vendorId)) : undefined;
339
+ info.selectionStrategy = prompt.SelectionStrategy || 'Specific';
340
+ info.SelectionReason = 'First candidate with available credentials';
341
+ info.FallbackUsed = false;
342
+ info.ModelsConsidered = candidates.map(c => {
343
+ const available = selection.CredentialAvailability.get(this.candidateKey(c)) ?? false;
344
+ return {
345
+ model: c.model,
346
+ vendor: c.vendorId ? AIEngine.Instance.VendorsByID.get(NormalizeUUID(c.vendorId)) : undefined,
347
+ priority: c.priority,
348
+ available,
349
+ unavailableReason: available ? undefined : 'No credentials available',
350
+ };
351
+ });
352
+ return info;
353
+ }
354
+ }
355
+ //# sourceMappingURL=AIImageGenerationRunner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIImageGenerationRunner.js","sourceRoot":"","sources":["../../src/image/AIImageGenerationRunner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAEL,kBAAkB,EAClB,aAAa,EAGb,qBAAqB,EACrB,UAAU,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EACpB,cAAc,GAGf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,eAAe,GAGhB,MAAM,oBAAoB,CAAC;AAgC5B;;;;;;;;;GASG;AACH,MAAM,OAAO,uBAAwB,SAAQ,eAAe;IAC1D,0DAA0D;aACnC,wBAAmB,GAAG,0BAA0B,CAAC;IAExE,wDAAwD;IACxD,IAAoB,iBAAiB;QACnC,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,IAAuB,kBAAkB;QACvC,OAAO,yBAAy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 -0,0 +1,90 @@
1
+ /**
2
+ * @fileoverview Parameter and result types for `AIImageGenerationRunner`.
3
+ *
4
+ * @module @memberjunction/ai-prompts
5
+ */
6
+ import type { UserInfo } from '@memberjunction/core';
7
+ import type { AIAPIKey, ImageEditParams, ImageGenerationParams, ImageGenerationResult } from '@memberjunction/ai';
8
+ /**
9
+ * What every image operation adds to its driver params: the fields the runner needs to choose a
10
+ * model, resolve its credential and record the run. The runner strips them before calling the
11
+ * driver, so a driver never sees the context user or the keys.
12
+ */
13
+ export interface AIImageRunOptions {
14
+ /** The user the run is made and recorded for. Required. */
15
+ ContextUser: UserInfo;
16
+ /**
17
+ * Pins the image model by ID, as `AIDecisionRunner` does with `override.modelId`. Failover then
18
+ * stays within that model's vendors. Leave it unset to let the carrier prompt's bindings choose,
19
+ * which is what makes failover reach another model.
20
+ */
21
+ ModelID?: string;
22
+ /**
23
+ * The `MJ: AI Prompts` row whose bindings choose the model and whose failover settings apply.
24
+ * Defaults to the `Default Image Generation` prompt.
25
+ */
26
+ PromptID?: string;
27
+ /**
28
+ * Keys by driver class, passed through as the base runner's `apiKeys`. A key reaches only the
29
+ * candidates of its own driver class, so a caller whose key should survive failover supplies one
30
+ * for each driver class a candidate may use.
31
+ *
32
+ * They rank as they do for chat prompts, just above the environment keys: a credential bound to
33
+ * the prompt-model, the model-vendor or the vendor, or a default credential of the vendor's
34
+ * credential type, wins over them.
35
+ */
36
+ APIKeys?: AIAPIKey[];
37
+ /** A parent `MJ: AI Prompt Runs` row, recorded as this run's `ParentID`. */
38
+ ParentRunID?: string;
39
+ /** The agent the call is made for, recorded as the run row's `AgentID`. */
40
+ AgentID?: string;
41
+ /**
42
+ * Called with the run row's ID as soon as the row exists, before the model call: the hook an
43
+ * agent step uses to point its `TargetLogID` at the row. An error it throws is logged, never
44
+ * raised.
45
+ */
46
+ OnPromptRunCreated?: (promptRunId: string) => void | Promise<void>;
47
+ /**
48
+ * The agent run this call belongs to. `MJ: AI Prompt Runs` has no agent-run column, so it is
49
+ * recorded in the row's `Messages`, for reading only. To join the row to the run, use
50
+ * {@link OnPromptRunCreated}.
51
+ */
52
+ AgentRunID?: string;
53
+ }
54
+ /**
55
+ * Parameters for `AIImageGenerationRunner.RunImageGeneration`: the driver's own
56
+ * `ImageGenerationParams` (prompt, n, size, quality, style and the rest), plus the runner's options.
57
+ * The driver's `model` is set by the runner, per candidate, to the candidate's API name.
58
+ */
59
+ export interface AIImageGenerationRunParams extends ImageGenerationParams, AIImageRunOptions {
60
+ }
61
+ /**
62
+ * Parameters for `AIImageGenerationRunner.RunImageEdit`: the driver's own `ImageEditParams`
63
+ * (image, prompt, mask and the rest), plus the runner's options. The source image and mask are
64
+ * passed to the driver and never recorded on the run row.
65
+ */
66
+ export interface AIImageEditRunParams extends ImageEditParams, AIImageRunOptions {
67
+ }
68
+ /**
69
+ * The result of an image operation. The runner never throws: every failure is `Success: false`
70
+ * with an `ErrorMessage`.
71
+ */
72
+ export interface AIImageRunResult {
73
+ /** Whether the driver reported success. A success can still carry zero images. */
74
+ Success: boolean;
75
+ /** Why the operation failed, when it did. */
76
+ ErrorMessage?: string;
77
+ /** The driver's result, with the images. Absent when the call never reached a model. */
78
+ ImageResult?: ImageGenerationResult;
79
+ /** The `MJ: AI Prompt Runs` row for this call. Absent when the call never reached a model. */
80
+ PromptRunID?: string;
81
+ /** The model that answered after any failover, or the last one tried when the call failed. */
82
+ ModelID?: string;
83
+ /** The name of that model. */
84
+ ModelName?: string;
85
+ /** The driver class of that model's vendor. */
86
+ DriverClass?: string;
87
+ /** Wall-clock time for the whole call, in milliseconds. */
88
+ ExecutionTimeMS: number;
89
+ }
90
+ //# sourceMappingURL=image-runner.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-runner.types.d.ts","sourceRoot":"","sources":["../../src/image/image-runner.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,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 +1,7 @@
1
+ /**
2
+ * @fileoverview Parameter and result types for `AIImageGenerationRunner`.
3
+ *
4
+ * @module @memberjunction/ai-prompts
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=image-runner.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-runner.types.js","sourceRoot":"","sources":["../../src/image/image-runner.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,23 @@
1
1
  export { BaseModelRunner } from './BaseModelRunner.js';
2
- export type { ModelVendorCandidate, FailoverAttempt } from './BaseModelRunner.js';
2
+ export type { ModelVendorCandidate, FailoverAttempt, PromptRunUsageFields } from './BaseModelRunner.js';
3
3
  export * from './AIPromptRunner.js';
4
4
  export * from './AIPromptTimeoutError.js';
5
5
  export * from './nativeToolCallingGate.js';
6
6
  export * from './AIModelRunner.js';
7
+ export * from './embedding/AIEmbeddingRunner.js';
8
+ export * from './embedding/embedding-runner.types.js';
9
+ export * from './image/AIImageGenerationRunner.js';
10
+ export * from './image/image-runner.types.js';
11
+ export * from './media/BaseMediaRunner.js';
12
+ export * from './media/media-runner.types.js';
13
+ export * from './audio/AITextToSpeechRunner.js';
14
+ export * from './audio/AISpeechToTextRunner.js';
15
+ export * from './audio/audio-runner.types.js';
16
+ export * from './video/AIVideoRunner.js';
17
+ export * from './video/video-runner.types.js';
7
18
  export * from './ParallelExecutionCoordinator.js';
19
+ export * from './decision/LLMDecision.js';
20
+ export * from './decision/decision-runner.types.js';
21
+ export * from './decision/AIDecisionRunner.js';
22
+ export * from './decision/decision-questions.js';
8
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/E,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AAIvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACrG,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AAIvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC"}
package/dist/index.js CHANGED
@@ -6,7 +6,22 @@ export * from './AIPromptTimeoutError.js';
6
6
  // helpers are how a caller reads back which path a run took.
7
7
  export * from './nativeToolCallingGate.js';
8
8
  export * from './AIModelRunner.js';
9
+ export * from './embedding/AIEmbeddingRunner.js';
10
+ export * from './embedding/embedding-runner.types.js';
11
+ export * from './image/AIImageGenerationRunner.js';
12
+ export * from './image/image-runner.types.js';
13
+ export * from './media/BaseMediaRunner.js';
14
+ export * from './media/media-runner.types.js';
15
+ export * from './audio/AITextToSpeechRunner.js';
16
+ export * from './audio/AISpeechToTextRunner.js';
17
+ export * from './audio/audio-runner.types.js';
18
+ export * from './video/AIVideoRunner.js';
19
+ export * from './video/video-runner.types.js';
9
20
  // Exported so its @RegisterClass runs (the base resolves it via the ClassFactory to avoid a
10
21
  // circular import) and so a full build picks it up into the class-registration manifests.
11
22
  export * from './ParallelExecutionCoordinator.js';
23
+ export * from './decision/LLMDecision.js';
24
+ export * from './decision/decision-runner.types.js';
25
+ export * from './decision/AIDecisionRunner.js';
26
+ export * from './decision/decision-questions.js';
12
27
  //# sourceMappingURL=index.js.map