@salesforce/lds-adapters-service-einsteinllm 1.287.1 → 1.289.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.
@@ -104,7 +104,219 @@ function createLink(ref) {
104
104
  };
105
105
  }
106
106
 
107
- function validate$9(obj, path = 'EinsteinLlmAdditionalConfigInputRepresentation') {
107
+ function validate$c(obj, path = 'EinsteinLlmFeedbackInputRepresentation') {
108
+ const v_error = (() => {
109
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
110
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
111
+ }
112
+ if (obj.appFeedback !== undefined) {
113
+ const obj_appFeedback = obj.appFeedback;
114
+ const path_appFeedback = path + '.appFeedback';
115
+ if (typeof obj_appFeedback !== 'object' || ArrayIsArray(obj_appFeedback) || obj_appFeedback === null) {
116
+ return new TypeError('Expected "object" but received "' + typeof obj_appFeedback + '" (at "' + path_appFeedback + '")');
117
+ }
118
+ const obj_appFeedback_keys = ObjectKeys(obj_appFeedback);
119
+ for (let i = 0; i < obj_appFeedback_keys.length; i++) {
120
+ const key = obj_appFeedback_keys[i];
121
+ const obj_appFeedback_prop = obj_appFeedback[key];
122
+ const path_appFeedback_prop = path_appFeedback + '["' + key + '"]';
123
+ if (typeof obj_appFeedback_prop !== 'object' || ArrayIsArray(obj_appFeedback_prop) || obj_appFeedback_prop === null) {
124
+ return new TypeError('Expected "object" but received "' + typeof obj_appFeedback_prop + '" (at "' + path_appFeedback_prop + '")');
125
+ }
126
+ }
127
+ }
128
+ if (obj.feedback !== undefined) {
129
+ const obj_feedback = obj.feedback;
130
+ const path_feedback = path + '.feedback';
131
+ if (typeof obj_feedback !== 'string') {
132
+ return new TypeError('Expected "string" but received "' + typeof obj_feedback + '" (at "' + path_feedback + '")');
133
+ }
134
+ }
135
+ const obj_feedbackText = obj.feedbackText;
136
+ const path_feedbackText = path + '.feedbackText';
137
+ if (typeof obj_feedbackText !== 'string') {
138
+ return new TypeError('Expected "string" but received "' + typeof obj_feedbackText + '" (at "' + path_feedbackText + '")');
139
+ }
140
+ const obj_generationId = obj.generationId;
141
+ const path_generationId = path + '.generationId';
142
+ if (typeof obj_generationId !== 'string') {
143
+ return new TypeError('Expected "string" but received "' + typeof obj_generationId + '" (at "' + path_generationId + '")');
144
+ }
145
+ const obj_id = obj.id;
146
+ const path_id = path + '.id';
147
+ if (typeof obj_id !== 'string') {
148
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
149
+ }
150
+ })();
151
+ return v_error === undefined ? null : v_error;
152
+ }
153
+
154
+ const TTL$2 = 100;
155
+ const VERSION$7 = "4033328f65865dd5d80c68a7573a4522";
156
+ function validate$b(obj, path = 'EinsteinLlmFeedbackRepresentation') {
157
+ const v_error = (() => {
158
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
159
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
160
+ }
161
+ const obj_message = obj.message;
162
+ const path_message = path + '.message';
163
+ if (typeof obj_message !== 'string') {
164
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
165
+ }
166
+ })();
167
+ return v_error === undefined ? null : v_error;
168
+ }
169
+ const RepresentationType$2 = 'EinsteinLlmFeedbackRepresentation';
170
+ function keyBuilder$2(luvio, config) {
171
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.message;
172
+ }
173
+ function keyBuilderFromType$2(luvio, object) {
174
+ const keyParams = {
175
+ message: object.message
176
+ };
177
+ return keyBuilder$2(luvio, keyParams);
178
+ }
179
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
180
+ return input;
181
+ }
182
+ const select$a = function EinsteinLlmFeedbackRepresentationSelect() {
183
+ return {
184
+ kind: 'Fragment',
185
+ version: VERSION$7,
186
+ private: [],
187
+ selections: [
188
+ {
189
+ name: 'message',
190
+ kind: 'Scalar'
191
+ }
192
+ ]
193
+ };
194
+ };
195
+ function equals$7(existing, incoming) {
196
+ const existing_message = existing.message;
197
+ const incoming_message = incoming.message;
198
+ if (!(existing_message === incoming_message)) {
199
+ return false;
200
+ }
201
+ return true;
202
+ }
203
+ const ingest$2 = function EinsteinLlmFeedbackRepresentationIngest(input, path, luvio, store, timestamp) {
204
+ if (process.env.NODE_ENV !== 'production') {
205
+ const validateError = validate$b(input);
206
+ if (validateError !== null) {
207
+ throw validateError;
208
+ }
209
+ }
210
+ const key = keyBuilderFromType$2(luvio, input);
211
+ const ttlToUse = TTL$2;
212
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "EinsteinLLM", VERSION$7, RepresentationType$2, equals$7);
213
+ return createLink(key);
214
+ };
215
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
216
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
217
+ const rootKey = keyBuilderFromType$2(luvio, input);
218
+ rootKeySet.set(rootKey, {
219
+ namespace: keyPrefix,
220
+ representationName: RepresentationType$2,
221
+ mergeable: false
222
+ });
223
+ }
224
+
225
+ function select$9(luvio, params) {
226
+ return select$a();
227
+ }
228
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
229
+ getTypeCacheKeys$2(storeKeyMap, luvio, response);
230
+ }
231
+ function ingestSuccess$2(luvio, resourceParams, response) {
232
+ const { body } = response;
233
+ const key = keyBuilderFromType$2(luvio, body);
234
+ luvio.storeIngest(key, ingest$2, body);
235
+ const snapshot = luvio.storeLookup({
236
+ recordId: key,
237
+ node: select$9(),
238
+ variables: {},
239
+ });
240
+ if (process.env.NODE_ENV !== 'production') {
241
+ if (snapshot.state !== 'Fulfilled') {
242
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
243
+ }
244
+ }
245
+ deepFreeze(snapshot.data);
246
+ return snapshot;
247
+ }
248
+ function createResourceRequest$2(config) {
249
+ const headers = {};
250
+ return {
251
+ baseUri: '/services/data/v61.0',
252
+ basePath: '/einstein/llm/feedback',
253
+ method: 'post',
254
+ body: config.body,
255
+ urlParams: {},
256
+ queryParams: {},
257
+ headers,
258
+ priority: 'normal',
259
+ };
260
+ }
261
+
262
+ const adapterName$2 = 'createFeedback';
263
+ const createFeedback_ConfigPropertyMetadata = [
264
+ generateParamConfigMetadata('feedbackInput', true, 2 /* Body */, 4 /* Unsupported */),
265
+ ];
266
+ const createFeedback_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, createFeedback_ConfigPropertyMetadata);
267
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(createFeedback_ConfigPropertyMetadata);
268
+ function typeCheckConfig$2(untrustedConfig) {
269
+ const config = {};
270
+ const untrustedConfig_feedbackInput = untrustedConfig.feedbackInput;
271
+ const referenceEinsteinLlmFeedbackInputRepresentationValidationError = validate$c(untrustedConfig_feedbackInput);
272
+ if (referenceEinsteinLlmFeedbackInputRepresentationValidationError === null) {
273
+ config.feedbackInput = untrustedConfig_feedbackInput;
274
+ }
275
+ return config;
276
+ }
277
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
278
+ if (!untrustedIsObject(untrustedConfig)) {
279
+ return null;
280
+ }
281
+ if (process.env.NODE_ENV !== 'production') {
282
+ validateConfig(untrustedConfig, configPropertyNames);
283
+ }
284
+ const config = typeCheckConfig$2(untrustedConfig);
285
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
286
+ return null;
287
+ }
288
+ return config;
289
+ }
290
+ function buildNetworkSnapshot$2(luvio, config, options) {
291
+ const resourceParams = createResourceParams$2(config);
292
+ const request = createResourceRequest$2(resourceParams);
293
+ return luvio.dispatchResourceRequest(request, options)
294
+ .then((response) => {
295
+ return luvio.handleSuccessResponse(() => {
296
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
297
+ return luvio.storeBroadcast().then(() => snapshot);
298
+ }, () => {
299
+ const cache = new StoreKeyMap();
300
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
301
+ return cache;
302
+ });
303
+ }, (response) => {
304
+ deepFreeze(response);
305
+ throw response;
306
+ });
307
+ }
308
+ const createFeedbackAdapterFactory = (luvio) => {
309
+ return function createFeedback(untrustedConfig) {
310
+ const config = validateAdapterConfig$2(untrustedConfig, createFeedback_ConfigPropertyNames);
311
+ // Invalid or incomplete config
312
+ if (config === null) {
313
+ throw new Error('Invalid config for "createFeedback"');
314
+ }
315
+ return buildNetworkSnapshot$2(luvio, config);
316
+ };
317
+ };
318
+
319
+ function validate$a(obj, path = 'EinsteinLlmAdditionalConfigInputRepresentation') {
108
320
  const v_error = (() => {
109
321
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
110
322
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -187,7 +399,7 @@ function validate$9(obj, path = 'EinsteinLlmAdditionalConfigInputRepresentation'
187
399
  return v_error === undefined ? null : v_error;
188
400
  }
189
401
 
190
- function validate$8(obj, path = 'EinsteinLlmGenerationsInputRepresentation') {
402
+ function validate$9(obj, path = 'EinsteinLlmGenerationsInputRepresentation') {
191
403
  const v_error = (() => {
192
404
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
193
405
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -195,7 +407,7 @@ function validate$8(obj, path = 'EinsteinLlmGenerationsInputRepresentation') {
195
407
  if (obj.additionalConfig !== undefined) {
196
408
  const obj_additionalConfig = obj.additionalConfig;
197
409
  const path_additionalConfig = path + '.additionalConfig';
198
- const referencepath_additionalConfigValidationError = validate$9(obj_additionalConfig, path_additionalConfig);
410
+ const referencepath_additionalConfigValidationError = validate$a(obj_additionalConfig, path_additionalConfig);
199
411
  if (referencepath_additionalConfigValidationError !== null) {
200
412
  let message = 'Object doesn\'t match EinsteinLlmAdditionalConfigInputRepresentation (at "' + path_additionalConfig + '")\n';
201
413
  message += referencepath_additionalConfigValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -218,494 +430,470 @@ function validate$8(obj, path = 'EinsteinLlmGenerationsInputRepresentation') {
218
430
  return v_error === undefined ? null : v_error;
219
431
  }
220
432
 
221
- const VERSION$4 = "9b45c0734fec120819b03e3b115caf64";
222
- function validate$7(obj, path = 'EinsteinLlmGenerationItemRepresentation') {
433
+ const VERSION$6 = "6ee3138e459fdb5a6bad0e0a8e4f4fd8";
434
+ function validate$8(obj, path = 'EinsteinLlmGenerationsContentQualityRepresentation') {
223
435
  const v_error = (() => {
224
436
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
225
437
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
226
438
  }
227
- const obj_parameters = obj.parameters;
228
- const path_parameters = path + '.parameters';
229
- if (typeof obj_parameters !== 'string') {
230
- return new TypeError('Expected "string" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
231
- }
232
- const obj_responseId = obj.responseId;
233
- const path_responseId = path + '.responseId';
234
- if (typeof obj_responseId !== 'string') {
235
- return new TypeError('Expected "string" but received "' + typeof obj_responseId + '" (at "' + path_responseId + '")');
236
- }
237
- const obj_text = obj.text;
238
- const path_text = path + '.text';
239
- if (typeof obj_text !== 'string') {
240
- return new TypeError('Expected "string" but received "' + typeof obj_text + '" (at "' + path_text + '")');
439
+ const obj_isToxicityDetected = obj.isToxicityDetected;
440
+ const path_isToxicityDetected = path + '.isToxicityDetected';
441
+ if (typeof obj_isToxicityDetected !== 'boolean') {
442
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isToxicityDetected + '" (at "' + path_isToxicityDetected + '")');
241
443
  }
242
444
  })();
243
445
  return v_error === undefined ? null : v_error;
244
446
  }
245
- const select$7 = function EinsteinLlmGenerationItemRepresentationSelect() {
447
+ const select$8 = function EinsteinLlmGenerationsContentQualityRepresentationSelect() {
246
448
  return {
247
449
  kind: 'Fragment',
248
- version: VERSION$4,
450
+ version: VERSION$6,
249
451
  private: [],
250
452
  selections: [
251
453
  {
252
- name: 'parameters',
253
- kind: 'Scalar'
254
- },
255
- {
256
- name: 'responseId',
257
- kind: 'Scalar'
258
- },
259
- {
260
- name: 'text',
454
+ name: 'isToxicityDetected',
261
455
  kind: 'Scalar'
262
456
  }
263
457
  ]
264
458
  };
265
459
  };
266
- function equals$4(existing, incoming) {
267
- const existing_parameters = existing.parameters;
268
- const incoming_parameters = incoming.parameters;
269
- if (!(existing_parameters === incoming_parameters)) {
270
- return false;
271
- }
272
- const existing_responseId = existing.responseId;
273
- const incoming_responseId = incoming.responseId;
274
- if (!(existing_responseId === incoming_responseId)) {
275
- return false;
276
- }
277
- const existing_text = existing.text;
278
- const incoming_text = incoming.text;
279
- if (!(existing_text === incoming_text)) {
460
+ function equals$6(existing, incoming) {
461
+ const existing_isToxicityDetected = existing.isToxicityDetected;
462
+ const incoming_isToxicityDetected = incoming.isToxicityDetected;
463
+ if (!(existing_isToxicityDetected === incoming_isToxicityDetected)) {
280
464
  return false;
281
465
  }
282
466
  return true;
283
467
  }
284
468
 
285
- const VERSION$3 = "4656c961c9d093a9e206c1db7d4de0b0";
286
- function validate$6(obj, path = 'WrappedMap') {
469
+ const VERSION$5 = "adf07d0c188c76ccfc6796d610950421";
470
+ function validate$7(obj, path = 'EinsteinLlmGenerationsSafetyScoreRepresentation') {
287
471
  const v_error = (() => {
288
472
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
289
473
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
290
474
  }
291
- const obj_wrappedMap = obj.wrappedMap;
292
- const path_wrappedMap = path + '.wrappedMap';
293
- if (typeof obj_wrappedMap !== 'object' || ArrayIsArray(obj_wrappedMap) || obj_wrappedMap === null) {
294
- return new TypeError('Expected "object" but received "' + typeof obj_wrappedMap + '" (at "' + path_wrappedMap + '")');
295
- }
296
- const obj_wrappedMap_keys = ObjectKeys(obj_wrappedMap);
297
- for (let i = 0; i < obj_wrappedMap_keys.length; i++) {
298
- const key = obj_wrappedMap_keys[i];
299
- const obj_wrappedMap_prop = obj_wrappedMap[key];
300
- const path_wrappedMap_prop = path_wrappedMap + '["' + key + '"]';
301
- if (typeof obj_wrappedMap_prop !== 'object' || ArrayIsArray(obj_wrappedMap_prop) || obj_wrappedMap_prop === null) {
302
- return new TypeError('Expected "object" but received "' + typeof obj_wrappedMap_prop + '" (at "' + path_wrappedMap_prop + '")');
303
- }
304
- }
475
+ obj.hateScore;
476
+ obj.physicalScore;
477
+ obj.profanityScore;
478
+ obj.safetyScore;
479
+ obj.sexualScore;
480
+ obj.toxicityScore;
481
+ obj.violenceScore;
305
482
  })();
306
483
  return v_error === undefined ? null : v_error;
307
484
  }
308
- const select$6 = function WrappedMapSelect() {
485
+ const select$7 = function EinsteinLlmGenerationsSafetyScoreRepresentationSelect() {
309
486
  return {
310
487
  kind: 'Fragment',
311
- version: VERSION$3,
488
+ version: VERSION$5,
312
489
  private: [],
313
- selections: []
314
- };
315
- };
316
- function equals$3(existing, incoming) {
317
- const existing_wrappedMap = existing.wrappedMap;
318
- const incoming_wrappedMap = incoming.wrappedMap;
319
- const equals_wrappedMap_props = equalsObject(existing_wrappedMap, incoming_wrappedMap, (existing_wrappedMap_prop, incoming_wrappedMap_prop) => {
320
- });
321
- if (equals_wrappedMap_props === false) {
490
+ selections: [
491
+ {
492
+ name: 'hateScore',
493
+ kind: 'Scalar'
494
+ },
495
+ {
496
+ name: 'physicalScore',
497
+ kind: 'Scalar'
498
+ },
499
+ {
500
+ name: 'profanityScore',
501
+ kind: 'Scalar'
502
+ },
503
+ {
504
+ name: 'safetyScore',
505
+ kind: 'Scalar'
506
+ },
507
+ {
508
+ name: 'sexualScore',
509
+ kind: 'Scalar'
510
+ },
511
+ {
512
+ name: 'toxicityScore',
513
+ kind: 'Scalar'
514
+ },
515
+ {
516
+ name: 'violenceScore',
517
+ kind: 'Scalar'
518
+ }
519
+ ]
520
+ };
521
+ };
522
+ function equals$5(existing, incoming) {
523
+ const existing_hateScore = existing.hateScore;
524
+ const incoming_hateScore = incoming.hateScore;
525
+ if (!(existing_hateScore === incoming_hateScore)) {
526
+ return false;
527
+ }
528
+ const existing_physicalScore = existing.physicalScore;
529
+ const incoming_physicalScore = incoming.physicalScore;
530
+ if (!(existing_physicalScore === incoming_physicalScore)) {
531
+ return false;
532
+ }
533
+ const existing_profanityScore = existing.profanityScore;
534
+ const incoming_profanityScore = incoming.profanityScore;
535
+ if (!(existing_profanityScore === incoming_profanityScore)) {
536
+ return false;
537
+ }
538
+ const existing_safetyScore = existing.safetyScore;
539
+ const incoming_safetyScore = incoming.safetyScore;
540
+ if (!(existing_safetyScore === incoming_safetyScore)) {
541
+ return false;
542
+ }
543
+ const existing_sexualScore = existing.sexualScore;
544
+ const incoming_sexualScore = incoming.sexualScore;
545
+ if (!(existing_sexualScore === incoming_sexualScore)) {
546
+ return false;
547
+ }
548
+ const existing_toxicityScore = existing.toxicityScore;
549
+ const incoming_toxicityScore = incoming.toxicityScore;
550
+ if (!(existing_toxicityScore === incoming_toxicityScore)) {
551
+ return false;
552
+ }
553
+ const existing_violenceScore = existing.violenceScore;
554
+ const incoming_violenceScore = incoming.violenceScore;
555
+ if (!(existing_violenceScore === incoming_violenceScore)) {
322
556
  return false;
323
557
  }
324
558
  return true;
325
559
  }
326
560
 
327
- const TTL$2 = 100;
328
- const VERSION$2 = "d8abd72a42e842b253da1c38954dafbc";
329
- function validate$5(obj, path = 'EinsteinLlmGenerationsRepresentation') {
561
+ const VERSION$4 = "ac8fee86830c1fbf10c9d8746373fedf";
562
+ function validate$6(obj, path = 'EinsteinLlmGenerationItemRepresentation') {
330
563
  const v_error = (() => {
331
564
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
332
565
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
333
566
  }
334
- const obj_generations = obj.generations;
335
- const path_generations = path + '.generations';
336
- if (!ArrayIsArray(obj_generations)) {
337
- return new TypeError('Expected "array" but received "' + typeof obj_generations + '" (at "' + path_generations + '")');
338
- }
339
- for (let i = 0; i < obj_generations.length; i++) {
340
- const obj_generations_item = obj_generations[i];
341
- const path_generations_item = path_generations + '[' + i + ']';
342
- const referencepath_generations_itemValidationError = validate$7(obj_generations_item, path_generations_item);
343
- if (referencepath_generations_itemValidationError !== null) {
344
- let message = 'Object doesn\'t match EinsteinLlmGenerationItemRepresentation (at "' + path_generations_item + '")\n';
345
- message += referencepath_generations_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
567
+ if (obj.contentQualityRepresentation !== undefined) {
568
+ const obj_contentQualityRepresentation = obj.contentQualityRepresentation;
569
+ const path_contentQualityRepresentation = path + '.contentQualityRepresentation';
570
+ const referencepath_contentQualityRepresentationValidationError = validate$8(obj_contentQualityRepresentation, path_contentQualityRepresentation);
571
+ if (referencepath_contentQualityRepresentationValidationError !== null) {
572
+ let message = 'Object doesn\'t match EinsteinLlmGenerationsContentQualityRepresentation (at "' + path_contentQualityRepresentation + '")\n';
573
+ message += referencepath_contentQualityRepresentationValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
346
574
  return new TypeError(message);
347
575
  }
348
576
  }
349
577
  const obj_parameters = obj.parameters;
350
578
  const path_parameters = path + '.parameters';
351
- let obj_parameters_union0 = null;
352
- const obj_parameters_union0_error = (() => {
353
- const referencepath_parametersValidationError = validate$6(obj_parameters, path_parameters);
354
- if (referencepath_parametersValidationError !== null) {
355
- let message = 'Object doesn\'t match WrappedMap (at "' + path_parameters + '")\n';
356
- message += referencepath_parametersValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
357
- return new TypeError(message);
358
- }
359
- })();
360
- if (obj_parameters_union0_error != null) {
361
- obj_parameters_union0 = obj_parameters_union0_error.message;
362
- }
363
- let obj_parameters_union1 = null;
364
- const obj_parameters_union1_error = (() => {
365
- if (obj_parameters !== null) {
366
- return new TypeError('Expected "null" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
367
- }
368
- })();
369
- if (obj_parameters_union1_error != null) {
370
- obj_parameters_union1 = obj_parameters_union1_error.message;
371
- }
372
- if (obj_parameters_union0 && obj_parameters_union1) {
373
- let message = 'Object doesn\'t match union (at "' + path_parameters + '")';
374
- message += '\n' + obj_parameters_union0.split('\n').map((line) => '\t' + line).join('\n');
375
- message += '\n' + obj_parameters_union1.split('\n').map((line) => '\t' + line).join('\n');
376
- return new TypeError(message);
579
+ if (typeof obj_parameters !== 'string') {
580
+ return new TypeError('Expected "string" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
377
581
  }
378
- const obj_prompt = obj.prompt;
379
- const path_prompt = path + '.prompt';
380
- let obj_prompt_union0 = null;
381
- const obj_prompt_union0_error = (() => {
382
- if (typeof obj_prompt !== 'string') {
383
- return new TypeError('Expected "string" but received "' + typeof obj_prompt + '" (at "' + path_prompt + '")');
384
- }
385
- })();
386
- if (obj_prompt_union0_error != null) {
387
- obj_prompt_union0 = obj_prompt_union0_error.message;
582
+ const obj_responseId = obj.responseId;
583
+ const path_responseId = path + '.responseId';
584
+ if (typeof obj_responseId !== 'string') {
585
+ return new TypeError('Expected "string" but received "' + typeof obj_responseId + '" (at "' + path_responseId + '")');
388
586
  }
389
- let obj_prompt_union1 = null;
390
- const obj_prompt_union1_error = (() => {
391
- if (obj_prompt !== null) {
392
- return new TypeError('Expected "null" but received "' + typeof obj_prompt + '" (at "' + path_prompt + '")');
587
+ if (obj.safetyScoreRepresentation !== undefined) {
588
+ const obj_safetyScoreRepresentation = obj.safetyScoreRepresentation;
589
+ const path_safetyScoreRepresentation = path + '.safetyScoreRepresentation';
590
+ const referencepath_safetyScoreRepresentationValidationError = validate$7(obj_safetyScoreRepresentation, path_safetyScoreRepresentation);
591
+ if (referencepath_safetyScoreRepresentationValidationError !== null) {
592
+ let message = 'Object doesn\'t match EinsteinLlmGenerationsSafetyScoreRepresentation (at "' + path_safetyScoreRepresentation + '")\n';
593
+ message += referencepath_safetyScoreRepresentationValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
594
+ return new TypeError(message);
393
595
  }
394
- })();
395
- if (obj_prompt_union1_error != null) {
396
- obj_prompt_union1 = obj_prompt_union1_error.message;
397
- }
398
- if (obj_prompt_union0 && obj_prompt_union1) {
399
- let message = 'Object doesn\'t match union (at "' + path_prompt + '")';
400
- message += '\n' + obj_prompt_union0.split('\n').map((line) => '\t' + line).join('\n');
401
- message += '\n' + obj_prompt_union1.split('\n').map((line) => '\t' + line).join('\n');
402
- return new TypeError(message);
403
596
  }
404
- const obj_requestId = obj.requestId;
405
- const path_requestId = path + '.requestId';
406
- if (typeof obj_requestId !== 'string') {
407
- return new TypeError('Expected "string" but received "' + typeof obj_requestId + '" (at "' + path_requestId + '")');
597
+ const obj_text = obj.text;
598
+ const path_text = path + '.text';
599
+ if (typeof obj_text !== 'string') {
600
+ return new TypeError('Expected "string" but received "' + typeof obj_text + '" (at "' + path_text + '")');
408
601
  }
409
602
  })();
410
603
  return v_error === undefined ? null : v_error;
411
604
  }
412
- const RepresentationType$2 = 'EinsteinLlmGenerationsRepresentation';
413
- function keyBuilder$2(luvio, config) {
414
- return keyPrefix + '::' + RepresentationType$2 + ':' + config.requestId;
415
- }
416
- function keyBuilderFromType$2(luvio, object) {
417
- const keyParams = {
418
- requestId: object.requestId
419
- };
420
- return keyBuilder$2(luvio, keyParams);
421
- }
422
- function normalize$2(input, existing, path, luvio, store, timestamp) {
423
- return input;
424
- }
425
- const select$5 = function EinsteinLlmGenerationsRepresentationSelect() {
426
- const { selections: EinsteinLlmGenerationItemRepresentation__selections, opaque: EinsteinLlmGenerationItemRepresentation__opaque, } = select$7();
427
- const { selections: WrappedMap__selections, opaque: WrappedMap__opaque, } = select$6();
605
+ const select$6 = function EinsteinLlmGenerationItemRepresentationSelect() {
606
+ const { selections: EinsteinLlmGenerationsContentQualityRepresentation__selections, opaque: EinsteinLlmGenerationsContentQualityRepresentation__opaque, } = select$8();
607
+ const { selections: EinsteinLlmGenerationsSafetyScoreRepresentation__selections, opaque: EinsteinLlmGenerationsSafetyScoreRepresentation__opaque, } = select$7();
428
608
  return {
429
609
  kind: 'Fragment',
430
- version: VERSION$2,
610
+ version: VERSION$4,
431
611
  private: [],
432
612
  selections: [
433
613
  {
434
- name: 'generations',
614
+ name: 'contentQualityRepresentation',
435
615
  kind: 'Object',
436
- plural: true,
437
- selections: EinsteinLlmGenerationItemRepresentation__selections
616
+ selections: EinsteinLlmGenerationsContentQualityRepresentation__selections,
617
+ required: false
438
618
  },
439
619
  {
440
620
  name: 'parameters',
441
- kind: 'Object',
442
- nullable: true,
443
- selections: WrappedMap__selections
621
+ kind: 'Scalar'
444
622
  },
445
623
  {
446
- name: 'prompt',
624
+ name: 'responseId',
447
625
  kind: 'Scalar'
448
626
  },
449
627
  {
450
- name: 'requestId',
628
+ name: 'safetyScoreRepresentation',
629
+ kind: 'Object',
630
+ selections: EinsteinLlmGenerationsSafetyScoreRepresentation__selections,
631
+ required: false
632
+ },
633
+ {
634
+ name: 'text',
451
635
  kind: 'Scalar'
452
636
  }
453
637
  ]
454
638
  };
455
639
  };
456
- function equals$2(existing, incoming) {
457
- const existing_requestId = existing.requestId;
458
- const incoming_requestId = incoming.requestId;
459
- if (!(existing_requestId === incoming_requestId)) {
460
- return false;
461
- }
462
- const existing_generations = existing.generations;
463
- const incoming_generations = incoming.generations;
464
- const equals_generations_items = equalsArray(existing_generations, incoming_generations, (existing_generations_item, incoming_generations_item) => {
465
- if (!(equals$4(existing_generations_item, incoming_generations_item))) {
466
- return false;
467
- }
468
- });
469
- if (equals_generations_items === false) {
470
- return false;
471
- }
640
+ function equals$4(existing, incoming) {
472
641
  const existing_parameters = existing.parameters;
473
642
  const incoming_parameters = incoming.parameters;
474
- if (!(existing_parameters === incoming_parameters
475
- || (existing_parameters != null &&
476
- incoming_parameters != null &&
477
- equals$3(existing_parameters, incoming_parameters)))) {
643
+ if (!(existing_parameters === incoming_parameters)) {
478
644
  return false;
479
645
  }
480
- const existing_prompt = existing.prompt;
481
- const incoming_prompt = incoming.prompt;
482
- if (!(existing_prompt === incoming_prompt)) {
646
+ const existing_responseId = existing.responseId;
647
+ const incoming_responseId = incoming.responseId;
648
+ if (!(existing_responseId === incoming_responseId)) {
483
649
  return false;
484
650
  }
485
- return true;
486
- }
487
- const ingest$2 = function EinsteinLlmGenerationsRepresentationIngest(input, path, luvio, store, timestamp) {
488
- if (process.env.NODE_ENV !== 'production') {
489
- const validateError = validate$5(input);
490
- if (validateError !== null) {
491
- throw validateError;
651
+ const existing_text = existing.text;
652
+ const incoming_text = incoming.text;
653
+ if (!(existing_text === incoming_text)) {
654
+ return false;
655
+ }
656
+ const existing_contentQualityRepresentation = existing.contentQualityRepresentation;
657
+ const incoming_contentQualityRepresentation = incoming.contentQualityRepresentation;
658
+ // if at least one of these optionals is defined
659
+ if (existing_contentQualityRepresentation !== undefined || incoming_contentQualityRepresentation !== undefined) {
660
+ // if one of these is not defined we know the other is defined and therefore
661
+ // not equal
662
+ if (existing_contentQualityRepresentation === undefined || incoming_contentQualityRepresentation === undefined) {
663
+ return false;
664
+ }
665
+ if (!(equals$6(existing_contentQualityRepresentation, incoming_contentQualityRepresentation))) {
666
+ return false;
492
667
  }
493
668
  }
494
- const key = keyBuilderFromType$2(luvio, input);
495
- const ttlToUse = TTL$2;
496
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "EinsteinLLM", VERSION$2, RepresentationType$2, equals$2);
497
- return createLink(key);
498
- };
499
- function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
500
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
501
- const rootKey = keyBuilderFromType$2(luvio, input);
502
- rootKeySet.set(rootKey, {
503
- namespace: keyPrefix,
504
- representationName: RepresentationType$2,
505
- mergeable: false
506
- });
507
- }
508
-
509
- function select$4(luvio, params) {
510
- return select$5();
511
- }
512
- function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
513
- getTypeCacheKeys$2(storeKeyMap, luvio, response);
514
- }
515
- function ingestSuccess$2(luvio, resourceParams, response) {
516
- const { body } = response;
517
- const key = keyBuilderFromType$2(luvio, body);
518
- luvio.storeIngest(key, ingest$2, body);
519
- const snapshot = luvio.storeLookup({
520
- recordId: key,
521
- node: select$4(),
522
- variables: {},
523
- });
524
- if (process.env.NODE_ENV !== 'production') {
525
- if (snapshot.state !== 'Fulfilled') {
526
- throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
669
+ const existing_safetyScoreRepresentation = existing.safetyScoreRepresentation;
670
+ const incoming_safetyScoreRepresentation = incoming.safetyScoreRepresentation;
671
+ // if at least one of these optionals is defined
672
+ if (existing_safetyScoreRepresentation !== undefined || incoming_safetyScoreRepresentation !== undefined) {
673
+ // if one of these is not defined we know the other is defined and therefore
674
+ // not equal
675
+ if (existing_safetyScoreRepresentation === undefined || incoming_safetyScoreRepresentation === undefined) {
676
+ return false;
677
+ }
678
+ if (!(equals$5(existing_safetyScoreRepresentation, incoming_safetyScoreRepresentation))) {
679
+ return false;
527
680
  }
528
681
  }
529
- deepFreeze(snapshot.data);
530
- return snapshot;
531
- }
532
- function createResourceRequest$2(config) {
533
- const headers = {};
534
- return {
535
- baseUri: '/services/data/v61.0',
536
- basePath: '/einstein/llm/prompt/generations',
537
- method: 'post',
538
- body: config.body,
539
- urlParams: {},
540
- queryParams: {},
541
- headers,
542
- priority: 'normal',
543
- };
682
+ return true;
544
683
  }
545
684
 
546
- const adapterName$2 = 'createGenerations';
547
- const createGenerations_ConfigPropertyMetadata = [
548
- generateParamConfigMetadata('generationsInput', true, 2 /* Body */, 4 /* Unsupported */),
549
- ];
550
- const createGenerations_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, createGenerations_ConfigPropertyMetadata);
551
- const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(createGenerations_ConfigPropertyMetadata);
552
- function typeCheckConfig$2(untrustedConfig) {
553
- const config = {};
554
- const untrustedConfig_generationsInput = untrustedConfig.generationsInput;
555
- const referenceEinsteinLlmGenerationsInputRepresentationValidationError = validate$8(untrustedConfig_generationsInput);
556
- if (referenceEinsteinLlmGenerationsInputRepresentationValidationError === null) {
557
- config.generationsInput = untrustedConfig_generationsInput;
558
- }
559
- return config;
560
- }
561
- function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
562
- if (!untrustedIsObject(untrustedConfig)) {
563
- return null;
564
- }
565
- if (process.env.NODE_ENV !== 'production') {
566
- validateConfig(untrustedConfig, configPropertyNames);
567
- }
568
- const config = typeCheckConfig$2(untrustedConfig);
569
- if (!areRequiredParametersPresent(config, configPropertyNames)) {
570
- return null;
571
- }
572
- return config;
573
- }
574
- function buildNetworkSnapshot$2(luvio, config, options) {
575
- const resourceParams = createResourceParams$2(config);
576
- const request = createResourceRequest$2(resourceParams);
577
- return luvio.dispatchResourceRequest(request, options)
578
- .then((response) => {
579
- return luvio.handleSuccessResponse(() => {
580
- const snapshot = ingestSuccess$2(luvio, resourceParams, response);
581
- return luvio.storeBroadcast().then(() => snapshot);
582
- }, () => {
583
- const cache = new StoreKeyMap();
584
- getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
585
- return cache;
586
- });
587
- }, (response) => {
588
- deepFreeze(response);
589
- throw response;
590
- });
591
- }
592
- const createGenerationsAdapterFactory = (luvio) => {
593
- return function createGenerations(untrustedConfig) {
594
- const config = validateAdapterConfig$2(untrustedConfig, createGenerations_ConfigPropertyNames);
595
- // Invalid or incomplete config
596
- if (config === null) {
597
- throw new Error('Invalid config for "createGenerations"');
685
+ const VERSION$3 = "4656c961c9d093a9e206c1db7d4de0b0";
686
+ function validate$5(obj, path = 'WrappedMap') {
687
+ const v_error = (() => {
688
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
689
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
690
+ }
691
+ const obj_wrappedMap = obj.wrappedMap;
692
+ const path_wrappedMap = path + '.wrappedMap';
693
+ if (typeof obj_wrappedMap !== 'object' || ArrayIsArray(obj_wrappedMap) || obj_wrappedMap === null) {
694
+ return new TypeError('Expected "object" but received "' + typeof obj_wrappedMap + '" (at "' + path_wrappedMap + '")');
695
+ }
696
+ const obj_wrappedMap_keys = ObjectKeys(obj_wrappedMap);
697
+ for (let i = 0; i < obj_wrappedMap_keys.length; i++) {
698
+ const key = obj_wrappedMap_keys[i];
699
+ const obj_wrappedMap_prop = obj_wrappedMap[key];
700
+ const path_wrappedMap_prop = path_wrappedMap + '["' + key + '"]';
701
+ if (typeof obj_wrappedMap_prop !== 'object' || ArrayIsArray(obj_wrappedMap_prop) || obj_wrappedMap_prop === null) {
702
+ return new TypeError('Expected "object" but received "' + typeof obj_wrappedMap_prop + '" (at "' + path_wrappedMap_prop + '")');
703
+ }
598
704
  }
599
- return buildNetworkSnapshot$2(luvio, config);
705
+ })();
706
+ return v_error === undefined ? null : v_error;
707
+ }
708
+ const select$5 = function WrappedMapSelect() {
709
+ return {
710
+ kind: 'Fragment',
711
+ version: VERSION$3,
712
+ private: [],
713
+ selections: []
600
714
  };
601
715
  };
716
+ function equals$3(existing, incoming) {
717
+ const existing_wrappedMap = existing.wrappedMap;
718
+ const incoming_wrappedMap = incoming.wrappedMap;
719
+ const equals_wrappedMap_props = equalsObject(existing_wrappedMap, incoming_wrappedMap, (existing_wrappedMap_prop, incoming_wrappedMap_prop) => {
720
+ });
721
+ if (equals_wrappedMap_props === false) {
722
+ return false;
723
+ }
724
+ return true;
725
+ }
602
726
 
603
- function validate$4(obj, path = 'EinsteinLlmFeedbackInputRepresentation') {
727
+ const TTL$1 = 100;
728
+ const VERSION$2 = "d8abd72a42e842b253da1c38954dafbc";
729
+ function validate$4(obj, path = 'EinsteinLlmGenerationsRepresentation') {
604
730
  const v_error = (() => {
605
731
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
606
732
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
607
733
  }
608
- if (obj.appFeedback !== undefined) {
609
- const obj_appFeedback = obj.appFeedback;
610
- const path_appFeedback = path + '.appFeedback';
611
- if (typeof obj_appFeedback !== 'object' || ArrayIsArray(obj_appFeedback) || obj_appFeedback === null) {
612
- return new TypeError('Expected "object" but received "' + typeof obj_appFeedback + '" (at "' + path_appFeedback + '")');
734
+ const obj_generations = obj.generations;
735
+ const path_generations = path + '.generations';
736
+ if (!ArrayIsArray(obj_generations)) {
737
+ return new TypeError('Expected "array" but received "' + typeof obj_generations + '" (at "' + path_generations + '")');
738
+ }
739
+ for (let i = 0; i < obj_generations.length; i++) {
740
+ const obj_generations_item = obj_generations[i];
741
+ const path_generations_item = path_generations + '[' + i + ']';
742
+ const referencepath_generations_itemValidationError = validate$6(obj_generations_item, path_generations_item);
743
+ if (referencepath_generations_itemValidationError !== null) {
744
+ let message = 'Object doesn\'t match EinsteinLlmGenerationItemRepresentation (at "' + path_generations_item + '")\n';
745
+ message += referencepath_generations_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
746
+ return new TypeError(message);
613
747
  }
614
- const obj_appFeedback_keys = ObjectKeys(obj_appFeedback);
615
- for (let i = 0; i < obj_appFeedback_keys.length; i++) {
616
- const key = obj_appFeedback_keys[i];
617
- const obj_appFeedback_prop = obj_appFeedback[key];
618
- const path_appFeedback_prop = path_appFeedback + '["' + key + '"]';
619
- if (typeof obj_appFeedback_prop !== 'object' || ArrayIsArray(obj_appFeedback_prop) || obj_appFeedback_prop === null) {
620
- return new TypeError('Expected "object" but received "' + typeof obj_appFeedback_prop + '" (at "' + path_appFeedback_prop + '")');
621
- }
748
+ }
749
+ const obj_parameters = obj.parameters;
750
+ const path_parameters = path + '.parameters';
751
+ let obj_parameters_union0 = null;
752
+ const obj_parameters_union0_error = (() => {
753
+ const referencepath_parametersValidationError = validate$5(obj_parameters, path_parameters);
754
+ if (referencepath_parametersValidationError !== null) {
755
+ let message = 'Object doesn\'t match WrappedMap (at "' + path_parameters + '")\n';
756
+ message += referencepath_parametersValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
757
+ return new TypeError(message);
622
758
  }
759
+ })();
760
+ if (obj_parameters_union0_error != null) {
761
+ obj_parameters_union0 = obj_parameters_union0_error.message;
623
762
  }
624
- if (obj.feedback !== undefined) {
625
- const obj_feedback = obj.feedback;
626
- const path_feedback = path + '.feedback';
627
- if (typeof obj_feedback !== 'string') {
628
- return new TypeError('Expected "string" but received "' + typeof obj_feedback + '" (at "' + path_feedback + '")');
763
+ let obj_parameters_union1 = null;
764
+ const obj_parameters_union1_error = (() => {
765
+ if (obj_parameters !== null) {
766
+ return new TypeError('Expected "null" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
629
767
  }
768
+ })();
769
+ if (obj_parameters_union1_error != null) {
770
+ obj_parameters_union1 = obj_parameters_union1_error.message;
630
771
  }
631
- const obj_feedbackText = obj.feedbackText;
632
- const path_feedbackText = path + '.feedbackText';
633
- if (typeof obj_feedbackText !== 'string') {
634
- return new TypeError('Expected "string" but received "' + typeof obj_feedbackText + '" (at "' + path_feedbackText + '")');
772
+ if (obj_parameters_union0 && obj_parameters_union1) {
773
+ let message = 'Object doesn\'t match union (at "' + path_parameters + '")';
774
+ message += '\n' + obj_parameters_union0.split('\n').map((line) => '\t' + line).join('\n');
775
+ message += '\n' + obj_parameters_union1.split('\n').map((line) => '\t' + line).join('\n');
776
+ return new TypeError(message);
635
777
  }
636
- const obj_generationId = obj.generationId;
637
- const path_generationId = path + '.generationId';
638
- if (typeof obj_generationId !== 'string') {
639
- return new TypeError('Expected "string" but received "' + typeof obj_generationId + '" (at "' + path_generationId + '")');
778
+ const obj_prompt = obj.prompt;
779
+ const path_prompt = path + '.prompt';
780
+ let obj_prompt_union0 = null;
781
+ const obj_prompt_union0_error = (() => {
782
+ if (typeof obj_prompt !== 'string') {
783
+ return new TypeError('Expected "string" but received "' + typeof obj_prompt + '" (at "' + path_prompt + '")');
784
+ }
785
+ })();
786
+ if (obj_prompt_union0_error != null) {
787
+ obj_prompt_union0 = obj_prompt_union0_error.message;
640
788
  }
641
- const obj_id = obj.id;
642
- const path_id = path + '.id';
643
- if (typeof obj_id !== 'string') {
644
- return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
789
+ let obj_prompt_union1 = null;
790
+ const obj_prompt_union1_error = (() => {
791
+ if (obj_prompt !== null) {
792
+ return new TypeError('Expected "null" but received "' + typeof obj_prompt + '" (at "' + path_prompt + '")');
793
+ }
794
+ })();
795
+ if (obj_prompt_union1_error != null) {
796
+ obj_prompt_union1 = obj_prompt_union1_error.message;
645
797
  }
646
- })();
647
- return v_error === undefined ? null : v_error;
648
- }
649
-
650
- const TTL$1 = 100;
651
- const VERSION$1 = "4033328f65865dd5d80c68a7573a4522";
652
- function validate$3(obj, path = 'EinsteinLlmFeedbackRepresentation') {
653
- const v_error = (() => {
654
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
655
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
798
+ if (obj_prompt_union0 && obj_prompt_union1) {
799
+ let message = 'Object doesn\'t match union (at "' + path_prompt + '")';
800
+ message += '\n' + obj_prompt_union0.split('\n').map((line) => '\t' + line).join('\n');
801
+ message += '\n' + obj_prompt_union1.split('\n').map((line) => '\t' + line).join('\n');
802
+ return new TypeError(message);
656
803
  }
657
- const obj_message = obj.message;
658
- const path_message = path + '.message';
659
- if (typeof obj_message !== 'string') {
660
- return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
804
+ const obj_requestId = obj.requestId;
805
+ const path_requestId = path + '.requestId';
806
+ if (typeof obj_requestId !== 'string') {
807
+ return new TypeError('Expected "string" but received "' + typeof obj_requestId + '" (at "' + path_requestId + '")');
661
808
  }
662
809
  })();
663
810
  return v_error === undefined ? null : v_error;
664
811
  }
665
- const RepresentationType$1 = 'EinsteinLlmFeedbackRepresentation';
812
+ const RepresentationType$1 = 'EinsteinLlmGenerationsRepresentation';
666
813
  function keyBuilder$1(luvio, config) {
667
- return keyPrefix + '::' + RepresentationType$1 + ':' + config.message;
814
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.requestId;
668
815
  }
669
816
  function keyBuilderFromType$1(luvio, object) {
670
817
  const keyParams = {
671
- message: object.message
818
+ requestId: object.requestId
672
819
  };
673
820
  return keyBuilder$1(luvio, keyParams);
674
821
  }
675
822
  function normalize$1(input, existing, path, luvio, store, timestamp) {
676
823
  return input;
677
824
  }
678
- const select$3 = function EinsteinLlmFeedbackRepresentationSelect() {
825
+ const select$4 = function EinsteinLlmGenerationsRepresentationSelect() {
826
+ const { selections: EinsteinLlmGenerationItemRepresentation__selections, opaque: EinsteinLlmGenerationItemRepresentation__opaque, } = select$6();
827
+ const { selections: WrappedMap__selections, opaque: WrappedMap__opaque, } = select$5();
679
828
  return {
680
829
  kind: 'Fragment',
681
- version: VERSION$1,
830
+ version: VERSION$2,
682
831
  private: [],
683
832
  selections: [
684
833
  {
685
- name: 'message',
834
+ name: 'generations',
835
+ kind: 'Object',
836
+ plural: true,
837
+ selections: EinsteinLlmGenerationItemRepresentation__selections
838
+ },
839
+ {
840
+ name: 'parameters',
841
+ kind: 'Object',
842
+ nullable: true,
843
+ selections: WrappedMap__selections
844
+ },
845
+ {
846
+ name: 'prompt',
847
+ kind: 'Scalar'
848
+ },
849
+ {
850
+ name: 'requestId',
686
851
  kind: 'Scalar'
687
852
  }
688
853
  ]
689
854
  };
690
855
  };
691
- function equals$1(existing, incoming) {
692
- const existing_message = existing.message;
693
- const incoming_message = incoming.message;
694
- if (!(existing_message === incoming_message)) {
856
+ function equals$2(existing, incoming) {
857
+ const existing_requestId = existing.requestId;
858
+ const incoming_requestId = incoming.requestId;
859
+ if (!(existing_requestId === incoming_requestId)) {
860
+ return false;
861
+ }
862
+ const existing_generations = existing.generations;
863
+ const incoming_generations = incoming.generations;
864
+ const equals_generations_items = equalsArray(existing_generations, incoming_generations, (existing_generations_item, incoming_generations_item) => {
865
+ if (!(equals$4(existing_generations_item, incoming_generations_item))) {
866
+ return false;
867
+ }
868
+ });
869
+ if (equals_generations_items === false) {
870
+ return false;
871
+ }
872
+ const existing_parameters = existing.parameters;
873
+ const incoming_parameters = incoming.parameters;
874
+ if (!(existing_parameters === incoming_parameters
875
+ || (existing_parameters != null &&
876
+ incoming_parameters != null &&
877
+ equals$3(existing_parameters, incoming_parameters)))) {
878
+ return false;
879
+ }
880
+ const existing_prompt = existing.prompt;
881
+ const incoming_prompt = incoming.prompt;
882
+ if (!(existing_prompt === incoming_prompt)) {
695
883
  return false;
696
884
  }
697
885
  return true;
698
886
  }
699
- const ingest$1 = function EinsteinLlmFeedbackRepresentationIngest(input, path, luvio, store, timestamp) {
887
+ const ingest$1 = function EinsteinLlmGenerationsRepresentationIngest(input, path, luvio, store, timestamp) {
700
888
  if (process.env.NODE_ENV !== 'production') {
701
- const validateError = validate$3(input);
889
+ const validateError = validate$4(input);
702
890
  if (validateError !== null) {
703
891
  throw validateError;
704
892
  }
705
893
  }
706
894
  const key = keyBuilderFromType$1(luvio, input);
707
895
  const ttlToUse = TTL$1;
708
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "EinsteinLLM", VERSION$1, RepresentationType$1, equals$1);
896
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "EinsteinLLM", VERSION$2, RepresentationType$1, equals$2);
709
897
  return createLink(key);
710
898
  };
711
899
  function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
@@ -718,8 +906,8 @@ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
718
906
  });
719
907
  }
720
908
 
721
- function select$2(luvio, params) {
722
- return select$3();
909
+ function select$3(luvio, params) {
910
+ return select$4();
723
911
  }
724
912
  function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
725
913
  getTypeCacheKeys$1(storeKeyMap, luvio, response);
@@ -730,7 +918,7 @@ function ingestSuccess$1(luvio, resourceParams, response) {
730
918
  luvio.storeIngest(key, ingest$1, body);
731
919
  const snapshot = luvio.storeLookup({
732
920
  recordId: key,
733
- node: select$2(),
921
+ node: select$3(),
734
922
  variables: {},
735
923
  });
736
924
  if (process.env.NODE_ENV !== 'production') {
@@ -745,7 +933,7 @@ function createResourceRequest$1(config) {
745
933
  const headers = {};
746
934
  return {
747
935
  baseUri: '/services/data/v61.0',
748
- basePath: '/einstein/llm/feedback',
936
+ basePath: '/einstein/llm/prompt/generations',
749
937
  method: 'post',
750
938
  body: config.body,
751
939
  urlParams: {},
@@ -755,18 +943,18 @@ function createResourceRequest$1(config) {
755
943
  };
756
944
  }
757
945
 
758
- const adapterName$1 = 'createFeedback';
759
- const createFeedback_ConfigPropertyMetadata = [
760
- generateParamConfigMetadata('feedbackInput', true, 2 /* Body */, 4 /* Unsupported */),
946
+ const adapterName$1 = 'createGenerations';
947
+ const createGenerations_ConfigPropertyMetadata = [
948
+ generateParamConfigMetadata('generationsInput', true, 2 /* Body */, 4 /* Unsupported */),
761
949
  ];
762
- const createFeedback_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, createFeedback_ConfigPropertyMetadata);
763
- const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(createFeedback_ConfigPropertyMetadata);
950
+ const createGenerations_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, createGenerations_ConfigPropertyMetadata);
951
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(createGenerations_ConfigPropertyMetadata);
764
952
  function typeCheckConfig$1(untrustedConfig) {
765
953
  const config = {};
766
- const untrustedConfig_feedbackInput = untrustedConfig.feedbackInput;
767
- const referenceEinsteinLlmFeedbackInputRepresentationValidationError = validate$4(untrustedConfig_feedbackInput);
768
- if (referenceEinsteinLlmFeedbackInputRepresentationValidationError === null) {
769
- config.feedbackInput = untrustedConfig_feedbackInput;
954
+ const untrustedConfig_generationsInput = untrustedConfig.generationsInput;
955
+ const referenceEinsteinLlmGenerationsInputRepresentationValidationError = validate$9(untrustedConfig_generationsInput);
956
+ if (referenceEinsteinLlmGenerationsInputRepresentationValidationError === null) {
957
+ config.generationsInput = untrustedConfig_generationsInput;
770
958
  }
771
959
  return config;
772
960
  }
@@ -801,18 +989,18 @@ function buildNetworkSnapshot$1(luvio, config, options) {
801
989
  throw response;
802
990
  });
803
991
  }
804
- const createFeedbackAdapterFactory = (luvio) => {
805
- return function createFeedback(untrustedConfig) {
806
- const config = validateAdapterConfig$1(untrustedConfig, createFeedback_ConfigPropertyNames);
992
+ const createGenerationsAdapterFactory = (luvio) => {
993
+ return function createGenerations(untrustedConfig) {
994
+ const config = validateAdapterConfig$1(untrustedConfig, createGenerations_ConfigPropertyNames);
807
995
  // Invalid or incomplete config
808
996
  if (config === null) {
809
- throw new Error('Invalid config for "createFeedback"');
997
+ throw new Error('Invalid config for "createGenerations"');
810
998
  }
811
999
  return buildNetworkSnapshot$1(luvio, config);
812
1000
  };
813
1001
  };
814
1002
 
815
- function validate$2(obj, path = 'WrappedValueMap') {
1003
+ function validate$3(obj, path = 'WrappedValueMap') {
816
1004
  const v_error = (() => {
817
1005
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
818
1006
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -835,7 +1023,7 @@ function validate$2(obj, path = 'WrappedValueMap') {
835
1023
  return v_error === undefined ? null : v_error;
836
1024
  }
837
1025
 
838
- function validate$1(obj, path = 'EinsteinPromptTemplateGenerationsInputRepresentation') {
1026
+ function validate$2(obj, path = 'EinsteinPromptTemplateGenerationsInputRepresentation') {
839
1027
  const v_error = (() => {
840
1028
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
841
1029
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -843,7 +1031,7 @@ function validate$1(obj, path = 'EinsteinPromptTemplateGenerationsInputRepresent
843
1031
  if (obj.additionalConfig !== undefined) {
844
1032
  const obj_additionalConfig = obj.additionalConfig;
845
1033
  const path_additionalConfig = path + '.additionalConfig';
846
- const referencepath_additionalConfigValidationError = validate$9(obj_additionalConfig, path_additionalConfig);
1034
+ const referencepath_additionalConfigValidationError = validate$a(obj_additionalConfig, path_additionalConfig);
847
1035
  if (referencepath_additionalConfigValidationError !== null) {
848
1036
  let message = 'Object doesn\'t match EinsteinLlmAdditionalConfigInputRepresentation (at "' + path_additionalConfig + '")\n';
849
1037
  message += referencepath_additionalConfigValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -852,7 +1040,7 @@ function validate$1(obj, path = 'EinsteinPromptTemplateGenerationsInputRepresent
852
1040
  }
853
1041
  const obj_inputParams = obj.inputParams;
854
1042
  const path_inputParams = path + '.inputParams';
855
- const referencepath_inputParamsValidationError = validate$2(obj_inputParams, path_inputParams);
1043
+ const referencepath_inputParamsValidationError = validate$3(obj_inputParams, path_inputParams);
856
1044
  if (referencepath_inputParamsValidationError !== null) {
857
1045
  let message = 'Object doesn\'t match WrappedValueMap (at "' + path_inputParams + '")\n';
858
1046
  message += referencepath_inputParamsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -874,13 +1062,119 @@ function validate$1(obj, path = 'EinsteinPromptTemplateGenerationsInputRepresent
874
1062
  return v_error === undefined ? null : v_error;
875
1063
  }
876
1064
 
1065
+ const VERSION$1 = "6458d624e5a1691821c764b6de0badb3";
1066
+ function validate$1(obj, path = 'EinsteinPromptTemplateGenerationsErrorRepresentation') {
1067
+ const v_error = (() => {
1068
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1069
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1070
+ }
1071
+ const obj_errorMessage = obj.errorMessage;
1072
+ const path_errorMessage = path + '.errorMessage';
1073
+ if (typeof obj_errorMessage !== 'string') {
1074
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
1075
+ }
1076
+ const obj_httpErrorCode = obj.httpErrorCode;
1077
+ const path_httpErrorCode = path + '.httpErrorCode';
1078
+ if (typeof obj_httpErrorCode !== 'string') {
1079
+ return new TypeError('Expected "string" but received "' + typeof obj_httpErrorCode + '" (at "' + path_httpErrorCode + '")');
1080
+ }
1081
+ if (obj.localizedErrorMessage !== undefined) {
1082
+ const obj_localizedErrorMessage = obj.localizedErrorMessage;
1083
+ const path_localizedErrorMessage = path + '.localizedErrorMessage';
1084
+ if (typeof obj_localizedErrorMessage !== 'string') {
1085
+ return new TypeError('Expected "string" but received "' + typeof obj_localizedErrorMessage + '" (at "' + path_localizedErrorMessage + '")');
1086
+ }
1087
+ }
1088
+ const obj_messageCode = obj.messageCode;
1089
+ const path_messageCode = path + '.messageCode';
1090
+ if (typeof obj_messageCode !== 'string') {
1091
+ return new TypeError('Expected "string" but received "' + typeof obj_messageCode + '" (at "' + path_messageCode + '")');
1092
+ }
1093
+ })();
1094
+ return v_error === undefined ? null : v_error;
1095
+ }
1096
+ const select$2 = function EinsteinPromptTemplateGenerationsErrorRepresentationSelect() {
1097
+ return {
1098
+ kind: 'Fragment',
1099
+ version: VERSION$1,
1100
+ private: [],
1101
+ selections: [
1102
+ {
1103
+ name: 'errorMessage',
1104
+ kind: 'Scalar'
1105
+ },
1106
+ {
1107
+ name: 'httpErrorCode',
1108
+ kind: 'Scalar'
1109
+ },
1110
+ {
1111
+ name: 'localizedErrorMessage',
1112
+ kind: 'Scalar',
1113
+ required: false
1114
+ },
1115
+ {
1116
+ name: 'messageCode',
1117
+ kind: 'Scalar'
1118
+ }
1119
+ ]
1120
+ };
1121
+ };
1122
+ function equals$1(existing, incoming) {
1123
+ const existing_errorMessage = existing.errorMessage;
1124
+ const incoming_errorMessage = incoming.errorMessage;
1125
+ if (!(existing_errorMessage === incoming_errorMessage)) {
1126
+ return false;
1127
+ }
1128
+ const existing_httpErrorCode = existing.httpErrorCode;
1129
+ const incoming_httpErrorCode = incoming.httpErrorCode;
1130
+ if (!(existing_httpErrorCode === incoming_httpErrorCode)) {
1131
+ return false;
1132
+ }
1133
+ const existing_localizedErrorMessage = existing.localizedErrorMessage;
1134
+ const incoming_localizedErrorMessage = incoming.localizedErrorMessage;
1135
+ // if at least one of these optionals is defined
1136
+ if (existing_localizedErrorMessage !== undefined || incoming_localizedErrorMessage !== undefined) {
1137
+ // if one of these is not defined we know the other is defined and therefore
1138
+ // not equal
1139
+ if (existing_localizedErrorMessage === undefined || incoming_localizedErrorMessage === undefined) {
1140
+ return false;
1141
+ }
1142
+ if (!(existing_localizedErrorMessage === incoming_localizedErrorMessage)) {
1143
+ return false;
1144
+ }
1145
+ }
1146
+ const existing_messageCode = existing.messageCode;
1147
+ const incoming_messageCode = incoming.messageCode;
1148
+ if (!(existing_messageCode === incoming_messageCode)) {
1149
+ return false;
1150
+ }
1151
+ return true;
1152
+ }
1153
+
877
1154
  const TTL = 100;
878
- const VERSION = "72c96c11855d430a55c0a79c239c0838";
1155
+ const VERSION = "a4c71dd12b7b696b7b04ebf6cf5101a3";
879
1156
  function validate(obj, path = 'EinsteinPromptTemplateGenerationsRepresentation') {
880
1157
  const v_error = (() => {
881
1158
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
882
1159
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
883
1160
  }
1161
+ if (obj.generationErrors !== undefined) {
1162
+ const obj_generationErrors = obj.generationErrors;
1163
+ const path_generationErrors = path + '.generationErrors';
1164
+ if (!ArrayIsArray(obj_generationErrors)) {
1165
+ return new TypeError('Expected "array" but received "' + typeof obj_generationErrors + '" (at "' + path_generationErrors + '")');
1166
+ }
1167
+ for (let i = 0; i < obj_generationErrors.length; i++) {
1168
+ const obj_generationErrors_item = obj_generationErrors[i];
1169
+ const path_generationErrors_item = path_generationErrors + '[' + i + ']';
1170
+ const referencepath_generationErrors_itemValidationError = validate$1(obj_generationErrors_item, path_generationErrors_item);
1171
+ if (referencepath_generationErrors_itemValidationError !== null) {
1172
+ let message = 'Object doesn\'t match EinsteinPromptTemplateGenerationsErrorRepresentation (at "' + path_generationErrors_item + '")\n';
1173
+ message += referencepath_generationErrors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1174
+ return new TypeError(message);
1175
+ }
1176
+ }
1177
+ }
884
1178
  const obj_generations = obj.generations;
885
1179
  const path_generations = path + '.generations';
886
1180
  if (!ArrayIsArray(obj_generations)) {
@@ -889,7 +1183,7 @@ function validate(obj, path = 'EinsteinPromptTemplateGenerationsRepresentation')
889
1183
  for (let i = 0; i < obj_generations.length; i++) {
890
1184
  const obj_generations_item = obj_generations[i];
891
1185
  const path_generations_item = path_generations + '[' + i + ']';
892
- const referencepath_generations_itemValidationError = validate$7(obj_generations_item, path_generations_item);
1186
+ const referencepath_generations_itemValidationError = validate$6(obj_generations_item, path_generations_item);
893
1187
  if (referencepath_generations_itemValidationError !== null) {
894
1188
  let message = 'Object doesn\'t match EinsteinLlmGenerationItemRepresentation (at "' + path_generations_item + '")\n';
895
1189
  message += referencepath_generations_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -900,7 +1194,7 @@ function validate(obj, path = 'EinsteinPromptTemplateGenerationsRepresentation')
900
1194
  const path_parameters = path + '.parameters';
901
1195
  let obj_parameters_union0 = null;
902
1196
  const obj_parameters_union0_error = (() => {
903
- const referencepath_parametersValidationError = validate$6(obj_parameters, path_parameters);
1197
+ const referencepath_parametersValidationError = validate$5(obj_parameters, path_parameters);
904
1198
  if (referencepath_parametersValidationError !== null) {
905
1199
  let message = 'Object doesn\'t match WrappedMap (at "' + path_parameters + '")\n';
906
1200
  message += referencepath_parametersValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -978,13 +1272,21 @@ function normalize(input, existing, path, luvio, store, timestamp) {
978
1272
  return input;
979
1273
  }
980
1274
  const select$1 = function EinsteinPromptTemplateGenerationsRepresentationSelect() {
981
- const { selections: EinsteinLlmGenerationItemRepresentation__selections, opaque: EinsteinLlmGenerationItemRepresentation__opaque, } = select$7();
982
- const { selections: WrappedMap__selections, opaque: WrappedMap__opaque, } = select$6();
1275
+ const { selections: EinsteinPromptTemplateGenerationsErrorRepresentation__selections, opaque: EinsteinPromptTemplateGenerationsErrorRepresentation__opaque, } = select$2();
1276
+ const { selections: EinsteinLlmGenerationItemRepresentation__selections, opaque: EinsteinLlmGenerationItemRepresentation__opaque, } = select$6();
1277
+ const { selections: WrappedMap__selections, opaque: WrappedMap__opaque, } = select$5();
983
1278
  return {
984
1279
  kind: 'Fragment',
985
1280
  version: VERSION,
986
1281
  private: [],
987
1282
  selections: [
1283
+ {
1284
+ name: 'generationErrors',
1285
+ kind: 'Object',
1286
+ plural: true,
1287
+ selections: EinsteinPromptTemplateGenerationsErrorRepresentation__selections,
1288
+ required: false
1289
+ },
988
1290
  {
989
1291
  name: 'generations',
990
1292
  kind: 'Object',
@@ -1023,6 +1325,24 @@ function equals(existing, incoming) {
1023
1325
  if (!(existing_requestId === incoming_requestId)) {
1024
1326
  return false;
1025
1327
  }
1328
+ const existing_generationErrors = existing.generationErrors;
1329
+ const incoming_generationErrors = incoming.generationErrors;
1330
+ // if at least one of these optionals is defined
1331
+ if (existing_generationErrors !== undefined || incoming_generationErrors !== undefined) {
1332
+ // if one of these is not defined we know the other is defined and therefore
1333
+ // not equal
1334
+ if (existing_generationErrors === undefined || incoming_generationErrors === undefined) {
1335
+ return false;
1336
+ }
1337
+ const equals_generationErrors_items = equalsArray(existing_generationErrors, incoming_generationErrors, (existing_generationErrors_item, incoming_generationErrors_item) => {
1338
+ if (!(equals$1(existing_generationErrors_item, incoming_generationErrors_item))) {
1339
+ return false;
1340
+ }
1341
+ });
1342
+ if (equals_generationErrors_items === false) {
1343
+ return false;
1344
+ }
1345
+ }
1026
1346
  const existing_generations = existing.generations;
1027
1347
  const incoming_generations = incoming.generations;
1028
1348
  const equals_generations_items = equalsArray(existing_generations, incoming_generations, (existing_generations_item, incoming_generations_item) => {
@@ -1119,7 +1439,7 @@ function typeCheckConfig(untrustedConfig) {
1119
1439
  const config = {};
1120
1440
  typeCheckConfig$3(untrustedConfig, config, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
1121
1441
  const untrustedConfig_promptTemplateGenerationsInput = untrustedConfig.promptTemplateGenerationsInput;
1122
- const referenceEinsteinPromptTemplateGenerationsInputRepresentationValidationError = validate$1(untrustedConfig_promptTemplateGenerationsInput);
1442
+ const referenceEinsteinPromptTemplateGenerationsInputRepresentationValidationError = validate$2(untrustedConfig_promptTemplateGenerationsInput);
1123
1443
  if (referenceEinsteinPromptTemplateGenerationsInputRepresentationValidationError === null) {
1124
1444
  config.promptTemplateGenerationsInput = untrustedConfig_promptTemplateGenerationsInput;
1125
1445
  }