@salesforce/lds-adapters-sfap-einstein-ai-gateway 1.284.0 → 1.285.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.
@@ -105,12 +105,66 @@ function createLink(ref) {
105
105
  };
106
106
  }
107
107
 
108
- const VERSION$4 = "647dd4ada228e1c62a79f1cdb4e44377";
108
+ const VERSION$5 = "1536a256eead5e0f6ed4af90b4a4e6f0";
109
+ function validate$5(obj, path = 'ContentQualityRepresentation') {
110
+ const v_error = (() => {
111
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
112
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
113
+ }
114
+ if (obj.is_toxicity_detected !== undefined) {
115
+ const obj_is_toxicity_detected = obj.is_toxicity_detected;
116
+ const path_is_toxicity_detected = path + '.is_toxicity_detected';
117
+ if (typeof obj_is_toxicity_detected !== 'boolean') {
118
+ return new TypeError('Expected "boolean" but received "' + typeof obj_is_toxicity_detected + '" (at "' + path_is_toxicity_detected + '")');
119
+ }
120
+ }
121
+ })();
122
+ return v_error === undefined ? null : v_error;
123
+ }
124
+ const select$7 = function ContentQualityRepresentationSelect() {
125
+ return {
126
+ kind: 'Fragment',
127
+ version: VERSION$5,
128
+ private: [],
129
+ selections: [
130
+ {
131
+ name: 'is_toxicity_detected',
132
+ kind: 'Scalar',
133
+ required: false
134
+ }
135
+ ]
136
+ };
137
+ };
138
+ function equals$5(existing, incoming) {
139
+ const existing_is_toxicity_detected = existing.is_toxicity_detected;
140
+ const incoming_is_toxicity_detected = incoming.is_toxicity_detected;
141
+ // if at least one of these optionals is defined
142
+ if (existing_is_toxicity_detected !== undefined || incoming_is_toxicity_detected !== undefined) {
143
+ // if one of these is not defined we know the other is defined and therefore
144
+ // not equal
145
+ if (existing_is_toxicity_detected === undefined || incoming_is_toxicity_detected === undefined) {
146
+ return false;
147
+ }
148
+ if (!(existing_is_toxicity_detected === incoming_is_toxicity_detected)) {
149
+ return false;
150
+ }
151
+ }
152
+ return true;
153
+ }
154
+
155
+ const VERSION$4 = "13f57c52293c993afc8242f865b3f15b";
109
156
  function validate$4(obj, path = 'SafetyCategoryScores') {
110
157
  const v_error = (() => {
111
158
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
112
159
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
113
160
  }
161
+ if (obj.biased !== undefined) {
162
+ const obj_biased = obj.biased;
163
+ const path_biased = path + '.biased';
164
+ if (typeof obj_biased !== 'number') {
165
+ return new TypeError('Expected "number" but received "' + typeof obj_biased + '" (at "' + path_biased + '")');
166
+ }
167
+ }
114
168
  if (obj.hate !== undefined) {
115
169
  const obj_hate = obj.hate;
116
170
  const path_hate = path + '.hate';
@@ -169,6 +223,11 @@ const select$6 = function SafetyCategoryScoresSelect() {
169
223
  version: VERSION$4,
170
224
  private: [],
171
225
  selections: [
226
+ {
227
+ name: 'biased',
228
+ kind: 'Scalar',
229
+ required: false
230
+ },
172
231
  {
173
232
  name: 'hate',
174
233
  kind: 'Scalar',
@@ -208,6 +267,19 @@ const select$6 = function SafetyCategoryScoresSelect() {
208
267
  };
209
268
  };
210
269
  function equals$4(existing, incoming) {
270
+ const existing_biased = existing.biased;
271
+ const incoming_biased = incoming.biased;
272
+ // if at least one of these optionals is defined
273
+ if (existing_biased !== undefined || incoming_biased !== undefined) {
274
+ // if one of these is not defined we know the other is defined and therefore
275
+ // not equal
276
+ if (existing_biased === undefined || incoming_biased === undefined) {
277
+ return false;
278
+ }
279
+ if (!(existing_biased === incoming_biased)) {
280
+ return false;
281
+ }
282
+ }
211
283
  const existing_hate = existing.hate;
212
284
  const incoming_hate = incoming.hate;
213
285
  // if at least one of these optionals is defined
@@ -404,12 +476,43 @@ function equals$3(existing, incoming) {
404
476
  return true;
405
477
  }
406
478
 
407
- const VERSION$2 = "c8979ea0708e5029fa2ab1e7d5ede8c8";
479
+ const VERSION$2 = "8777be1ae9f7cf216ac8618fd17a03c9";
408
480
  function validate$2(obj, path = 'GenerationResponseGenerations') {
409
481
  const v_error = (() => {
410
482
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
411
483
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
412
484
  }
485
+ if (obj.generation_content_quality !== undefined) {
486
+ const obj_generation_content_quality = obj.generation_content_quality;
487
+ const path_generation_content_quality = path + '.generation_content_quality';
488
+ let obj_generation_content_quality_union0 = null;
489
+ const obj_generation_content_quality_union0_error = (() => {
490
+ const referencepath_generation_content_qualityValidationError = validate$5(obj_generation_content_quality, path_generation_content_quality);
491
+ if (referencepath_generation_content_qualityValidationError !== null) {
492
+ let message = 'Object doesn\'t match ContentQualityRepresentation (at "' + path_generation_content_quality + '")\n';
493
+ message += referencepath_generation_content_qualityValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
494
+ return new TypeError(message);
495
+ }
496
+ })();
497
+ if (obj_generation_content_quality_union0_error != null) {
498
+ obj_generation_content_quality_union0 = obj_generation_content_quality_union0_error.message;
499
+ }
500
+ let obj_generation_content_quality_union1 = null;
501
+ const obj_generation_content_quality_union1_error = (() => {
502
+ if (obj_generation_content_quality !== null) {
503
+ return new TypeError('Expected "null" but received "' + typeof obj_generation_content_quality + '" (at "' + path_generation_content_quality + '")');
504
+ }
505
+ })();
506
+ if (obj_generation_content_quality_union1_error != null) {
507
+ obj_generation_content_quality_union1 = obj_generation_content_quality_union1_error.message;
508
+ }
509
+ if (obj_generation_content_quality_union0 && obj_generation_content_quality_union1) {
510
+ let message = 'Object doesn\'t match union (at "' + path_generation_content_quality + '")';
511
+ message += '\n' + obj_generation_content_quality_union0.split('\n').map((line) => '\t' + line).join('\n');
512
+ message += '\n' + obj_generation_content_quality_union1.split('\n').map((line) => '\t' + line).join('\n');
513
+ return new TypeError(message);
514
+ }
515
+ }
413
516
  if (obj.generation_safety_score !== undefined) {
414
517
  const obj_generation_safety_score = obj.generation_safety_score;
415
518
  const path_generation_safety_score = path + '.generation_safety_score';
@@ -473,12 +576,20 @@ function validate$2(obj, path = 'GenerationResponseGenerations') {
473
576
  return v_error === undefined ? null : v_error;
474
577
  }
475
578
  const select$4 = function GenerationResponseGenerationsSelect() {
579
+ const { selections: ContentQualityRepresentation__selections, opaque: ContentQualityRepresentation__opaque, } = select$7();
476
580
  const { selections: SafetyScoreRepresentation__selections, opaque: SafetyScoreRepresentation__opaque, } = select$5();
477
581
  return {
478
582
  kind: 'Fragment',
479
583
  version: VERSION$2,
480
584
  private: [],
481
585
  selections: [
586
+ {
587
+ name: 'generation_content_quality',
588
+ kind: 'Object',
589
+ nullable: true,
590
+ selections: ContentQualityRepresentation__selections,
591
+ required: false
592
+ },
482
593
  {
483
594
  name: 'generation_safety_score',
484
595
  kind: 'Object',
@@ -522,6 +633,22 @@ function equals$2(existing, incoming) {
522
633
  if (!(existing_text === incoming_text)) {
523
634
  return false;
524
635
  }
636
+ const existing_generation_content_quality = existing.generation_content_quality;
637
+ const incoming_generation_content_quality = incoming.generation_content_quality;
638
+ // if at least one of these optionals is defined
639
+ if (existing_generation_content_quality !== undefined || incoming_generation_content_quality !== undefined) {
640
+ // if one of these is not defined we know the other is defined and therefore
641
+ // not equal
642
+ if (existing_generation_content_quality === undefined || incoming_generation_content_quality === undefined) {
643
+ return false;
644
+ }
645
+ if (!(existing_generation_content_quality === incoming_generation_content_quality
646
+ || (existing_generation_content_quality != null &&
647
+ incoming_generation_content_quality != null &&
648
+ equals$5(existing_generation_content_quality, incoming_generation_content_quality)))) {
649
+ return false;
650
+ }
651
+ }
525
652
  const existing_generation_safety_score = existing.generation_safety_score;
526
653
  const incoming_generation_safety_score = incoming.generation_safety_score;
527
654
  // if at least one of these optionals is defined
@@ -560,7 +687,7 @@ function equals$2(existing, incoming) {
560
687
  }
561
688
 
562
689
  const TTL$1 = 100;
563
- const VERSION$1 = "ad6b1f255df73e241341ce190bfafe29";
690
+ const VERSION$1 = "4bce29cece0fd6272204a8fbdc02c35b";
564
691
  function validate$1(obj, path = 'GenerationResponse') {
565
692
  const v_error = (() => {
566
693
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
@@ -586,6 +713,37 @@ function validate$1(obj, path = 'GenerationResponse') {
586
713
  if (typeof obj_id !== 'string') {
587
714
  return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
588
715
  }
716
+ if (obj.input_safety_score !== undefined) {
717
+ const obj_input_safety_score = obj.input_safety_score;
718
+ const path_input_safety_score = path + '.input_safety_score';
719
+ let obj_input_safety_score_union0 = null;
720
+ const obj_input_safety_score_union0_error = (() => {
721
+ const referencepath_input_safety_scoreValidationError = validate$3(obj_input_safety_score, path_input_safety_score);
722
+ if (referencepath_input_safety_scoreValidationError !== null) {
723
+ let message = 'Object doesn\'t match SafetyScoreRepresentation (at "' + path_input_safety_score + '")\n';
724
+ message += referencepath_input_safety_scoreValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
725
+ return new TypeError(message);
726
+ }
727
+ })();
728
+ if (obj_input_safety_score_union0_error != null) {
729
+ obj_input_safety_score_union0 = obj_input_safety_score_union0_error.message;
730
+ }
731
+ let obj_input_safety_score_union1 = null;
732
+ const obj_input_safety_score_union1_error = (() => {
733
+ if (obj_input_safety_score !== null) {
734
+ return new TypeError('Expected "null" but received "' + typeof obj_input_safety_score + '" (at "' + path_input_safety_score + '")');
735
+ }
736
+ })();
737
+ if (obj_input_safety_score_union1_error != null) {
738
+ obj_input_safety_score_union1 = obj_input_safety_score_union1_error.message;
739
+ }
740
+ if (obj_input_safety_score_union0 && obj_input_safety_score_union1) {
741
+ let message = 'Object doesn\'t match union (at "' + path_input_safety_score + '")';
742
+ message += '\n' + obj_input_safety_score_union0.split('\n').map((line) => '\t' + line).join('\n');
743
+ message += '\n' + obj_input_safety_score_union1.split('\n').map((line) => '\t' + line).join('\n');
744
+ return new TypeError(message);
745
+ }
746
+ }
589
747
  if (obj.parameters !== undefined) {
590
748
  const obj_parameters = obj.parameters;
591
749
  const path_parameters = path + '.parameters';
@@ -648,6 +806,7 @@ function normalize$1(input, existing, path, luvio, store, timestamp) {
648
806
  }
649
807
  const select$3 = function GenerationResponseSelect() {
650
808
  const { selections: GenerationResponseGenerations__selections, opaque: GenerationResponseGenerations__opaque, } = select$4();
809
+ const { selections: SafetyScoreRepresentation__selections, opaque: SafetyScoreRepresentation__opaque, } = select$5();
651
810
  return {
652
811
  kind: 'Fragment',
653
812
  version: VERSION$1,
@@ -663,6 +822,13 @@ const select$3 = function GenerationResponseSelect() {
663
822
  name: 'id',
664
823
  kind: 'Scalar'
665
824
  },
825
+ {
826
+ name: 'input_safety_score',
827
+ kind: 'Object',
828
+ nullable: true,
829
+ selections: SafetyScoreRepresentation__selections,
830
+ required: false
831
+ },
666
832
  {
667
833
  name: 'parameters',
668
834
  kind: 'Object',
@@ -692,6 +858,22 @@ function equals$1(existing, incoming) {
692
858
  if (equals_generations_items === false) {
693
859
  return false;
694
860
  }
861
+ const existing_input_safety_score = existing.input_safety_score;
862
+ const incoming_input_safety_score = incoming.input_safety_score;
863
+ // if at least one of these optionals is defined
864
+ if (existing_input_safety_score !== undefined || incoming_input_safety_score !== undefined) {
865
+ // if one of these is not defined we know the other is defined and therefore
866
+ // not equal
867
+ if (existing_input_safety_score === undefined || incoming_input_safety_score === undefined) {
868
+ return false;
869
+ }
870
+ if (!(existing_input_safety_score === incoming_input_safety_score
871
+ || (existing_input_safety_score != null &&
872
+ incoming_input_safety_score != null &&
873
+ equals$3(existing_input_safety_score, incoming_input_safety_score)))) {
874
+ return false;
875
+ }
876
+ }
695
877
  const existing_parameters = existing.parameters;
696
878
  const incoming_parameters = incoming.parameters;
697
879
  // if at least one of these optionals is defined
@@ -1,6 +1,7 @@
1
+ import { ContentQualityRepresentation as ContentQualityRepresentation_ContentQualityRepresentation } from './ContentQualityRepresentation';
1
2
  import { SafetyScoreRepresentation as SafetyScoreRepresentation_SafetyScoreRepresentation } from './SafetyScoreRepresentation';
2
3
  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 = "3338b9ad23aaa609127f47253fdea9e8";
4
+ export declare const VERSION = "1e9c085ad08e9693cfb05fefdf1c912f";
4
5
  export declare function validate(obj: any, path?: string): TypeError | null;
5
6
  export declare const RepresentationType: string;
6
7
  export declare function normalize(input: ChatMessage, existing: ChatMessageNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): ChatMessageNormalized;
@@ -17,6 +18,7 @@ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableSto
17
18
  export interface ChatMessageNormalized {
18
19
  /** The content of the message. */
19
20
  content: string;
21
+ generation_content_quality?: ContentQualityRepresentation_ContentQualityRepresentation;
20
22
  generation_safety_score?: SafetyScoreRepresentation_SafetyScoreRepresentation;
21
23
  /** Generation ID. This value is required to register feedback. */
22
24
  id?: string;
@@ -35,6 +37,7 @@ export interface ChatMessageNormalized {
35
37
  */
36
38
  export interface ChatMessage {
37
39
  content: string;
40
+ generation_content_quality?: ContentQualityRepresentation_ContentQualityRepresentation;
38
41
  generation_safety_score?: SafetyScoreRepresentation_SafetyScoreRepresentation;
39
42
  id?: string;
40
43
  parameters?: {};
@@ -0,0 +1,28 @@
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 = "1536a256eead5e0f6ed4af90b4a4e6f0";
3
+ export declare function validate(obj: any, path?: string): TypeError | null;
4
+ export declare const RepresentationType: string;
5
+ export declare function normalize(input: ContentQualityRepresentation, existing: ContentQualityRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): ContentQualityRepresentationNormalized;
6
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
7
+ export declare function equals(existing: ContentQualityRepresentationNormalized, incoming: ContentQualityRepresentationNormalized): 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: ContentQualityRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
10
+ /**
11
+ * Data generated by the Trust Layer for content safety and quality (e.g., scores, explanations)
12
+ *
13
+ * Keys:
14
+ * (none)
15
+ */
16
+ export interface ContentQualityRepresentationNormalized {
17
+ /** True if the overall safety score exceeds threshold, false otherwise. Null value indicates safety score call failed */
18
+ is_toxicity_detected?: boolean;
19
+ }
20
+ /**
21
+ * Data generated by the Trust Layer for content safety and quality (e.g., scores, explanations)
22
+ *
23
+ * Keys:
24
+ * (none)
25
+ */
26
+ export interface ContentQualityRepresentation {
27
+ is_toxicity_detected?: boolean;
28
+ }
@@ -1,7 +1,8 @@
1
1
  import { GenerationResponseGenerations as GenerationResponseGenerations_GenerationResponseGenerations } from './GenerationResponseGenerations';
2
+ import { SafetyScoreRepresentation as SafetyScoreRepresentation_SafetyScoreRepresentation } from './SafetyScoreRepresentation';
2
3
  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';
3
4
  export declare const TTL = 100;
4
- export declare const VERSION = "ad6b1f255df73e241341ce190bfafe29";
5
+ export declare const VERSION = "4bce29cece0fd6272204a8fbdc02c35b";
5
6
  export declare function validate(obj: any, path?: string): TypeError | null;
6
7
  export declare const RepresentationType: string;
7
8
  export interface KeyParams extends $64$luvio_engine_KeyMetadata {
@@ -29,6 +30,7 @@ export interface GenerationResponseNormalized {
29
30
  generations: Array<GenerationResponseGenerations_GenerationResponseGenerations>;
30
31
  /** ID of the generation request. */
31
32
  id: string;
33
+ input_safety_score?: SafetyScoreRepresentation_SafetyScoreRepresentation | null;
32
34
  /** Any provider-specific attributes included as part of this object. Can be `null`. */
33
35
  parameters?: {
34
36
  [key: string]: unknown;
@@ -45,6 +47,7 @@ export interface GenerationResponseNormalized {
45
47
  export interface GenerationResponse {
46
48
  generations: Array<GenerationResponseGenerations_GenerationResponseGenerations>;
47
49
  id: string;
50
+ input_safety_score?: SafetyScoreRepresentation_SafetyScoreRepresentation | null;
48
51
  parameters?: {
49
52
  [key: string]: unknown;
50
53
  };
@@ -1,6 +1,7 @@
1
+ import { ContentQualityRepresentation as ContentQualityRepresentation_ContentQualityRepresentation } from './ContentQualityRepresentation';
1
2
  import { SafetyScoreRepresentation as SafetyScoreRepresentation_SafetyScoreRepresentation } from './SafetyScoreRepresentation';
2
3
  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 = "c8979ea0708e5029fa2ab1e7d5ede8c8";
4
+ export declare const VERSION = "8777be1ae9f7cf216ac8618fd17a03c9";
4
5
  export declare function validate(obj: any, path?: string): TypeError | null;
5
6
  export declare const RepresentationType: string;
6
7
  export declare function normalize(input: GenerationResponseGenerations, existing: GenerationResponseGenerationsNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): GenerationResponseGenerationsNormalized;
@@ -15,6 +16,7 @@ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableSto
15
16
  * (none)
16
17
  */
17
18
  export interface GenerationResponseGenerationsNormalized {
19
+ generation_content_quality?: ContentQualityRepresentation_ContentQualityRepresentation | null;
18
20
  generation_safety_score?: SafetyScoreRepresentation_SafetyScoreRepresentation | null;
19
21
  /** Generation ID. This value is required to register feedback. */
20
22
  id?: string;
@@ -32,6 +34,7 @@ export interface GenerationResponseGenerationsNormalized {
32
34
  * (none)
33
35
  */
34
36
  export interface GenerationResponseGenerations {
37
+ generation_content_quality?: ContentQualityRepresentation_ContentQualityRepresentation | null;
35
38
  generation_safety_score?: SafetyScoreRepresentation_SafetyScoreRepresentation | null;
36
39
  id?: string;
37
40
  parameters?: {
@@ -1,5 +1,5 @@
1
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 = "647dd4ada228e1c62a79f1cdb4e44377";
2
+ export declare const VERSION = "13f57c52293c993afc8242f865b3f15b";
3
3
  export declare function validate(obj: any, path?: string): TypeError | null;
4
4
  export declare const RepresentationType: string;
5
5
  export declare function normalize(input: SafetyCategoryScores, existing: SafetyCategoryScoresNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): SafetyCategoryScoresNormalized;
@@ -14,6 +14,7 @@ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableSto
14
14
  * (none)
15
15
  */
16
16
  export interface SafetyCategoryScoresNormalized {
17
+ biased?: number;
17
18
  hate?: number;
18
19
  identity?: number;
19
20
  physical?: number;
@@ -29,6 +30,7 @@ export interface SafetyCategoryScoresNormalized {
29
30
  * (none)
30
31
  */
31
32
  export interface SafetyCategoryScores {
33
+ biased?: number;
32
34
  hate?: number;
33
35
  identity?: number;
34
36
  physical?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-sfap-einstein-ai-gateway",
3
- "version": "1.284.0",
3
+ "version": "1.285.0",
4
4
  "description": "LLM Gateway API's",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "dist/es/es2018/sfap-einstein-ai-gateway.js",
@@ -40,10 +40,10 @@
40
40
  "test:unit": "jest"
41
41
  },
42
42
  "dependencies": {
43
- "@salesforce/lds-bindings": "^1.284.0"
43
+ "@salesforce/lds-bindings": "^1.285.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@salesforce/lds-compiler-plugins": "^1.284.0"
46
+ "@salesforce/lds-compiler-plugins": "^1.285.0"
47
47
  },
48
48
  "nx": {
49
49
  "targets": {
package/sfdc/index.js CHANGED
@@ -114,12 +114,66 @@ function createLink(ref) {
114
114
  };
115
115
  }
116
116
 
117
- const VERSION$4 = "647dd4ada228e1c62a79f1cdb4e44377";
117
+ const VERSION$5 = "1536a256eead5e0f6ed4af90b4a4e6f0";
118
+ function validate$5(obj, path = 'ContentQualityRepresentation') {
119
+ const v_error = (() => {
120
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
121
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
122
+ }
123
+ if (obj.is_toxicity_detected !== undefined) {
124
+ const obj_is_toxicity_detected = obj.is_toxicity_detected;
125
+ const path_is_toxicity_detected = path + '.is_toxicity_detected';
126
+ if (typeof obj_is_toxicity_detected !== 'boolean') {
127
+ return new TypeError('Expected "boolean" but received "' + typeof obj_is_toxicity_detected + '" (at "' + path_is_toxicity_detected + '")');
128
+ }
129
+ }
130
+ })();
131
+ return v_error === undefined ? null : v_error;
132
+ }
133
+ const select$7 = function ContentQualityRepresentationSelect() {
134
+ return {
135
+ kind: 'Fragment',
136
+ version: VERSION$5,
137
+ private: [],
138
+ selections: [
139
+ {
140
+ name: 'is_toxicity_detected',
141
+ kind: 'Scalar',
142
+ required: false
143
+ }
144
+ ]
145
+ };
146
+ };
147
+ function equals$5(existing, incoming) {
148
+ const existing_is_toxicity_detected = existing.is_toxicity_detected;
149
+ const incoming_is_toxicity_detected = incoming.is_toxicity_detected;
150
+ // if at least one of these optionals is defined
151
+ if (existing_is_toxicity_detected !== undefined || incoming_is_toxicity_detected !== undefined) {
152
+ // if one of these is not defined we know the other is defined and therefore
153
+ // not equal
154
+ if (existing_is_toxicity_detected === undefined || incoming_is_toxicity_detected === undefined) {
155
+ return false;
156
+ }
157
+ if (!(existing_is_toxicity_detected === incoming_is_toxicity_detected)) {
158
+ return false;
159
+ }
160
+ }
161
+ return true;
162
+ }
163
+
164
+ const VERSION$4 = "13f57c52293c993afc8242f865b3f15b";
118
165
  function validate$4(obj, path = 'SafetyCategoryScores') {
119
166
  const v_error = (() => {
120
167
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
121
168
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
122
169
  }
170
+ if (obj.biased !== undefined) {
171
+ const obj_biased = obj.biased;
172
+ const path_biased = path + '.biased';
173
+ if (typeof obj_biased !== 'number') {
174
+ return new TypeError('Expected "number" but received "' + typeof obj_biased + '" (at "' + path_biased + '")');
175
+ }
176
+ }
123
177
  if (obj.hate !== undefined) {
124
178
  const obj_hate = obj.hate;
125
179
  const path_hate = path + '.hate';
@@ -178,6 +232,11 @@ const select$6 = function SafetyCategoryScoresSelect() {
178
232
  version: VERSION$4,
179
233
  private: [],
180
234
  selections: [
235
+ {
236
+ name: 'biased',
237
+ kind: 'Scalar',
238
+ required: false
239
+ },
181
240
  {
182
241
  name: 'hate',
183
242
  kind: 'Scalar',
@@ -217,6 +276,19 @@ const select$6 = function SafetyCategoryScoresSelect() {
217
276
  };
218
277
  };
219
278
  function equals$4(existing, incoming) {
279
+ const existing_biased = existing.biased;
280
+ const incoming_biased = incoming.biased;
281
+ // if at least one of these optionals is defined
282
+ if (existing_biased !== undefined || incoming_biased !== undefined) {
283
+ // if one of these is not defined we know the other is defined and therefore
284
+ // not equal
285
+ if (existing_biased === undefined || incoming_biased === undefined) {
286
+ return false;
287
+ }
288
+ if (!(existing_biased === incoming_biased)) {
289
+ return false;
290
+ }
291
+ }
220
292
  const existing_hate = existing.hate;
221
293
  const incoming_hate = incoming.hate;
222
294
  // if at least one of these optionals is defined
@@ -413,12 +485,43 @@ function equals$3(existing, incoming) {
413
485
  return true;
414
486
  }
415
487
 
416
- const VERSION$2 = "c8979ea0708e5029fa2ab1e7d5ede8c8";
488
+ const VERSION$2 = "8777be1ae9f7cf216ac8618fd17a03c9";
417
489
  function validate$2(obj, path = 'GenerationResponseGenerations') {
418
490
  const v_error = (() => {
419
491
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
420
492
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
421
493
  }
494
+ if (obj.generation_content_quality !== undefined) {
495
+ const obj_generation_content_quality = obj.generation_content_quality;
496
+ const path_generation_content_quality = path + '.generation_content_quality';
497
+ let obj_generation_content_quality_union0 = null;
498
+ const obj_generation_content_quality_union0_error = (() => {
499
+ const referencepath_generation_content_qualityValidationError = validate$5(obj_generation_content_quality, path_generation_content_quality);
500
+ if (referencepath_generation_content_qualityValidationError !== null) {
501
+ let message = 'Object doesn\'t match ContentQualityRepresentation (at "' + path_generation_content_quality + '")\n';
502
+ message += referencepath_generation_content_qualityValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
503
+ return new TypeError(message);
504
+ }
505
+ })();
506
+ if (obj_generation_content_quality_union0_error != null) {
507
+ obj_generation_content_quality_union0 = obj_generation_content_quality_union0_error.message;
508
+ }
509
+ let obj_generation_content_quality_union1 = null;
510
+ const obj_generation_content_quality_union1_error = (() => {
511
+ if (obj_generation_content_quality !== null) {
512
+ return new TypeError('Expected "null" but received "' + typeof obj_generation_content_quality + '" (at "' + path_generation_content_quality + '")');
513
+ }
514
+ })();
515
+ if (obj_generation_content_quality_union1_error != null) {
516
+ obj_generation_content_quality_union1 = obj_generation_content_quality_union1_error.message;
517
+ }
518
+ if (obj_generation_content_quality_union0 && obj_generation_content_quality_union1) {
519
+ let message = 'Object doesn\'t match union (at "' + path_generation_content_quality + '")';
520
+ message += '\n' + obj_generation_content_quality_union0.split('\n').map((line) => '\t' + line).join('\n');
521
+ message += '\n' + obj_generation_content_quality_union1.split('\n').map((line) => '\t' + line).join('\n');
522
+ return new TypeError(message);
523
+ }
524
+ }
422
525
  if (obj.generation_safety_score !== undefined) {
423
526
  const obj_generation_safety_score = obj.generation_safety_score;
424
527
  const path_generation_safety_score = path + '.generation_safety_score';
@@ -482,12 +585,20 @@ function validate$2(obj, path = 'GenerationResponseGenerations') {
482
585
  return v_error === undefined ? null : v_error;
483
586
  }
484
587
  const select$4 = function GenerationResponseGenerationsSelect() {
588
+ const { selections: ContentQualityRepresentation__selections, opaque: ContentQualityRepresentation__opaque, } = select$7();
485
589
  const { selections: SafetyScoreRepresentation__selections, opaque: SafetyScoreRepresentation__opaque, } = select$5();
486
590
  return {
487
591
  kind: 'Fragment',
488
592
  version: VERSION$2,
489
593
  private: [],
490
594
  selections: [
595
+ {
596
+ name: 'generation_content_quality',
597
+ kind: 'Object',
598
+ nullable: true,
599
+ selections: ContentQualityRepresentation__selections,
600
+ required: false
601
+ },
491
602
  {
492
603
  name: 'generation_safety_score',
493
604
  kind: 'Object',
@@ -531,6 +642,22 @@ function equals$2(existing, incoming) {
531
642
  if (!(existing_text === incoming_text)) {
532
643
  return false;
533
644
  }
645
+ const existing_generation_content_quality = existing.generation_content_quality;
646
+ const incoming_generation_content_quality = incoming.generation_content_quality;
647
+ // if at least one of these optionals is defined
648
+ if (existing_generation_content_quality !== undefined || incoming_generation_content_quality !== undefined) {
649
+ // if one of these is not defined we know the other is defined and therefore
650
+ // not equal
651
+ if (existing_generation_content_quality === undefined || incoming_generation_content_quality === undefined) {
652
+ return false;
653
+ }
654
+ if (!(existing_generation_content_quality === incoming_generation_content_quality
655
+ || (existing_generation_content_quality != null &&
656
+ incoming_generation_content_quality != null &&
657
+ equals$5(existing_generation_content_quality, incoming_generation_content_quality)))) {
658
+ return false;
659
+ }
660
+ }
534
661
  const existing_generation_safety_score = existing.generation_safety_score;
535
662
  const incoming_generation_safety_score = incoming.generation_safety_score;
536
663
  // if at least one of these optionals is defined
@@ -569,7 +696,7 @@ function equals$2(existing, incoming) {
569
696
  }
570
697
 
571
698
  const TTL$1 = 100;
572
- const VERSION$1 = "ad6b1f255df73e241341ce190bfafe29";
699
+ const VERSION$1 = "4bce29cece0fd6272204a8fbdc02c35b";
573
700
  function validate$1(obj, path = 'GenerationResponse') {
574
701
  const v_error = (() => {
575
702
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
@@ -595,6 +722,37 @@ function validate$1(obj, path = 'GenerationResponse') {
595
722
  if (typeof obj_id !== 'string') {
596
723
  return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
597
724
  }
725
+ if (obj.input_safety_score !== undefined) {
726
+ const obj_input_safety_score = obj.input_safety_score;
727
+ const path_input_safety_score = path + '.input_safety_score';
728
+ let obj_input_safety_score_union0 = null;
729
+ const obj_input_safety_score_union0_error = (() => {
730
+ const referencepath_input_safety_scoreValidationError = validate$3(obj_input_safety_score, path_input_safety_score);
731
+ if (referencepath_input_safety_scoreValidationError !== null) {
732
+ let message = 'Object doesn\'t match SafetyScoreRepresentation (at "' + path_input_safety_score + '")\n';
733
+ message += referencepath_input_safety_scoreValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
734
+ return new TypeError(message);
735
+ }
736
+ })();
737
+ if (obj_input_safety_score_union0_error != null) {
738
+ obj_input_safety_score_union0 = obj_input_safety_score_union0_error.message;
739
+ }
740
+ let obj_input_safety_score_union1 = null;
741
+ const obj_input_safety_score_union1_error = (() => {
742
+ if (obj_input_safety_score !== null) {
743
+ return new TypeError('Expected "null" but received "' + typeof obj_input_safety_score + '" (at "' + path_input_safety_score + '")');
744
+ }
745
+ })();
746
+ if (obj_input_safety_score_union1_error != null) {
747
+ obj_input_safety_score_union1 = obj_input_safety_score_union1_error.message;
748
+ }
749
+ if (obj_input_safety_score_union0 && obj_input_safety_score_union1) {
750
+ let message = 'Object doesn\'t match union (at "' + path_input_safety_score + '")';
751
+ message += '\n' + obj_input_safety_score_union0.split('\n').map((line) => '\t' + line).join('\n');
752
+ message += '\n' + obj_input_safety_score_union1.split('\n').map((line) => '\t' + line).join('\n');
753
+ return new TypeError(message);
754
+ }
755
+ }
598
756
  if (obj.parameters !== undefined) {
599
757
  const obj_parameters = obj.parameters;
600
758
  const path_parameters = path + '.parameters';
@@ -657,6 +815,7 @@ function normalize$1(input, existing, path, luvio, store, timestamp) {
657
815
  }
658
816
  const select$3 = function GenerationResponseSelect() {
659
817
  const { selections: GenerationResponseGenerations__selections, opaque: GenerationResponseGenerations__opaque, } = select$4();
818
+ const { selections: SafetyScoreRepresentation__selections, opaque: SafetyScoreRepresentation__opaque, } = select$5();
660
819
  return {
661
820
  kind: 'Fragment',
662
821
  version: VERSION$1,
@@ -672,6 +831,13 @@ const select$3 = function GenerationResponseSelect() {
672
831
  name: 'id',
673
832
  kind: 'Scalar'
674
833
  },
834
+ {
835
+ name: 'input_safety_score',
836
+ kind: 'Object',
837
+ nullable: true,
838
+ selections: SafetyScoreRepresentation__selections,
839
+ required: false
840
+ },
675
841
  {
676
842
  name: 'parameters',
677
843
  kind: 'Object',
@@ -701,6 +867,22 @@ function equals$1(existing, incoming) {
701
867
  if (equals_generations_items === false) {
702
868
  return false;
703
869
  }
870
+ const existing_input_safety_score = existing.input_safety_score;
871
+ const incoming_input_safety_score = incoming.input_safety_score;
872
+ // if at least one of these optionals is defined
873
+ if (existing_input_safety_score !== undefined || incoming_input_safety_score !== undefined) {
874
+ // if one of these is not defined we know the other is defined and therefore
875
+ // not equal
876
+ if (existing_input_safety_score === undefined || incoming_input_safety_score === undefined) {
877
+ return false;
878
+ }
879
+ if (!(existing_input_safety_score === incoming_input_safety_score
880
+ || (existing_input_safety_score != null &&
881
+ incoming_input_safety_score != null &&
882
+ equals$3(existing_input_safety_score, incoming_input_safety_score)))) {
883
+ return false;
884
+ }
885
+ }
704
886
  const existing_parameters = existing.parameters;
705
887
  const incoming_parameters = incoming.parameters;
706
888
  // if at least one of these optionals is defined
@@ -1117,4 +1299,4 @@ withDefaultLuvio((luvio) => {
1117
1299
  });
1118
1300
 
1119
1301
  export { getGenerations, registerFeedback };
1120
- // version: 1.284.0-8b78b708e
1302
+ // version: 1.285.0-c97dec82e
package/src/raml/api.raml CHANGED
@@ -20,6 +20,9 @@ types:
20
20
  description: Prompt used for the generation. Can be `null`.
21
21
  (nullable): true
22
22
  type: string | nil
23
+ input_safety_score?:
24
+ (nullable): true
25
+ type: SafetyScoreRepresentation | nil
23
26
  parameters?:
24
27
  description: Any provider-specific attributes included as part of this object. Can be `null`.
25
28
  (nullable): true
@@ -273,6 +276,7 @@ types:
273
276
  logprobs: null
274
277
  additionalProperties: true
275
278
  generation_safety_score?: SafetyScoreRepresentation
279
+ generation_content_quality?: ContentQualityRepresentation
276
280
  GenerationResponseGenerations:
277
281
  description: Generated text that is part of the generated response.
278
282
  type: object
@@ -301,6 +305,9 @@ types:
301
305
  generation_safety_score?:
302
306
  (nullable): true
303
307
  type: SafetyScoreRepresentation | nil
308
+ generation_content_quality?:
309
+ (nullable): true
310
+ type: ContentQualityRepresentation | nil
304
311
  SafetyCategoryScores:
305
312
  description: Probability for each category. A higher probability indicates a more toxic content.
306
313
  type: object
@@ -340,6 +347,11 @@ types:
340
347
  type: number
341
348
  minimum: 0
342
349
  maximum: 1
350
+ biased?:
351
+ default: 0.0
352
+ type: number
353
+ minimum: 0
354
+ maximum: 1
343
355
  PluginGenerationResponse:
344
356
  description: Generic plug-in generation response
345
357
  type: object
@@ -409,6 +421,13 @@ types:
409
421
  node-id: node-53p98pwse5i39ququ4
410
422
  node-53p98pwse5i39ququ4: gateway-request-id
411
423
  additionalProperties: true
424
+ ContentQualityRepresentation:
425
+ description: Data generated by the Trust Layer for content safety and quality (e.g., scores, explanations)
426
+ type: object
427
+ properties:
428
+ is_toxicity_detected?:
429
+ description: True if the overall safety score exceeds threshold, false otherwise. Null value indicates safety score call failed
430
+ type: boolean
412
431
  SafetyScoreRepresentation:
413
432
  description: Overall score and category score
414
433
  type: object