@salesforce/lds-adapters-service-einsteinllm 1.229.0-dev1 → 1.229.0-dev10

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.
@@ -4,7 +4,7 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
@@ -104,7 +104,7 @@ function createLink(ref) {
104
104
  };
105
105
  }
106
106
 
107
- function validate$7(obj, path = 'EinsteinLlmAdditionalConfigInputRepresentation') {
107
+ function validate$9(obj, path = 'EinsteinLlmAdditionalConfigInputRepresentation') {
108
108
  const v_error = (() => {
109
109
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
110
110
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -187,7 +187,7 @@ function validate$7(obj, path = 'EinsteinLlmAdditionalConfigInputRepresentation'
187
187
  return v_error === undefined ? null : v_error;
188
188
  }
189
189
 
190
- function validate$6(obj, path = 'EinsteinLlmGenerationsInputRepresentation') {
190
+ function validate$8(obj, path = 'EinsteinLlmGenerationsInputRepresentation') {
191
191
  const v_error = (() => {
192
192
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
193
193
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -195,7 +195,7 @@ function validate$6(obj, path = 'EinsteinLlmGenerationsInputRepresentation') {
195
195
  if (obj.additionalConfig !== undefined) {
196
196
  const obj_additionalConfig = obj.additionalConfig;
197
197
  const path_additionalConfig = path + '.additionalConfig';
198
- const referencepath_additionalConfigValidationError = validate$7(obj_additionalConfig, path_additionalConfig);
198
+ const referencepath_additionalConfigValidationError = validate$9(obj_additionalConfig, path_additionalConfig);
199
199
  if (referencepath_additionalConfigValidationError !== null) {
200
200
  let message = 'Object doesn\'t match EinsteinLlmAdditionalConfigInputRepresentation (at "' + path_additionalConfig + '")\n';
201
201
  message += referencepath_additionalConfigValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -218,8 +218,8 @@ function validate$6(obj, path = 'EinsteinLlmGenerationsInputRepresentation') {
218
218
  return v_error === undefined ? null : v_error;
219
219
  }
220
220
 
221
- const VERSION$3 = "e87ca68f9dcf9550fb4dc9fd91df91ae";
222
- function validate$5(obj, path = 'EinsteinLlmGenerationItemRepresentation') {
221
+ const VERSION$4 = "e87ca68f9dcf9550fb4dc9fd91df91ae";
222
+ function validate$7(obj, path = 'EinsteinLlmGenerationItemRepresentation') {
223
223
  const v_error = (() => {
224
224
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
225
225
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -237,10 +237,10 @@ function validate$5(obj, path = 'EinsteinLlmGenerationItemRepresentation') {
237
237
  })();
238
238
  return v_error === undefined ? null : v_error;
239
239
  }
240
- const select$5 = function EinsteinLlmGenerationItemRepresentationSelect() {
240
+ const select$7 = function EinsteinLlmGenerationItemRepresentationSelect() {
241
241
  return {
242
242
  kind: 'Fragment',
243
- version: VERSION$3,
243
+ version: VERSION$4,
244
244
  private: [],
245
245
  selections: [
246
246
  {
@@ -254,7 +254,7 @@ const select$5 = function EinsteinLlmGenerationItemRepresentationSelect() {
254
254
  ]
255
255
  };
256
256
  };
257
- function equals$3(existing, incoming) {
257
+ function equals$4(existing, incoming) {
258
258
  const existing_parameters = existing.parameters;
259
259
  const incoming_parameters = incoming.parameters;
260
260
  if (!(existing_parameters === incoming_parameters)) {
@@ -268,8 +268,8 @@ function equals$3(existing, incoming) {
268
268
  return true;
269
269
  }
270
270
 
271
- const VERSION$2 = "4656c961c9d093a9e206c1db7d4de0b0";
272
- function validate$4(obj, path = 'WrappedMap') {
271
+ const VERSION$3 = "4656c961c9d093a9e206c1db7d4de0b0";
272
+ function validate$6(obj, path = 'WrappedMap') {
273
273
  const v_error = (() => {
274
274
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
275
275
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -291,15 +291,15 @@ function validate$4(obj, path = 'WrappedMap') {
291
291
  })();
292
292
  return v_error === undefined ? null : v_error;
293
293
  }
294
- const select$4 = function WrappedMapSelect() {
294
+ const select$6 = function WrappedMapSelect() {
295
295
  return {
296
296
  kind: 'Fragment',
297
- version: VERSION$2,
297
+ version: VERSION$3,
298
298
  private: [],
299
299
  selections: []
300
300
  };
301
301
  };
302
- function equals$2(existing, incoming) {
302
+ function equals$3(existing, incoming) {
303
303
  const existing_wrappedMap = existing.wrappedMap;
304
304
  const incoming_wrappedMap = incoming.wrappedMap;
305
305
  const equals_wrappedMap_props = equalsObject(existing_wrappedMap, incoming_wrappedMap, (existing_wrappedMap_prop, incoming_wrappedMap_prop) => {
@@ -310,9 +310,9 @@ function equals$2(existing, incoming) {
310
310
  return true;
311
311
  }
312
312
 
313
- const TTL$1 = 100;
314
- const VERSION$1 = "d8abd72a42e842b253da1c38954dafbc";
315
- function validate$3(obj, path = 'EinsteinLlmGenerationsRepresentation') {
313
+ const TTL$2 = 100;
314
+ const VERSION$2 = "d8abd72a42e842b253da1c38954dafbc";
315
+ function validate$5(obj, path = 'EinsteinLlmGenerationsRepresentation') {
316
316
  const v_error = (() => {
317
317
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
318
318
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -325,7 +325,7 @@ function validate$3(obj, path = 'EinsteinLlmGenerationsRepresentation') {
325
325
  for (let i = 0; i < obj_generations.length; i++) {
326
326
  const obj_generations_item = obj_generations[i];
327
327
  const path_generations_item = path_generations + '[' + i + ']';
328
- const referencepath_generations_itemValidationError = validate$5(obj_generations_item, path_generations_item);
328
+ const referencepath_generations_itemValidationError = validate$7(obj_generations_item, path_generations_item);
329
329
  if (referencepath_generations_itemValidationError !== null) {
330
330
  let message = 'Object doesn\'t match EinsteinLlmGenerationItemRepresentation (at "' + path_generations_item + '")\n';
331
331
  message += referencepath_generations_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -336,7 +336,7 @@ function validate$3(obj, path = 'EinsteinLlmGenerationsRepresentation') {
336
336
  const path_parameters = path + '.parameters';
337
337
  let obj_parameters_union0 = null;
338
338
  const obj_parameters_union0_error = (() => {
339
- const referencepath_parametersValidationError = validate$4(obj_parameters, path_parameters);
339
+ const referencepath_parametersValidationError = validate$6(obj_parameters, path_parameters);
340
340
  if (referencepath_parametersValidationError !== null) {
341
341
  let message = 'Object doesn\'t match WrappedMap (at "' + path_parameters + '")\n';
342
342
  message += referencepath_parametersValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -395,25 +395,25 @@ function validate$3(obj, path = 'EinsteinLlmGenerationsRepresentation') {
395
395
  })();
396
396
  return v_error === undefined ? null : v_error;
397
397
  }
398
- const RepresentationType$1 = 'EinsteinLlmGenerationsRepresentation';
399
- function keyBuilder$1(luvio, config) {
400
- return keyPrefix + '::' + RepresentationType$1 + ':' + config.requestId;
398
+ const RepresentationType$2 = 'EinsteinLlmGenerationsRepresentation';
399
+ function keyBuilder$2(luvio, config) {
400
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.requestId;
401
401
  }
402
- function keyBuilderFromType$1(luvio, object) {
402
+ function keyBuilderFromType$2(luvio, object) {
403
403
  const keyParams = {
404
404
  requestId: object.requestId
405
405
  };
406
- return keyBuilder$1(luvio, keyParams);
406
+ return keyBuilder$2(luvio, keyParams);
407
407
  }
408
- function normalize$1(input, existing, path, luvio, store, timestamp) {
408
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
409
409
  return input;
410
410
  }
411
- const select$3 = function EinsteinLlmGenerationsRepresentationSelect() {
412
- const { selections: EinsteinLlmGenerationItemRepresentation__selections, opaque: EinsteinLlmGenerationItemRepresentation__opaque, } = select$5();
413
- const { selections: WrappedMap__selections, opaque: WrappedMap__opaque, } = select$4();
411
+ const select$5 = function EinsteinLlmGenerationsRepresentationSelect() {
412
+ const { selections: EinsteinLlmGenerationItemRepresentation__selections, opaque: EinsteinLlmGenerationItemRepresentation__opaque, } = select$7();
413
+ const { selections: WrappedMap__selections, opaque: WrappedMap__opaque, } = select$6();
414
414
  return {
415
415
  kind: 'Fragment',
416
- version: VERSION$1,
416
+ version: VERSION$2,
417
417
  private: [],
418
418
  selections: [
419
419
  {
@@ -439,7 +439,7 @@ const select$3 = function EinsteinLlmGenerationsRepresentationSelect() {
439
439
  ]
440
440
  };
441
441
  };
442
- function equals$1(existing, incoming) {
442
+ function equals$2(existing, incoming) {
443
443
  const existing_requestId = existing.requestId;
444
444
  const incoming_requestId = incoming.requestId;
445
445
  if (!(existing_requestId === incoming_requestId)) {
@@ -448,7 +448,7 @@ function equals$1(existing, incoming) {
448
448
  const existing_generations = existing.generations;
449
449
  const incoming_generations = incoming.generations;
450
450
  const equals_generations_items = equalsArray(existing_generations, incoming_generations, (existing_generations_item, incoming_generations_item) => {
451
- if (!(equals$3(existing_generations_item, incoming_generations_item))) {
451
+ if (!(equals$4(existing_generations_item, incoming_generations_item))) {
452
452
  return false;
453
453
  }
454
454
  });
@@ -460,7 +460,7 @@ function equals$1(existing, incoming) {
460
460
  if (!(existing_parameters === incoming_parameters
461
461
  || (existing_parameters != null &&
462
462
  incoming_parameters != null &&
463
- equals$2(existing_parameters, incoming_parameters)))) {
463
+ equals$3(existing_parameters, incoming_parameters)))) {
464
464
  return false;
465
465
  }
466
466
  const existing_prompt = existing.prompt;
@@ -470,7 +470,231 @@ function equals$1(existing, incoming) {
470
470
  }
471
471
  return true;
472
472
  }
473
- const ingest$1 = function EinsteinLlmGenerationsRepresentationIngest(input, path, luvio, store, timestamp) {
473
+ const ingest$2 = function EinsteinLlmGenerationsRepresentationIngest(input, path, luvio, store, timestamp) {
474
+ if (process.env.NODE_ENV !== 'production') {
475
+ const validateError = validate$5(input);
476
+ if (validateError !== null) {
477
+ throw validateError;
478
+ }
479
+ }
480
+ const key = keyBuilderFromType$2(luvio, input);
481
+ const ttlToUse = TTL$2;
482
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "EinsteinLLM", VERSION$2, RepresentationType$2, equals$2);
483
+ return createLink(key);
484
+ };
485
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
486
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
487
+ const rootKey = keyBuilderFromType$2(luvio, input);
488
+ rootKeySet.set(rootKey, {
489
+ namespace: keyPrefix,
490
+ representationName: RepresentationType$2,
491
+ mergeable: false
492
+ });
493
+ }
494
+
495
+ function select$4(luvio, params) {
496
+ return select$5();
497
+ }
498
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
499
+ getTypeCacheKeys$2(storeKeyMap, luvio, response);
500
+ }
501
+ function ingestSuccess$2(luvio, resourceParams, response) {
502
+ const { body } = response;
503
+ const key = keyBuilderFromType$2(luvio, body);
504
+ luvio.storeIngest(key, ingest$2, body);
505
+ const snapshot = luvio.storeLookup({
506
+ recordId: key,
507
+ node: select$4(),
508
+ variables: {},
509
+ });
510
+ if (process.env.NODE_ENV !== 'production') {
511
+ if (snapshot.state !== 'Fulfilled') {
512
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
513
+ }
514
+ }
515
+ deepFreeze(snapshot.data);
516
+ return snapshot;
517
+ }
518
+ function createResourceRequest$2(config) {
519
+ const headers = {};
520
+ return {
521
+ baseUri: '/services/data/v59.0',
522
+ basePath: '/einstein/llm/prompt/generations',
523
+ method: 'post',
524
+ body: config.body,
525
+ urlParams: {},
526
+ queryParams: {},
527
+ headers,
528
+ priority: 'normal',
529
+ };
530
+ }
531
+
532
+ const adapterName$2 = 'createGenerations';
533
+ const createGenerations_ConfigPropertyMetadata = [
534
+ generateParamConfigMetadata('generationsInput', true, 2 /* Body */, 4 /* Unsupported */),
535
+ ];
536
+ const createGenerations_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, createGenerations_ConfigPropertyMetadata);
537
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(createGenerations_ConfigPropertyMetadata);
538
+ function typeCheckConfig$2(untrustedConfig) {
539
+ const config = {};
540
+ const untrustedConfig_generationsInput = untrustedConfig.generationsInput;
541
+ const referenceEinsteinLlmGenerationsInputRepresentationValidationError = validate$8(untrustedConfig_generationsInput);
542
+ if (referenceEinsteinLlmGenerationsInputRepresentationValidationError === null) {
543
+ config.generationsInput = untrustedConfig_generationsInput;
544
+ }
545
+ return config;
546
+ }
547
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
548
+ if (!untrustedIsObject(untrustedConfig)) {
549
+ return null;
550
+ }
551
+ if (process.env.NODE_ENV !== 'production') {
552
+ validateConfig(untrustedConfig, configPropertyNames);
553
+ }
554
+ const config = typeCheckConfig$2(untrustedConfig);
555
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
556
+ return null;
557
+ }
558
+ return config;
559
+ }
560
+ function buildNetworkSnapshot$2(luvio, config, options) {
561
+ const resourceParams = createResourceParams$2(config);
562
+ const request = createResourceRequest$2(resourceParams);
563
+ return luvio.dispatchResourceRequest(request, options)
564
+ .then((response) => {
565
+ return luvio.handleSuccessResponse(() => {
566
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
567
+ return luvio.storeBroadcast().then(() => snapshot);
568
+ }, () => {
569
+ const cache = new StoreKeyMap();
570
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
571
+ return cache;
572
+ });
573
+ }, (response) => {
574
+ deepFreeze(response);
575
+ throw response;
576
+ });
577
+ }
578
+ const createGenerationsAdapterFactory = (luvio) => {
579
+ return function createGenerations(untrustedConfig) {
580
+ const config = validateAdapterConfig$2(untrustedConfig, createGenerations_ConfigPropertyNames);
581
+ // Invalid or incomplete config
582
+ if (config === null) {
583
+ throw new Error('Invalid config for "createGenerations"');
584
+ }
585
+ return buildNetworkSnapshot$2(luvio, config);
586
+ };
587
+ };
588
+
589
+ function validate$4(obj, path = 'EinsteinLlmFeedbackInputRepresentation') {
590
+ const v_error = (() => {
591
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
592
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
593
+ }
594
+ if (obj.appFeedback !== undefined) {
595
+ const obj_appFeedback = obj.appFeedback;
596
+ const path_appFeedback = path + '.appFeedback';
597
+ if (typeof obj_appFeedback !== 'object' || ArrayIsArray(obj_appFeedback) || obj_appFeedback === null) {
598
+ return new TypeError('Expected "object" but received "' + typeof obj_appFeedback + '" (at "' + path_appFeedback + '")');
599
+ }
600
+ const obj_appFeedback_keys = ObjectKeys(obj_appFeedback);
601
+ for (let i = 0; i < obj_appFeedback_keys.length; i++) {
602
+ const key = obj_appFeedback_keys[i];
603
+ const obj_appFeedback_prop = obj_appFeedback[key];
604
+ const path_appFeedback_prop = path_appFeedback + '["' + key + '"]';
605
+ if (typeof obj_appFeedback_prop !== 'object' || ArrayIsArray(obj_appFeedback_prop) || obj_appFeedback_prop === null) {
606
+ return new TypeError('Expected "object" but received "' + typeof obj_appFeedback_prop + '" (at "' + path_appFeedback_prop + '")');
607
+ }
608
+ }
609
+ }
610
+ if (obj.applicationName !== undefined) {
611
+ const obj_applicationName = obj.applicationName;
612
+ const path_applicationName = path + '.applicationName';
613
+ if (typeof obj_applicationName !== 'string') {
614
+ return new TypeError('Expected "string" but received "' + typeof obj_applicationName + '" (at "' + path_applicationName + '")');
615
+ }
616
+ }
617
+ if (obj.feedback !== undefined) {
618
+ const obj_feedback = obj.feedback;
619
+ const path_feedback = path + '.feedback';
620
+ if (typeof obj_feedback !== 'string') {
621
+ return new TypeError('Expected "string" but received "' + typeof obj_feedback + '" (at "' + path_feedback + '")');
622
+ }
623
+ }
624
+ const obj_feedbackText = obj.feedbackText;
625
+ const path_feedbackText = path + '.feedbackText';
626
+ if (typeof obj_feedbackText !== 'string') {
627
+ return new TypeError('Expected "string" but received "' + typeof obj_feedbackText + '" (at "' + path_feedbackText + '")');
628
+ }
629
+ const obj_generationId = obj.generationId;
630
+ const path_generationId = path + '.generationId';
631
+ if (typeof obj_generationId !== 'string') {
632
+ return new TypeError('Expected "string" but received "' + typeof obj_generationId + '" (at "' + path_generationId + '")');
633
+ }
634
+ const obj_id = obj.id;
635
+ const path_id = path + '.id';
636
+ if (typeof obj_id !== 'string') {
637
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
638
+ }
639
+ const obj_source = obj.source;
640
+ const path_source = path + '.source';
641
+ if (typeof obj_source !== 'string') {
642
+ return new TypeError('Expected "string" but received "' + typeof obj_source + '" (at "' + path_source + '")');
643
+ }
644
+ })();
645
+ return v_error === undefined ? null : v_error;
646
+ }
647
+
648
+ const TTL$1 = 100;
649
+ const VERSION$1 = "4033328f65865dd5d80c68a7573a4522";
650
+ function validate$3(obj, path = 'EinsteinLlmFeedbackRepresentation') {
651
+ const v_error = (() => {
652
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
653
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
654
+ }
655
+ const obj_message = obj.message;
656
+ const path_message = path + '.message';
657
+ if (typeof obj_message !== 'string') {
658
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
659
+ }
660
+ })();
661
+ return v_error === undefined ? null : v_error;
662
+ }
663
+ const RepresentationType$1 = 'EinsteinLlmFeedbackRepresentation';
664
+ function keyBuilder$1(luvio, config) {
665
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.message;
666
+ }
667
+ function keyBuilderFromType$1(luvio, object) {
668
+ const keyParams = {
669
+ message: object.message
670
+ };
671
+ return keyBuilder$1(luvio, keyParams);
672
+ }
673
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
674
+ return input;
675
+ }
676
+ const select$3 = function EinsteinLlmFeedbackRepresentationSelect() {
677
+ return {
678
+ kind: 'Fragment',
679
+ version: VERSION$1,
680
+ private: [],
681
+ selections: [
682
+ {
683
+ name: 'message',
684
+ kind: 'Scalar'
685
+ }
686
+ ]
687
+ };
688
+ };
689
+ function equals$1(existing, incoming) {
690
+ const existing_message = existing.message;
691
+ const incoming_message = incoming.message;
692
+ if (!(existing_message === incoming_message)) {
693
+ return false;
694
+ }
695
+ return true;
696
+ }
697
+ const ingest$1 = function EinsteinLlmFeedbackRepresentationIngest(input, path, luvio, store, timestamp) {
474
698
  if (process.env.NODE_ENV !== 'production') {
475
699
  const validateError = validate$3(input);
476
700
  if (validateError !== null) {
@@ -519,7 +743,7 @@ function createResourceRequest$1(config) {
519
743
  const headers = {};
520
744
  return {
521
745
  baseUri: '/services/data/v59.0',
522
- basePath: '/einstein/llm/prompt/generations',
746
+ basePath: '/einstein/llm/feedback',
523
747
  method: 'post',
524
748
  body: config.body,
525
749
  urlParams: {},
@@ -529,18 +753,18 @@ function createResourceRequest$1(config) {
529
753
  };
530
754
  }
531
755
 
532
- const adapterName$1 = 'createGenerations';
533
- const createGenerations_ConfigPropertyMetadata = [
534
- generateParamConfigMetadata('generationsInput', true, 2 /* Body */, 4 /* Unsupported */),
756
+ const adapterName$1 = 'createFeedback';
757
+ const createFeedback_ConfigPropertyMetadata = [
758
+ generateParamConfigMetadata('feedbackInput', true, 2 /* Body */, 4 /* Unsupported */),
535
759
  ];
536
- const createGenerations_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, createGenerations_ConfigPropertyMetadata);
537
- const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(createGenerations_ConfigPropertyMetadata);
760
+ const createFeedback_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, createFeedback_ConfigPropertyMetadata);
761
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(createFeedback_ConfigPropertyMetadata);
538
762
  function typeCheckConfig$1(untrustedConfig) {
539
763
  const config = {};
540
- const untrustedConfig_generationsInput = untrustedConfig.generationsInput;
541
- const referenceEinsteinLlmGenerationsInputRepresentationValidationError = validate$6(untrustedConfig_generationsInput);
542
- if (referenceEinsteinLlmGenerationsInputRepresentationValidationError === null) {
543
- config.generationsInput = untrustedConfig_generationsInput;
764
+ const untrustedConfig_feedbackInput = untrustedConfig.feedbackInput;
765
+ const referenceEinsteinLlmFeedbackInputRepresentationValidationError = validate$4(untrustedConfig_feedbackInput);
766
+ if (referenceEinsteinLlmFeedbackInputRepresentationValidationError === null) {
767
+ config.feedbackInput = untrustedConfig_feedbackInput;
544
768
  }
545
769
  return config;
546
770
  }
@@ -575,12 +799,12 @@ function buildNetworkSnapshot$1(luvio, config, options) {
575
799
  throw response;
576
800
  });
577
801
  }
578
- const createGenerationsAdapterFactory = (luvio) => {
579
- return function createGenerations(untrustedConfig) {
580
- const config = validateAdapterConfig$1(untrustedConfig, createGenerations_ConfigPropertyNames);
802
+ const createFeedbackAdapterFactory = (luvio) => {
803
+ return function createFeedback(untrustedConfig) {
804
+ const config = validateAdapterConfig$1(untrustedConfig, createFeedback_ConfigPropertyNames);
581
805
  // Invalid or incomplete config
582
806
  if (config === null) {
583
- throw new Error('Invalid config for "createGenerations"');
807
+ throw new Error('Invalid config for "createFeedback"');
584
808
  }
585
809
  return buildNetworkSnapshot$1(luvio, config);
586
810
  };
@@ -617,7 +841,7 @@ function validate$1(obj, path = 'EinsteinPromptTemplateGenerationsInputRepresent
617
841
  if (obj.additionalConfig !== undefined) {
618
842
  const obj_additionalConfig = obj.additionalConfig;
619
843
  const path_additionalConfig = path + '.additionalConfig';
620
- const referencepath_additionalConfigValidationError = validate$7(obj_additionalConfig, path_additionalConfig);
844
+ const referencepath_additionalConfigValidationError = validate$9(obj_additionalConfig, path_additionalConfig);
621
845
  if (referencepath_additionalConfigValidationError !== null) {
622
846
  let message = 'Object doesn\'t match EinsteinLlmAdditionalConfigInputRepresentation (at "' + path_additionalConfig + '")\n';
623
847
  message += referencepath_additionalConfigValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -663,7 +887,7 @@ function validate(obj, path = 'EinsteinPromptTemplateGenerationsRepresentation')
663
887
  for (let i = 0; i < obj_generations.length; i++) {
664
888
  const obj_generations_item = obj_generations[i];
665
889
  const path_generations_item = path_generations + '[' + i + ']';
666
- const referencepath_generations_itemValidationError = validate$5(obj_generations_item, path_generations_item);
890
+ const referencepath_generations_itemValidationError = validate$7(obj_generations_item, path_generations_item);
667
891
  if (referencepath_generations_itemValidationError !== null) {
668
892
  let message = 'Object doesn\'t match EinsteinLlmGenerationItemRepresentation (at "' + path_generations_item + '")\n';
669
893
  message += referencepath_generations_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -674,7 +898,7 @@ function validate(obj, path = 'EinsteinPromptTemplateGenerationsRepresentation')
674
898
  const path_parameters = path + '.parameters';
675
899
  let obj_parameters_union0 = null;
676
900
  const obj_parameters_union0_error = (() => {
677
- const referencepath_parametersValidationError = validate$4(obj_parameters, path_parameters);
901
+ const referencepath_parametersValidationError = validate$6(obj_parameters, path_parameters);
678
902
  if (referencepath_parametersValidationError !== null) {
679
903
  let message = 'Object doesn\'t match WrappedMap (at "' + path_parameters + '")\n';
680
904
  message += referencepath_parametersValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -752,8 +976,8 @@ function normalize(input, existing, path, luvio, store, timestamp) {
752
976
  return input;
753
977
  }
754
978
  const select$1 = function EinsteinPromptTemplateGenerationsRepresentationSelect() {
755
- const { selections: EinsteinLlmGenerationItemRepresentation__selections, opaque: EinsteinLlmGenerationItemRepresentation__opaque, } = select$5();
756
- const { selections: WrappedMap__selections, opaque: WrappedMap__opaque, } = select$4();
979
+ const { selections: EinsteinLlmGenerationItemRepresentation__selections, opaque: EinsteinLlmGenerationItemRepresentation__opaque, } = select$7();
980
+ const { selections: WrappedMap__selections, opaque: WrappedMap__opaque, } = select$6();
757
981
  return {
758
982
  kind: 'Fragment',
759
983
  version: VERSION,
@@ -800,7 +1024,7 @@ function equals(existing, incoming) {
800
1024
  const existing_generations = existing.generations;
801
1025
  const incoming_generations = incoming.generations;
802
1026
  const equals_generations_items = equalsArray(existing_generations, incoming_generations, (existing_generations_item, incoming_generations_item) => {
803
- if (!(equals$3(existing_generations_item, incoming_generations_item))) {
1027
+ if (!(equals$4(existing_generations_item, incoming_generations_item))) {
804
1028
  return false;
805
1029
  }
806
1030
  });
@@ -812,7 +1036,7 @@ function equals(existing, incoming) {
812
1036
  if (!(existing_parameters === incoming_parameters
813
1037
  || (existing_parameters != null &&
814
1038
  incoming_parameters != null &&
815
- equals$2(existing_parameters, incoming_parameters)))) {
1039
+ equals$3(existing_parameters, incoming_parameters)))) {
816
1040
  return false;
817
1041
  }
818
1042
  const existing_prompt = existing.prompt;
@@ -887,10 +1111,10 @@ const createGenerationsForPromptTemplate_ConfigPropertyMetadata = [
887
1111
  generateParamConfigMetadata('promptTemplateGenerationsInput', true, 2 /* Body */, 4 /* Unsupported */),
888
1112
  ];
889
1113
  const createGenerationsForPromptTemplate_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
890
- const createResourceParams = /*#__PURE__*/ createResourceParams$2(createGenerationsForPromptTemplate_ConfigPropertyMetadata);
1114
+ const createResourceParams = /*#__PURE__*/ createResourceParams$3(createGenerationsForPromptTemplate_ConfigPropertyMetadata);
891
1115
  function typeCheckConfig(untrustedConfig) {
892
1116
  const config = {};
893
- typeCheckConfig$2(untrustedConfig, config, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
1117
+ typeCheckConfig$3(untrustedConfig, config, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
894
1118
  const untrustedConfig_promptTemplateGenerationsInput = untrustedConfig.promptTemplateGenerationsInput;
895
1119
  const referenceEinsteinPromptTemplateGenerationsInputRepresentationValidationError = validate$1(untrustedConfig_promptTemplateGenerationsInput);
896
1120
  if (referenceEinsteinPromptTemplateGenerationsInputRepresentationValidationError === null) {
@@ -940,4 +1164,4 @@ const createGenerationsForPromptTemplateAdapterFactory = (luvio) => {
940
1164
  };
941
1165
  };
942
1166
 
943
- export { createGenerationsAdapterFactory, createGenerationsForPromptTemplateAdapterFactory };
1167
+ export { createFeedbackAdapterFactory, createGenerationsAdapterFactory, createGenerationsForPromptTemplateAdapterFactory };
@@ -0,0 +1,16 @@
1
+ import { AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata, Luvio as $64$luvio_engine_Luvio, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
2
+ import { Untrusted as adapter$45$utils_Untrusted, AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig } from './adapter-utils';
3
+ import { EinsteinLlmFeedbackInputRepresentation as types_EinsteinLlmFeedbackInputRepresentation_EinsteinLlmFeedbackInputRepresentation } from '../types/EinsteinLlmFeedbackInputRepresentation';
4
+ import { ResourceRequestConfig as resources_postEinsteinLlmFeedback_ResourceRequestConfig } from '../resources/postEinsteinLlmFeedback';
5
+ import { EinsteinLlmFeedbackRepresentation as types_EinsteinLlmFeedbackRepresentation_EinsteinLlmFeedbackRepresentation } from '../types/EinsteinLlmFeedbackRepresentation';
6
+ export declare const adapterName = "createFeedback";
7
+ export declare const createFeedback_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
8
+ export declare const createFeedback_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
9
+ export interface CreateFeedbackConfig {
10
+ feedbackInput: types_EinsteinLlmFeedbackInputRepresentation_EinsteinLlmFeedbackInputRepresentation;
11
+ }
12
+ export declare const createResourceParams: (config: CreateFeedbackConfig) => resources_postEinsteinLlmFeedback_ResourceRequestConfig;
13
+ export declare function typeCheckConfig(untrustedConfig: adapter$45$utils_Untrusted<CreateFeedbackConfig>): adapter$45$utils_Untrusted<CreateFeedbackConfig>;
14
+ export declare function validateAdapterConfig(untrustedConfig: unknown, configPropertyNames: adapter$45$utils_AdapterValidationConfig): CreateFeedbackConfig | null;
15
+ export declare function buildNetworkSnapshot(luvio: $64$luvio_engine_Luvio, config: CreateFeedbackConfig, options?: $64$luvio_engine_DispatchResourceRequestContext): Promise<import("@luvio/engine").FulfilledSnapshot<types_EinsteinLlmFeedbackRepresentation_EinsteinLlmFeedbackRepresentation, {}> | import("@luvio/engine").StaleSnapshot<types_EinsteinLlmFeedbackRepresentation_EinsteinLlmFeedbackRepresentation, {}> | import("@luvio/engine").PendingSnapshot<types_EinsteinLlmFeedbackRepresentation_EinsteinLlmFeedbackRepresentation, any>>;
16
+ export declare const createFeedbackAdapterFactory: $64$luvio_engine_AdapterFactory<CreateFeedbackConfig, types_EinsteinLlmFeedbackRepresentation_EinsteinLlmFeedbackRepresentation>;
@@ -1,2 +1,3 @@
1
1
  export { createGenerationsAdapterFactory } from '../adapters/createGenerations';
2
+ export { createFeedbackAdapterFactory } from '../adapters/createFeedback';
2
3
  export { createGenerationsForPromptTemplateAdapterFactory } from '../adapters/createGenerationsForPromptTemplate';
@@ -1,3 +1,4 @@
1
+ declare let createFeedback: any;
1
2
  declare let createGenerations: any;
2
3
  declare let createGenerationsForPromptTemplate: any;
3
- export { createGenerations, createGenerationsForPromptTemplate, };
4
+ export { createFeedback, createGenerations, createGenerationsForPromptTemplate, };
@@ -0,0 +1,13 @@
1
+ import { EinsteinLlmFeedbackInputRepresentation as types_EinsteinLlmFeedbackInputRepresentation_EinsteinLlmFeedbackInputRepresentation } from '../types/EinsteinLlmFeedbackInputRepresentation';
2
+ import { Luvio as $64$luvio_engine_Luvio, Fragment as $64$luvio_engine_Fragment, FetchResponse as $64$luvio_engine_FetchResponse, FulfilledSnapshot as $64$luvio_engine_FulfilledSnapshot, StaleSnapshot as $64$luvio_engine_StaleSnapshot, PendingSnapshot as $64$luvio_engine_PendingSnapshot, ResourceRequest as $64$luvio_engine_ResourceRequest } from '@luvio/engine';
3
+ import { EinsteinLlmFeedbackRepresentation as types_EinsteinLlmFeedbackRepresentation_EinsteinLlmFeedbackRepresentation } from '../types/EinsteinLlmFeedbackRepresentation';
4
+ export interface ResourceRequestConfig {
5
+ body: {
6
+ feedbackInput: types_EinsteinLlmFeedbackInputRepresentation_EinsteinLlmFeedbackInputRepresentation;
7
+ };
8
+ }
9
+ export declare function select(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_Fragment;
10
+ export declare function getResponseCacheKeys(storeKeyMap: any, luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: types_EinsteinLlmFeedbackRepresentation_EinsteinLlmFeedbackRepresentation): void;
11
+ export declare function ingestSuccess(luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_EinsteinLlmFeedbackRepresentation_EinsteinLlmFeedbackRepresentation>): $64$luvio_engine_FulfilledSnapshot<types_EinsteinLlmFeedbackRepresentation_EinsteinLlmFeedbackRepresentation, {}> | $64$luvio_engine_StaleSnapshot<types_EinsteinLlmFeedbackRepresentation_EinsteinLlmFeedbackRepresentation, {}> | $64$luvio_engine_PendingSnapshot<types_EinsteinLlmFeedbackRepresentation_EinsteinLlmFeedbackRepresentation, any>;
12
+ export declare function createResourceRequest(config: ResourceRequestConfig): $64$luvio_engine_ResourceRequest;
13
+ export default createResourceRequest;
@@ -0,0 +1,50 @@
1
+ import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, FragmentSelection as $64$luvio_engine_FragmentSelection, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
2
+ export declare const VERSION = "3e2a8364ea8f4614aa5a49f6105c3e28";
3
+ export declare function validate(obj: any, path?: string): TypeError | null;
4
+ export declare const RepresentationType: string;
5
+ export declare function normalize(input: EinsteinLlmFeedbackInputRepresentation, existing: EinsteinLlmFeedbackInputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): EinsteinLlmFeedbackInputRepresentationNormalized;
6
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
7
+ export declare function equals(existing: EinsteinLlmFeedbackInputRepresentationNormalized, incoming: EinsteinLlmFeedbackInputRepresentationNormalized): boolean;
8
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
9
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: EinsteinLlmFeedbackInputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
10
+ /**
11
+ * Input representation for Feedback with Einstein LLM
12
+ *
13
+ * Keys:
14
+ * (none)
15
+ */
16
+ export interface EinsteinLlmFeedbackInputRepresentationNormalized {
17
+ /** app feedback map */
18
+ appFeedback?: {
19
+ [key: string]: {};
20
+ };
21
+ /** Application name */
22
+ applicationName?: string;
23
+ /** feedback */
24
+ feedback?: string;
25
+ /** Feedback Text */
26
+ feedbackText: string;
27
+ /** Generation Id - Generations.response.id */
28
+ generationId: string;
29
+ /** Feedback id */
30
+ id: string;
31
+ /** Feedback source */
32
+ source: string;
33
+ }
34
+ /**
35
+ * Input representation for Feedback with Einstein LLM
36
+ *
37
+ * Keys:
38
+ * (none)
39
+ */
40
+ export interface EinsteinLlmFeedbackInputRepresentation {
41
+ appFeedback?: {
42
+ [key: string]: {};
43
+ };
44
+ applicationName?: string;
45
+ feedback?: string;
46
+ feedbackText: string;
47
+ generationId: string;
48
+ id: string;
49
+ source: string;
50
+ }
@@ -0,0 +1,38 @@
1
+ import { KeyMetadata as $64$luvio_engine_KeyMetadata, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, Luvio as $64$luvio_engine_Luvio, IngestPath as $64$luvio_engine_IngestPath, Store as $64$luvio_engine_Store, FragmentSelection as $64$luvio_engine_FragmentSelection, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap } from '@luvio/engine';
2
+ export declare const TTL = 100;
3
+ export declare const VERSION = "4033328f65865dd5d80c68a7573a4522";
4
+ export declare function validate(obj: any, path?: string): TypeError | null;
5
+ export declare const RepresentationType: string;
6
+ export interface KeyParams extends $64$luvio_engine_KeyMetadata {
7
+ message: string;
8
+ }
9
+ export type EinsteinLlmFeedbackRepresentationNormalizedKeyMetadata = KeyParams & $64$luvio_engine_NormalizedKeyMetadata;
10
+ export type PartialEinsteinLlmFeedbackRepresentationNormalizedKeyMetadata = Partial<KeyParams> & $64$luvio_engine_NormalizedKeyMetadata;
11
+ export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, config: KeyParams): string;
12
+ export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, config: KeyParams): EinsteinLlmFeedbackRepresentationNormalizedKeyMetadata;
13
+ export declare function keyBuilderFromType(luvio: $64$luvio_engine_Luvio, object: EinsteinLlmFeedbackRepresentation): string;
14
+ export declare function keyBuilderFromType_StructuredKey(luvio: $64$luvio_engine_Luvio, object: EinsteinLlmFeedbackRepresentation): $64$luvio_engine_NormalizedKeyMetadata;
15
+ export declare function normalize(input: EinsteinLlmFeedbackRepresentation, existing: EinsteinLlmFeedbackRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): EinsteinLlmFeedbackRepresentationNormalized;
16
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
17
+ export declare function equals(existing: EinsteinLlmFeedbackRepresentationNormalized, incoming: EinsteinLlmFeedbackRepresentationNormalized): boolean;
18
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
19
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: EinsteinLlmFeedbackRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
20
+ /**
21
+ * Output of a einstein llm feedback call
22
+ *
23
+ * Keys:
24
+ * message (string): message
25
+ */
26
+ export interface EinsteinLlmFeedbackRepresentationNormalized {
27
+ /** Response text of the feedback API */
28
+ message: string;
29
+ }
30
+ /**
31
+ * Output of a einstein llm feedback call
32
+ *
33
+ * Keys:
34
+ * message (string): message
35
+ */
36
+ export interface EinsteinLlmFeedbackRepresentation {
37
+ message: string;
38
+ }
@@ -0,0 +1,28 @@
1
+ import { EinsteinLlmFeedbackInputRepresentation as EinsteinLlmFeedbackInputRepresentation_EinsteinLlmFeedbackInputRepresentation } from './EinsteinLlmFeedbackInputRepresentation';
2
+ import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, FragmentSelection as $64$luvio_engine_FragmentSelection, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
3
+ export declare const VERSION = "358db59f887ee50c67f9d2d3edb01fa0";
4
+ export declare function validate(obj: any, path?: string): TypeError | null;
5
+ export declare const RepresentationType: string;
6
+ export declare function normalize(input: EinsteinLlmFeedbackWrapperRepresentation, existing: EinsteinLlmFeedbackWrapperRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): EinsteinLlmFeedbackWrapperRepresentationNormalized;
7
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
8
+ export declare function equals(existing: EinsteinLlmFeedbackWrapperRepresentationNormalized, incoming: EinsteinLlmFeedbackWrapperRepresentationNormalized): boolean;
9
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
10
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: EinsteinLlmFeedbackWrapperRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
11
+ /**
12
+ * Input wrapper for feedback representation
13
+ *
14
+ * Keys:
15
+ * (none)
16
+ */
17
+ export interface EinsteinLlmFeedbackWrapperRepresentationNormalized {
18
+ feedbackInput: EinsteinLlmFeedbackInputRepresentation_EinsteinLlmFeedbackInputRepresentation;
19
+ }
20
+ /**
21
+ * Input wrapper for feedback representation
22
+ *
23
+ * Keys:
24
+ * (none)
25
+ */
26
+ export interface EinsteinLlmFeedbackWrapperRepresentation {
27
+ feedbackInput: EinsteinLlmFeedbackInputRepresentation_EinsteinLlmFeedbackInputRepresentation;
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-service-einsteinllm",
3
- "version": "1.229.0-dev1",
3
+ "version": "1.229.0-dev10",
4
4
  "description": "Connect family for Einstein LLM generations",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "dist/es/es2018/service-einsteinllm.js",
@@ -44,11 +44,11 @@
44
44
  "test:compat": "karma start --single-run --compat"
45
45
  },
46
46
  "dependencies": {
47
- "@salesforce/lds-bindings": "1.229.0-dev1"
47
+ "@salesforce/lds-bindings": "1.229.0-dev10"
48
48
  },
49
49
  "devDependencies": {
50
- "@salesforce/lds-compiler-plugins": "1.229.0-dev1",
51
- "@salesforce/lds-karma": "1.229.0-dev1"
50
+ "@salesforce/lds-compiler-plugins": "1.229.0-dev10",
51
+ "@salesforce/lds-karma": "1.229.0-dev10"
52
52
  },
53
53
  "nx": {
54
54
  "targets": {
package/sfdc/index.js CHANGED
@@ -13,7 +13,7 @@
13
13
  */
14
14
  /* proxy-compat-disable */
15
15
  import { withDefaultLuvio } from 'force/ldsEngine';
16
- import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2 } from 'force/luvioEngine';
16
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3 } from 'force/luvioEngine';
17
17
 
18
18
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
19
19
  const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
@@ -113,6 +113,230 @@ function createLink(ref) {
113
113
  };
114
114
  }
115
115
 
116
+ function validate$9(obj, path = 'EinsteinLlmFeedbackInputRepresentation') {
117
+ const v_error = (() => {
118
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
119
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
120
+ }
121
+ if (obj.appFeedback !== undefined) {
122
+ const obj_appFeedback = obj.appFeedback;
123
+ const path_appFeedback = path + '.appFeedback';
124
+ if (typeof obj_appFeedback !== 'object' || ArrayIsArray(obj_appFeedback) || obj_appFeedback === null) {
125
+ return new TypeError('Expected "object" but received "' + typeof obj_appFeedback + '" (at "' + path_appFeedback + '")');
126
+ }
127
+ const obj_appFeedback_keys = ObjectKeys(obj_appFeedback);
128
+ for (let i = 0; i < obj_appFeedback_keys.length; i++) {
129
+ const key = obj_appFeedback_keys[i];
130
+ const obj_appFeedback_prop = obj_appFeedback[key];
131
+ const path_appFeedback_prop = path_appFeedback + '["' + key + '"]';
132
+ if (typeof obj_appFeedback_prop !== 'object' || ArrayIsArray(obj_appFeedback_prop) || obj_appFeedback_prop === null) {
133
+ return new TypeError('Expected "object" but received "' + typeof obj_appFeedback_prop + '" (at "' + path_appFeedback_prop + '")');
134
+ }
135
+ }
136
+ }
137
+ if (obj.applicationName !== undefined) {
138
+ const obj_applicationName = obj.applicationName;
139
+ const path_applicationName = path + '.applicationName';
140
+ if (typeof obj_applicationName !== 'string') {
141
+ return new TypeError('Expected "string" but received "' + typeof obj_applicationName + '" (at "' + path_applicationName + '")');
142
+ }
143
+ }
144
+ if (obj.feedback !== undefined) {
145
+ const obj_feedback = obj.feedback;
146
+ const path_feedback = path + '.feedback';
147
+ if (typeof obj_feedback !== 'string') {
148
+ return new TypeError('Expected "string" but received "' + typeof obj_feedback + '" (at "' + path_feedback + '")');
149
+ }
150
+ }
151
+ const obj_feedbackText = obj.feedbackText;
152
+ const path_feedbackText = path + '.feedbackText';
153
+ if (typeof obj_feedbackText !== 'string') {
154
+ return new TypeError('Expected "string" but received "' + typeof obj_feedbackText + '" (at "' + path_feedbackText + '")');
155
+ }
156
+ const obj_generationId = obj.generationId;
157
+ const path_generationId = path + '.generationId';
158
+ if (typeof obj_generationId !== 'string') {
159
+ return new TypeError('Expected "string" but received "' + typeof obj_generationId + '" (at "' + path_generationId + '")');
160
+ }
161
+ const obj_id = obj.id;
162
+ const path_id = path + '.id';
163
+ if (typeof obj_id !== 'string') {
164
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
165
+ }
166
+ const obj_source = obj.source;
167
+ const path_source = path + '.source';
168
+ if (typeof obj_source !== 'string') {
169
+ return new TypeError('Expected "string" but received "' + typeof obj_source + '" (at "' + path_source + '")');
170
+ }
171
+ })();
172
+ return v_error === undefined ? null : v_error;
173
+ }
174
+
175
+ const TTL$2 = 100;
176
+ const VERSION$4 = "4033328f65865dd5d80c68a7573a4522";
177
+ function validate$8(obj, path = 'EinsteinLlmFeedbackRepresentation') {
178
+ const v_error = (() => {
179
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
180
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
181
+ }
182
+ const obj_message = obj.message;
183
+ const path_message = path + '.message';
184
+ if (typeof obj_message !== 'string') {
185
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
186
+ }
187
+ })();
188
+ return v_error === undefined ? null : v_error;
189
+ }
190
+ const RepresentationType$2 = 'EinsteinLlmFeedbackRepresentation';
191
+ function keyBuilder$2(luvio, config) {
192
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.message;
193
+ }
194
+ function keyBuilderFromType$2(luvio, object) {
195
+ const keyParams = {
196
+ message: object.message
197
+ };
198
+ return keyBuilder$2(luvio, keyParams);
199
+ }
200
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
201
+ return input;
202
+ }
203
+ const select$7 = function EinsteinLlmFeedbackRepresentationSelect() {
204
+ return {
205
+ kind: 'Fragment',
206
+ version: VERSION$4,
207
+ private: [],
208
+ selections: [
209
+ {
210
+ name: 'message',
211
+ kind: 'Scalar'
212
+ }
213
+ ]
214
+ };
215
+ };
216
+ function equals$4(existing, incoming) {
217
+ const existing_message = existing.message;
218
+ const incoming_message = incoming.message;
219
+ if (!(existing_message === incoming_message)) {
220
+ return false;
221
+ }
222
+ return true;
223
+ }
224
+ const ingest$2 = function EinsteinLlmFeedbackRepresentationIngest(input, path, luvio, store, timestamp) {
225
+ if (process.env.NODE_ENV !== 'production') {
226
+ const validateError = validate$8(input);
227
+ if (validateError !== null) {
228
+ throw validateError;
229
+ }
230
+ }
231
+ const key = keyBuilderFromType$2(luvio, input);
232
+ const ttlToUse = TTL$2;
233
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "EinsteinLLM", VERSION$4, RepresentationType$2, equals$4);
234
+ return createLink(key);
235
+ };
236
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
237
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
238
+ const rootKey = keyBuilderFromType$2(luvio, input);
239
+ rootKeySet.set(rootKey, {
240
+ namespace: keyPrefix,
241
+ representationName: RepresentationType$2,
242
+ mergeable: false
243
+ });
244
+ }
245
+
246
+ function select$6(luvio, params) {
247
+ return select$7();
248
+ }
249
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
250
+ getTypeCacheKeys$2(storeKeyMap, luvio, response);
251
+ }
252
+ function ingestSuccess$2(luvio, resourceParams, response) {
253
+ const { body } = response;
254
+ const key = keyBuilderFromType$2(luvio, body);
255
+ luvio.storeIngest(key, ingest$2, body);
256
+ const snapshot = luvio.storeLookup({
257
+ recordId: key,
258
+ node: select$6(),
259
+ variables: {},
260
+ });
261
+ if (process.env.NODE_ENV !== 'production') {
262
+ if (snapshot.state !== 'Fulfilled') {
263
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
264
+ }
265
+ }
266
+ deepFreeze(snapshot.data);
267
+ return snapshot;
268
+ }
269
+ function createResourceRequest$2(config) {
270
+ const headers = {};
271
+ return {
272
+ baseUri: '/services/data/v59.0',
273
+ basePath: '/einstein/llm/feedback',
274
+ method: 'post',
275
+ body: config.body,
276
+ urlParams: {},
277
+ queryParams: {},
278
+ headers,
279
+ priority: 'normal',
280
+ };
281
+ }
282
+
283
+ const adapterName$2 = 'createFeedback';
284
+ const createFeedback_ConfigPropertyMetadata = [
285
+ generateParamConfigMetadata('feedbackInput', true, 2 /* Body */, 4 /* Unsupported */),
286
+ ];
287
+ const createFeedback_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, createFeedback_ConfigPropertyMetadata);
288
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(createFeedback_ConfigPropertyMetadata);
289
+ function typeCheckConfig$2(untrustedConfig) {
290
+ const config = {};
291
+ const untrustedConfig_feedbackInput = untrustedConfig.feedbackInput;
292
+ const referenceEinsteinLlmFeedbackInputRepresentationValidationError = validate$9(untrustedConfig_feedbackInput);
293
+ if (referenceEinsteinLlmFeedbackInputRepresentationValidationError === null) {
294
+ config.feedbackInput = untrustedConfig_feedbackInput;
295
+ }
296
+ return config;
297
+ }
298
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
299
+ if (!untrustedIsObject(untrustedConfig)) {
300
+ return null;
301
+ }
302
+ if (process.env.NODE_ENV !== 'production') {
303
+ validateConfig(untrustedConfig, configPropertyNames);
304
+ }
305
+ const config = typeCheckConfig$2(untrustedConfig);
306
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
307
+ return null;
308
+ }
309
+ return config;
310
+ }
311
+ function buildNetworkSnapshot$2(luvio, config, options) {
312
+ const resourceParams = createResourceParams$2(config);
313
+ const request = createResourceRequest$2(resourceParams);
314
+ return luvio.dispatchResourceRequest(request, options)
315
+ .then((response) => {
316
+ return luvio.handleSuccessResponse(() => {
317
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
318
+ return luvio.storeBroadcast().then(() => snapshot);
319
+ }, () => {
320
+ const cache = new StoreKeyMap();
321
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
322
+ return cache;
323
+ });
324
+ }, (response) => {
325
+ deepFreeze(response);
326
+ throw response;
327
+ });
328
+ }
329
+ const createFeedbackAdapterFactory = (luvio) => {
330
+ return function createFeedback(untrustedConfig) {
331
+ const config = validateAdapterConfig$2(untrustedConfig, createFeedback_ConfigPropertyNames);
332
+ // Invalid or incomplete config
333
+ if (config === null) {
334
+ throw new Error('Invalid config for "createFeedback"');
335
+ }
336
+ return buildNetworkSnapshot$2(luvio, config);
337
+ };
338
+ };
339
+
116
340
  function validate$7(obj, path = 'EinsteinLlmAdditionalConfigInputRepresentation') {
117
341
  const v_error = (() => {
118
342
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
@@ -543,7 +767,7 @@ const createGenerations_ConfigPropertyMetadata = [
543
767
  generateParamConfigMetadata('generationsInput', true, 2 /* Body */, 4 /* Unsupported */),
544
768
  ];
545
769
  const createGenerations_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, createGenerations_ConfigPropertyMetadata);
546
- const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(createGenerations_ConfigPropertyMetadata);
770
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(createGenerations_ConfigPropertyMetadata);
547
771
  function typeCheckConfig$1(untrustedConfig) {
548
772
  const config = {};
549
773
  const untrustedConfig_generationsInput = untrustedConfig.generationsInput;
@@ -896,10 +1120,10 @@ const createGenerationsForPromptTemplate_ConfigPropertyMetadata = [
896
1120
  generateParamConfigMetadata('promptTemplateGenerationsInput', true, 2 /* Body */, 4 /* Unsupported */),
897
1121
  ];
898
1122
  const createGenerationsForPromptTemplate_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
899
- const createResourceParams = /*#__PURE__*/ createResourceParams$2(createGenerationsForPromptTemplate_ConfigPropertyMetadata);
1123
+ const createResourceParams = /*#__PURE__*/ createResourceParams$3(createGenerationsForPromptTemplate_ConfigPropertyMetadata);
900
1124
  function typeCheckConfig(untrustedConfig) {
901
1125
  const config = {};
902
- typeCheckConfig$2(untrustedConfig, config, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
1126
+ typeCheckConfig$3(untrustedConfig, config, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
903
1127
  const untrustedConfig_promptTemplateGenerationsInput = untrustedConfig.promptTemplateGenerationsInput;
904
1128
  const referenceEinsteinPromptTemplateGenerationsInputRepresentationValidationError = validate$1(untrustedConfig_promptTemplateGenerationsInput);
905
1129
  if (referenceEinsteinPromptTemplateGenerationsInputRepresentationValidationError === null) {
@@ -949,6 +1173,7 @@ const createGenerationsForPromptTemplateAdapterFactory = (luvio) => {
949
1173
  };
950
1174
  };
951
1175
 
1176
+ let createFeedback;
952
1177
  let createGenerations;
953
1178
  let createGenerationsForPromptTemplate;
954
1179
  function bindExportsTo(luvio) {
@@ -957,6 +1182,7 @@ function bindExportsTo(luvio) {
957
1182
  return (config) => adapter(config).then(snapshot => snapshot.data);
958
1183
  }
959
1184
  return {
1185
+ createFeedback: unwrapSnapshotData(createFeedbackAdapterFactory),
960
1186
  createGenerations: unwrapSnapshotData(createGenerationsAdapterFactory),
961
1187
  createGenerationsForPromptTemplate: unwrapSnapshotData(createGenerationsForPromptTemplateAdapterFactory),
962
1188
  // Imperative GET Adapters
@@ -964,10 +1190,11 @@ function bindExportsTo(luvio) {
964
1190
  }
965
1191
  withDefaultLuvio((luvio) => {
966
1192
  ({
1193
+ createFeedback,
967
1194
  createGenerations,
968
1195
  createGenerationsForPromptTemplate,
969
1196
  } = bindExportsTo(luvio));
970
1197
  });
971
1198
 
972
- export { createGenerations, createGenerationsForPromptTemplate };
973
- // version: 1.229.0-dev1-5b6d3db67
1199
+ export { createFeedback, createGenerations, createGenerationsForPromptTemplate };
1200
+ // version: 1.229.0-dev10-abb060196
package/src/raml/api.raml CHANGED
@@ -91,6 +91,53 @@ types:
91
91
  format: double
92
92
  type: number
93
93
  required: false # TODO Hand-rolled W-9314597
94
+ # TODO Hand-rolled W-8334626
95
+ # Need to manually wrap the input representation with what the aura controller is expecting
96
+ EinsteinLlmFeedbackWrapperRepresentation:
97
+ description: Input wrapper for feedback representation
98
+ type: object
99
+ properties:
100
+ feedbackInput:
101
+ description: Set the parameters for feedback
102
+ type: EinsteinLlmFeedbackInputRepresentation
103
+ EinsteinLlmFeedbackInputRepresentation:
104
+ description: Input representation for Feedback with Einstein LLM
105
+ type: object
106
+ properties:
107
+ appFeedback:
108
+ description: app feedback map
109
+ type: object
110
+ required: false # TODO Hand-rolled W-9314597
111
+ properties:
112
+ //:
113
+ type: object
114
+ feedback:
115
+ description: feedback
116
+ type: string
117
+ required: false # TODO Hand-rolled W-9314597
118
+ feedbackText:
119
+ description: Feedback Text
120
+ type: string
121
+ generationId:
122
+ description: Generation Id - Generations.response.id
123
+ type: string
124
+ id:
125
+ description: Feedback id
126
+ type: string
127
+ source:
128
+ description: Feedback source
129
+ type: string
130
+ applicationName:
131
+ description: Application name
132
+ type: string
133
+ required: false
134
+ EinsteinLlmFeedbackRepresentation:
135
+ description: Output of a einstein llm feedback call
136
+ type: object
137
+ properties:
138
+ message:
139
+ description: Response text of the feedback API
140
+ type: string
94
141
  # Hand-rolled remove all EinsteinLlmEmbedding*Representation types; not in scope for current work
95
142
  EinsteinLlmGenerationItemRepresentation:
96
143
  description: Output of a einstein llm generation item response
@@ -254,6 +301,20 @@ types:
254
301
  application/json:
255
302
  type: EinsteinLlmGenerationsInputWrapperRepresentation
256
303
  (oas-body-name): generationsInput
304
+ /feedback:
305
+ post:
306
+ displayName: postEinsteinLlmFeedback
307
+ description: Send feedback for a generations.response object
308
+ responses:
309
+ '200':
310
+ description: Success
311
+ body:
312
+ application/json:
313
+ type: EinsteinLlmFeedbackRepresentation
314
+ body:
315
+ application/json:
316
+ type: EinsteinLlmFeedbackWrapperRepresentation
317
+ (oas-body-name): feedbackInput
257
318
  /prompt-templates/{promptTemplateDevName}/generations:
258
319
  post:
259
320
  displayName: postEinsteinPromptTemplateGenerations
@@ -15,6 +15,10 @@ types:
15
15
  (luvio.ttl): 100
16
16
  (luvio.key):
17
17
  requestId: requestId
18
+ EinsteinLlmFeedbackRepresentation:
19
+ (luvio.ttl): 100
20
+ (luvio.key):
21
+ message: message
18
22
 
19
23
  /einstein/llm/prompt/generations:
20
24
  post:
@@ -25,3 +29,8 @@ types:
25
29
  post:
26
30
  (luvio.adapter):
27
31
  name: createGenerationsForPromptTemplate
32
+
33
+ /einstein/llm/feedback:
34
+ post:
35
+ (luvio.adapter):
36
+ name: createFeedback