@salesforce/lds-adapters-service-einsteinllm 1.296.0 → 1.297.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.
package/sfdc/index.js CHANGED
@@ -12,11 +12,13 @@
12
12
  * *******************************************************************************************
13
13
  */
14
14
  /* proxy-compat-disable */
15
+ import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
15
16
  import { withDefaultLuvio } from 'force/ldsEngine';
16
- import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3 } from 'force/luvioEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, StoreKeyMap, createResourceParams as createResourceParams$4, typeCheckConfig as typeCheckConfig$4 } from 'force/luvioEngine';
17
18
 
18
19
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
19
20
  const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
21
+ const { stringify: JSONStringify$1 } = JSON;
20
22
  const { isArray: ArrayIsArray$1 } = Array;
21
23
  /**
22
24
  * Validates an adapter config is well-formed.
@@ -50,6 +52,68 @@ function untrustedIsObject(untrusted) {
50
52
  function areRequiredParametersPresent(config, configPropertyNames) {
51
53
  return configPropertyNames.parameters.required.every(req => req in config);
52
54
  }
55
+ const snapshotRefreshOptions = {
56
+ overrides: {
57
+ headers: {
58
+ 'Cache-Control': 'no-cache',
59
+ },
60
+ }
61
+ };
62
+ /**
63
+ * A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
64
+ * This is needed because insertion order for JSON.stringify(object) affects output:
65
+ * JSON.stringify({a: 1, b: 2})
66
+ * "{"a":1,"b":2}"
67
+ * JSON.stringify({b: 2, a: 1})
68
+ * "{"b":2,"a":1}"
69
+ * @param data Data to be JSON-stringified.
70
+ * @returns JSON.stringified value with consistent ordering of keys.
71
+ */
72
+ function stableJSONStringify(node) {
73
+ // This is for Date values.
74
+ if (node && node.toJSON && typeof node.toJSON === 'function') {
75
+ // eslint-disable-next-line no-param-reassign
76
+ node = node.toJSON();
77
+ }
78
+ if (node === undefined) {
79
+ return;
80
+ }
81
+ if (typeof node === 'number') {
82
+ return isFinite(node) ? '' + node : 'null';
83
+ }
84
+ if (typeof node !== 'object') {
85
+ return JSONStringify$1(node);
86
+ }
87
+ let i;
88
+ let out;
89
+ if (ArrayIsArray$1(node)) {
90
+ out = '[';
91
+ for (i = 0; i < node.length; i++) {
92
+ if (i) {
93
+ out += ',';
94
+ }
95
+ out += stableJSONStringify(node[i]) || 'null';
96
+ }
97
+ return out + ']';
98
+ }
99
+ if (node === null) {
100
+ return 'null';
101
+ }
102
+ const keys = ObjectKeys$1(node).sort();
103
+ out = '';
104
+ for (i = 0; i < keys.length; i++) {
105
+ const key = keys[i];
106
+ const value = stableJSONStringify(node[key]);
107
+ if (!value) {
108
+ continue;
109
+ }
110
+ if (out) {
111
+ out += ',';
112
+ }
113
+ out += JSONStringify$1(key) + ':' + value;
114
+ }
115
+ return '{' + out + '}';
116
+ }
53
117
  function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
54
118
  return {
55
119
  name,
@@ -75,6 +139,7 @@ const keyPrefix = 'EinsteinLLM';
75
139
 
76
140
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
77
141
  const { isArray: ArrayIsArray } = Array;
142
+ const { stringify: JSONStringify } = JSON;
78
143
  function equalsArray(a, b, equalsItem) {
79
144
  const aLength = a.length;
80
145
  const bLength = b.length;
@@ -113,6 +178,413 @@ function createLink(ref) {
113
178
  };
114
179
  }
115
180
 
181
+ function validate$k(obj, path = 'EinsteinLlmEmbeddingsAdditionalConfigInputRepresentation') {
182
+ const v_error = (() => {
183
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
184
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
185
+ }
186
+ if (obj.additionalParameters !== undefined) {
187
+ const obj_additionalParameters = obj.additionalParameters;
188
+ const path_additionalParameters = path + '.additionalParameters';
189
+ if (typeof obj_additionalParameters !== 'object' || ArrayIsArray(obj_additionalParameters) || obj_additionalParameters === null) {
190
+ return new TypeError('Expected "object" but received "' + typeof obj_additionalParameters + '" (at "' + path_additionalParameters + '")');
191
+ }
192
+ const obj_additionalParameters_keys = ObjectKeys(obj_additionalParameters);
193
+ for (let i = 0; i < obj_additionalParameters_keys.length; i++) {
194
+ const key = obj_additionalParameters_keys[i];
195
+ const obj_additionalParameters_prop = obj_additionalParameters[key];
196
+ const path_additionalParameters_prop = path_additionalParameters + '["' + key + '"]';
197
+ if (obj_additionalParameters_prop === undefined) {
198
+ return new TypeError('Expected "defined" but received "' + typeof obj_additionalParameters_prop + '" (at "' + path_additionalParameters_prop + '")');
199
+ }
200
+ }
201
+ }
202
+ const obj_applicationName = obj.applicationName;
203
+ const path_applicationName = path + '.applicationName';
204
+ if (typeof obj_applicationName !== 'string') {
205
+ return new TypeError('Expected "string" but received "' + typeof obj_applicationName + '" (at "' + path_applicationName + '")');
206
+ }
207
+ if (obj.enablePiiMasking !== undefined) {
208
+ const obj_enablePiiMasking = obj.enablePiiMasking;
209
+ const path_enablePiiMasking = path + '.enablePiiMasking';
210
+ if (typeof obj_enablePiiMasking !== 'boolean') {
211
+ return new TypeError('Expected "boolean" but received "' + typeof obj_enablePiiMasking + '" (at "' + path_enablePiiMasking + '")');
212
+ }
213
+ }
214
+ if (obj.model !== undefined) {
215
+ const obj_model = obj.model;
216
+ const path_model = path + '.model';
217
+ if (typeof obj_model !== 'string') {
218
+ return new TypeError('Expected "string" but received "' + typeof obj_model + '" (at "' + path_model + '")');
219
+ }
220
+ }
221
+ })();
222
+ return v_error === undefined ? null : v_error;
223
+ }
224
+
225
+ function validate$j(obj, path = 'WrappedListString') {
226
+ const v_error = (() => {
227
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
228
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
229
+ }
230
+ const obj_wrappedListString = obj.wrappedListString;
231
+ const path_wrappedListString = path + '.wrappedListString';
232
+ if (!ArrayIsArray(obj_wrappedListString)) {
233
+ return new TypeError('Expected "array" but received "' + typeof obj_wrappedListString + '" (at "' + path_wrappedListString + '")');
234
+ }
235
+ for (let i = 0; i < obj_wrappedListString.length; i++) {
236
+ const obj_wrappedListString_item = obj_wrappedListString[i];
237
+ const path_wrappedListString_item = path_wrappedListString + '[' + i + ']';
238
+ if (typeof obj_wrappedListString_item !== 'string') {
239
+ return new TypeError('Expected "string" but received "' + typeof obj_wrappedListString_item + '" (at "' + path_wrappedListString_item + '")');
240
+ }
241
+ }
242
+ })();
243
+ return v_error === undefined ? null : v_error;
244
+ }
245
+
246
+ function validate$i(obj, path = 'EinsteinLlmEmbeddingsInputRepresentation') {
247
+ const v_error = (() => {
248
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
249
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
250
+ }
251
+ const obj_additionalConfig = obj.additionalConfig;
252
+ const path_additionalConfig = path + '.additionalConfig';
253
+ const referencepath_additionalConfigValidationError = validate$k(obj_additionalConfig, path_additionalConfig);
254
+ if (referencepath_additionalConfigValidationError !== null) {
255
+ let message = 'Object doesn\'t match EinsteinLlmEmbeddingsAdditionalConfigInputRepresentation (at "' + path_additionalConfig + '")\n';
256
+ message += referencepath_additionalConfigValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
257
+ return new TypeError(message);
258
+ }
259
+ const obj_prompts = obj.prompts;
260
+ const path_prompts = path + '.prompts';
261
+ const referencepath_promptsValidationError = validate$j(obj_prompts, path_prompts);
262
+ if (referencepath_promptsValidationError !== null) {
263
+ let message = 'Object doesn\'t match WrappedListString (at "' + path_prompts + '")\n';
264
+ message += referencepath_promptsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
265
+ return new TypeError(message);
266
+ }
267
+ if (obj.provider !== undefined) {
268
+ const obj_provider = obj.provider;
269
+ const path_provider = path + '.provider';
270
+ if (typeof obj_provider !== 'string') {
271
+ return new TypeError('Expected "string" but received "' + typeof obj_provider + '" (at "' + path_provider + '")');
272
+ }
273
+ }
274
+ })();
275
+ return v_error === undefined ? null : v_error;
276
+ }
277
+
278
+ const VERSION$c = "5ed5ccc6fa6f15691ec0fc1080e41fe6";
279
+ function validate$h(obj, path = 'EinsteinLlmEmbeddingItemRepresentation') {
280
+ const v_error = (() => {
281
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
282
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
283
+ }
284
+ const obj_embedding = obj.embedding;
285
+ const path_embedding = path + '.embedding';
286
+ if (!ArrayIsArray(obj_embedding)) {
287
+ return new TypeError('Expected "array" but received "' + typeof obj_embedding + '" (at "' + path_embedding + '")');
288
+ }
289
+ for (let i = 0; i < obj_embedding.length; i++) {
290
+ obj_embedding[i];
291
+ }
292
+ const obj_index = obj.index;
293
+ const path_index = path + '.index';
294
+ if (typeof obj_index !== 'number' || (typeof obj_index === 'number' && Math.floor(obj_index) !== obj_index)) {
295
+ return new TypeError('Expected "integer" but received "' + typeof obj_index + '" (at "' + path_index + '")');
296
+ }
297
+ })();
298
+ return v_error === undefined ? null : v_error;
299
+ }
300
+ const select$g = function EinsteinLlmEmbeddingItemRepresentationSelect() {
301
+ return {
302
+ kind: 'Fragment',
303
+ version: VERSION$c,
304
+ private: [],
305
+ selections: [
306
+ {
307
+ name: 'embedding',
308
+ kind: 'Scalar',
309
+ plural: true
310
+ },
311
+ {
312
+ name: 'index',
313
+ kind: 'Scalar'
314
+ }
315
+ ]
316
+ };
317
+ };
318
+ function equals$c(existing, incoming) {
319
+ const existing_index = existing.index;
320
+ const incoming_index = incoming.index;
321
+ if (!(existing_index === incoming_index)) {
322
+ return false;
323
+ }
324
+ const existing_embedding = existing.embedding;
325
+ const incoming_embedding = incoming.embedding;
326
+ const equals_embedding_items = equalsArray(existing_embedding, incoming_embedding, (existing_embedding_item, incoming_embedding_item) => {
327
+ if (!(existing_embedding_item === incoming_embedding_item)) {
328
+ return false;
329
+ }
330
+ });
331
+ if (equals_embedding_items === false) {
332
+ return false;
333
+ }
334
+ return true;
335
+ }
336
+
337
+ const TTL$3 = 100;
338
+ const VERSION$b = "d9873651f09d29764ef4d4231eb653d7";
339
+ function validate$g(obj, path = 'EinsteinLlmEmbeddingsRepresentation') {
340
+ const v_error = (() => {
341
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
342
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
343
+ }
344
+ const obj_embeddings = obj.embeddings;
345
+ const path_embeddings = path + '.embeddings';
346
+ if (!ArrayIsArray(obj_embeddings)) {
347
+ return new TypeError('Expected "array" but received "' + typeof obj_embeddings + '" (at "' + path_embeddings + '")');
348
+ }
349
+ for (let i = 0; i < obj_embeddings.length; i++) {
350
+ const obj_embeddings_item = obj_embeddings[i];
351
+ const path_embeddings_item = path_embeddings + '[' + i + ']';
352
+ const referencepath_embeddings_itemValidationError = validate$h(obj_embeddings_item, path_embeddings_item);
353
+ if (referencepath_embeddings_itemValidationError !== null) {
354
+ let message = 'Object doesn\'t match EinsteinLlmEmbeddingItemRepresentation (at "' + path_embeddings_item + '")\n';
355
+ message += referencepath_embeddings_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
356
+ return new TypeError(message);
357
+ }
358
+ }
359
+ const obj_parameters = obj.parameters;
360
+ const path_parameters = path + '.parameters';
361
+ if (typeof obj_parameters !== 'object' || ArrayIsArray(obj_parameters) || obj_parameters === null) {
362
+ return new TypeError('Expected "object" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
363
+ }
364
+ const obj_parameters_keys = ObjectKeys(obj_parameters);
365
+ for (let i = 0; i < obj_parameters_keys.length; i++) {
366
+ const key = obj_parameters_keys[i];
367
+ const obj_parameters_prop = obj_parameters[key];
368
+ const path_parameters_prop = path_parameters + '["' + key + '"]';
369
+ if (obj_parameters_prop === undefined) {
370
+ return new TypeError('Expected "defined" but received "' + typeof obj_parameters_prop + '" (at "' + path_parameters_prop + '")');
371
+ }
372
+ }
373
+ })();
374
+ return v_error === undefined ? null : v_error;
375
+ }
376
+ const RepresentationType$3 = 'EinsteinLlmEmbeddingsRepresentation';
377
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
378
+ return input;
379
+ }
380
+ const select$f = function EinsteinLlmEmbeddingsRepresentationSelect() {
381
+ const { selections: EinsteinLlmEmbeddingItemRepresentation__selections, opaque: EinsteinLlmEmbeddingItemRepresentation__opaque, } = select$g();
382
+ return {
383
+ kind: 'Fragment',
384
+ version: VERSION$b,
385
+ private: [],
386
+ selections: [
387
+ {
388
+ name: 'embeddings',
389
+ kind: 'Object',
390
+ plural: true,
391
+ selections: EinsteinLlmEmbeddingItemRepresentation__selections
392
+ },
393
+ {
394
+ name: 'parameters',
395
+ kind: 'Object',
396
+ // any
397
+ }
398
+ ]
399
+ };
400
+ };
401
+ function equals$b(existing, incoming) {
402
+ const existing_embeddings = existing.embeddings;
403
+ const incoming_embeddings = incoming.embeddings;
404
+ const equals_embeddings_items = equalsArray(existing_embeddings, incoming_embeddings, (existing_embeddings_item, incoming_embeddings_item) => {
405
+ if (!(equals$c(existing_embeddings_item, incoming_embeddings_item))) {
406
+ return false;
407
+ }
408
+ });
409
+ if (equals_embeddings_items === false) {
410
+ return false;
411
+ }
412
+ const existing_parameters = existing.parameters;
413
+ const incoming_parameters = incoming.parameters;
414
+ const equals_parameters_props = equalsObject(existing_parameters, incoming_parameters, (existing_parameters_prop, incoming_parameters_prop) => {
415
+ if (JSONStringify(incoming_parameters_prop) !== JSONStringify(existing_parameters_prop)) {
416
+ return false;
417
+ }
418
+ });
419
+ if (equals_parameters_props === false) {
420
+ return false;
421
+ }
422
+ return true;
423
+ }
424
+ const ingest$3 = function EinsteinLlmEmbeddingsRepresentationIngest(input, path, luvio, store, timestamp) {
425
+ if (process.env.NODE_ENV !== 'production') {
426
+ const validateError = validate$g(input);
427
+ if (validateError !== null) {
428
+ throw validateError;
429
+ }
430
+ }
431
+ const key = path.fullPath;
432
+ const ttlToUse = TTL$3;
433
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "EinsteinLLM", VERSION$b, RepresentationType$3, equals$b);
434
+ return createLink(key);
435
+ };
436
+ function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
437
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
438
+ const rootKey = fullPathFactory();
439
+ rootKeySet.set(rootKey, {
440
+ namespace: keyPrefix,
441
+ representationName: RepresentationType$3,
442
+ mergeable: false
443
+ });
444
+ }
445
+
446
+ function select$e(luvio, params) {
447
+ return select$f();
448
+ }
449
+ function keyBuilder$4(luvio, params) {
450
+ return keyPrefix + '::EinsteinLlmEmbeddingsRepresentation:(' + stableJSONStringify(params.body.embeddingsInput.additionalConfig.additionalParameters) + '::' + 'embeddingsInput.additionalConfig.applicationName:' + params.body.embeddingsInput.additionalConfig.applicationName + '::' + (params.body.embeddingsInput.additionalConfig.enablePiiMasking === undefined ? 'embeddingsInput.additionalConfig.enablePiiMasking' : 'embeddingsInput.additionalConfig.enablePiiMasking:' + params.body.embeddingsInput.additionalConfig.enablePiiMasking) + '::' + (params.body.embeddingsInput.additionalConfig.model === undefined ? 'embeddingsInput.additionalConfig.model' : 'embeddingsInput.additionalConfig.model:' + params.body.embeddingsInput.additionalConfig.model) + '::' + 'embeddingsInput.prompts.wrappedListString:' + params.body.embeddingsInput.prompts.wrappedListString + '::' + (params.body.embeddingsInput.provider === undefined ? 'embeddingsInput.provider' : 'embeddingsInput.provider:' + params.body.embeddingsInput.provider) + ')';
451
+ }
452
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
453
+ getTypeCacheKeys$3(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
454
+ }
455
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
456
+ const { body } = response;
457
+ const key = keyBuilder$4(luvio, resourceParams);
458
+ luvio.storeIngest(key, ingest$3, body);
459
+ const snapshot = luvio.storeLookup({
460
+ recordId: key,
461
+ node: select$e(),
462
+ variables: {},
463
+ }, snapshotRefresh);
464
+ if (process.env.NODE_ENV !== 'production') {
465
+ if (snapshot.state !== 'Fulfilled') {
466
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
467
+ }
468
+ }
469
+ deepFreeze(snapshot.data);
470
+ return snapshot;
471
+ }
472
+ function ingestError(luvio, params, error, snapshotRefresh) {
473
+ const key = keyBuilder$4(luvio, params);
474
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
475
+ const storeMetadataParams = {
476
+ ttl: TTL$3,
477
+ namespace: keyPrefix,
478
+ version: VERSION$b,
479
+ representationName: RepresentationType$3
480
+ };
481
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
482
+ return errorSnapshot;
483
+ }
484
+ function createResourceRequest$3(config) {
485
+ const headers = {};
486
+ return {
487
+ baseUri: '/services/data/v62.0',
488
+ basePath: '/einstein/llm/embeddings',
489
+ method: 'post',
490
+ body: config.body,
491
+ urlParams: {},
492
+ queryParams: {},
493
+ headers,
494
+ priority: 'normal',
495
+ };
496
+ }
497
+
498
+ const adapterName$3 = 'createEmbeddings';
499
+ const createEmbeddings_ConfigPropertyMetadata = [
500
+ generateParamConfigMetadata('embeddingsInput', true, 2 /* Body */, 4 /* Unsupported */),
501
+ ];
502
+ const createEmbeddings_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, createEmbeddings_ConfigPropertyMetadata);
503
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(createEmbeddings_ConfigPropertyMetadata);
504
+ function keyBuilder$3(luvio, config) {
505
+ const resourceParams = createResourceParams$3(config);
506
+ return keyBuilder$4(luvio, resourceParams);
507
+ }
508
+ function typeCheckConfig$3(untrustedConfig) {
509
+ const config = {};
510
+ const untrustedConfig_embeddingsInput = untrustedConfig.embeddingsInput;
511
+ const referenceEinsteinLlmEmbeddingsInputRepresentationValidationError = validate$i(untrustedConfig_embeddingsInput);
512
+ if (referenceEinsteinLlmEmbeddingsInputRepresentationValidationError === null) {
513
+ config.embeddingsInput = untrustedConfig_embeddingsInput;
514
+ }
515
+ return config;
516
+ }
517
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
518
+ if (!untrustedIsObject(untrustedConfig)) {
519
+ return null;
520
+ }
521
+ if (process.env.NODE_ENV !== 'production') {
522
+ validateConfig(untrustedConfig, configPropertyNames);
523
+ }
524
+ const config = typeCheckConfig$3(untrustedConfig);
525
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
526
+ return null;
527
+ }
528
+ return config;
529
+ }
530
+ function adapterFragment(luvio, config) {
531
+ createResourceParams$3(config);
532
+ return select$e();
533
+ }
534
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
535
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
536
+ config,
537
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
538
+ });
539
+ return luvio.storeBroadcast().then(() => snapshot);
540
+ }
541
+ function onFetchResponseError(luvio, config, resourceParams, response) {
542
+ const snapshot = ingestError(luvio, resourceParams, response, {
543
+ config,
544
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
545
+ });
546
+ return luvio.storeBroadcast().then(() => snapshot);
547
+ }
548
+ function buildNetworkSnapshot$3(luvio, config, options) {
549
+ const resourceParams = createResourceParams$3(config);
550
+ const request = createResourceRequest$3(resourceParams);
551
+ return luvio.dispatchResourceRequest(request, options)
552
+ .then((response) => {
553
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
554
+ const cache = new StoreKeyMap();
555
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
556
+ return cache;
557
+ });
558
+ }, (response) => {
559
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
560
+ });
561
+ }
562
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
563
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, 'get', false);
564
+ }
565
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
566
+ const { luvio, config } = context;
567
+ const selector = {
568
+ recordId: keyBuilder$3(luvio, config),
569
+ node: adapterFragment(luvio, config),
570
+ variables: {},
571
+ };
572
+ const cacheSnapshot = storeLookup(selector, {
573
+ config,
574
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
575
+ });
576
+ return cacheSnapshot;
577
+ }
578
+ const createEmbeddingsAdapterFactory = (luvio) => function EinsteinLLM__createEmbeddings(untrustedConfig, requestContext) {
579
+ const config = validateAdapterConfig$3(untrustedConfig, createEmbeddings_ConfigPropertyNames);
580
+ // Invalid or incomplete config
581
+ if (config === null) {
582
+ return null;
583
+ }
584
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
585
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
586
+ };
587
+
116
588
  function validate$f(obj, path = 'EinsteinLlmFeedbackInputRepresentation') {
117
589
  const v_error = (() => {
118
590
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
@@ -273,7 +745,7 @@ const createFeedback_ConfigPropertyMetadata = [
273
745
  generateParamConfigMetadata('feedbackInput', true, 2 /* Body */, 4 /* Unsupported */),
274
746
  ];
275
747
  const createFeedback_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, createFeedback_ConfigPropertyMetadata);
276
- const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(createFeedback_ConfigPropertyMetadata);
748
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(createFeedback_ConfigPropertyMetadata);
277
749
  function typeCheckConfig$2(untrustedConfig) {
278
750
  const config = {};
279
751
  const untrustedConfig_feedbackInput = untrustedConfig.feedbackInput;
@@ -851,7 +1323,7 @@ function equals$8(existing, incoming) {
851
1323
  return true;
852
1324
  }
853
1325
 
854
- const VERSION$7 = "aebe0f32437ab18bd126a1fb5ff48d9b";
1326
+ const VERSION$7 = "4a07778ff6c595d91c575188146647a1";
855
1327
  function validate$9(obj, path = 'EinsteinLlmGenerationItemRepresentation') {
856
1328
  const v_error = (() => {
857
1329
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
@@ -888,6 +1360,13 @@ function validate$9(obj, path = 'EinsteinLlmGenerationItemRepresentation') {
888
1360
  return new TypeError(message);
889
1361
  }
890
1362
  }
1363
+ if (obj.isSummarized !== undefined) {
1364
+ const obj_isSummarized = obj.isSummarized;
1365
+ const path_isSummarized = path + '.isSummarized';
1366
+ if (typeof obj_isSummarized !== 'boolean') {
1367
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSummarized + '" (at "' + path_isSummarized + '")');
1368
+ }
1369
+ }
891
1370
  const obj_parameters = obj.parameters;
892
1371
  const path_parameters = path + '.parameters';
893
1372
  if (typeof obj_parameters !== 'string') {
@@ -952,6 +1431,11 @@ const select$9 = function EinsteinLlmGenerationItemRepresentationSelect() {
952
1431
  selections: EinsteinLlmGenerationsContentQualityRepresentation__selections,
953
1432
  required: false
954
1433
  },
1434
+ {
1435
+ name: 'isSummarized',
1436
+ kind: 'Scalar',
1437
+ required: false
1438
+ },
955
1439
  {
956
1440
  name: 'parameters',
957
1441
  kind: 'Scalar'
@@ -975,6 +1459,19 @@ const select$9 = function EinsteinLlmGenerationItemRepresentationSelect() {
975
1459
  };
976
1460
  };
977
1461
  function equals$7(existing, incoming) {
1462
+ const existing_isSummarized = existing.isSummarized;
1463
+ const incoming_isSummarized = incoming.isSummarized;
1464
+ // if at least one of these optionals is defined
1465
+ if (existing_isSummarized !== undefined || incoming_isSummarized !== undefined) {
1466
+ // if one of these is not defined we know the other is defined and therefore
1467
+ // not equal
1468
+ if (existing_isSummarized === undefined || incoming_isSummarized === undefined) {
1469
+ return false;
1470
+ }
1471
+ if (!(existing_isSummarized === incoming_isSummarized)) {
1472
+ return false;
1473
+ }
1474
+ }
978
1475
  const existing_parameters = existing.parameters;
979
1476
  const incoming_parameters = incoming.parameters;
980
1477
  if (!(existing_parameters === incoming_parameters)) {
@@ -1291,7 +1788,7 @@ const createGenerations_ConfigPropertyMetadata = [
1291
1788
  generateParamConfigMetadata('generationsInput', true, 2 /* Body */, 4 /* Unsupported */),
1292
1789
  ];
1293
1790
  const createGenerations_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, createGenerations_ConfigPropertyMetadata);
1294
- const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(createGenerations_ConfigPropertyMetadata);
1791
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(createGenerations_ConfigPropertyMetadata);
1295
1792
  function typeCheckConfig$1(untrustedConfig) {
1296
1793
  const config = {};
1297
1794
  const untrustedConfig_generationsInput = untrustedConfig.generationsInput;
@@ -1394,6 +1891,13 @@ function validate$5(obj, path = 'EinsteinPromptTemplateGenerationsInputRepresent
1394
1891
  if (typeof obj_isPreview !== 'boolean') {
1395
1892
  return new TypeError('Expected "boolean" but received "' + typeof obj_isPreview + '" (at "' + path_isPreview + '")');
1396
1893
  }
1894
+ if (obj.outputLanguage !== undefined) {
1895
+ const obj_outputLanguage = obj.outputLanguage;
1896
+ const path_outputLanguage = path + '.outputLanguage';
1897
+ if (typeof obj_outputLanguage !== 'string') {
1898
+ return new TypeError('Expected "string" but received "' + typeof obj_outputLanguage + '" (at "' + path_outputLanguage + '")');
1899
+ }
1900
+ }
1397
1901
  if (obj.provider !== undefined) {
1398
1902
  const obj_provider = obj.provider;
1399
1903
  const path_provider = path + '.provider';
@@ -2134,10 +2638,10 @@ const createGenerationsForPromptTemplate_ConfigPropertyMetadata = [
2134
2638
  generateParamConfigMetadata('promptTemplateGenerationsInput', true, 2 /* Body */, 4 /* Unsupported */),
2135
2639
  ];
2136
2640
  const createGenerationsForPromptTemplate_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
2137
- const createResourceParams = /*#__PURE__*/ createResourceParams$3(createGenerationsForPromptTemplate_ConfigPropertyMetadata);
2641
+ const createResourceParams = /*#__PURE__*/ createResourceParams$4(createGenerationsForPromptTemplate_ConfigPropertyMetadata);
2138
2642
  function typeCheckConfig(untrustedConfig) {
2139
2643
  const config = {};
2140
- typeCheckConfig$3(untrustedConfig, config, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
2644
+ typeCheckConfig$4(untrustedConfig, config, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
2141
2645
  const untrustedConfig_promptTemplateGenerationsInput = untrustedConfig.promptTemplateGenerationsInput;
2142
2646
  const referenceEinsteinPromptTemplateGenerationsInputRepresentationValidationError = validate$5(untrustedConfig_promptTemplateGenerationsInput);
2143
2647
  if (referenceEinsteinPromptTemplateGenerationsInputRepresentationValidationError === null) {
@@ -2187,28 +2691,41 @@ const createGenerationsForPromptTemplateAdapterFactory = (luvio) => {
2187
2691
  };
2188
2692
  };
2189
2693
 
2694
+ let createEmbeddings;
2190
2695
  let createFeedback;
2191
2696
  let createGenerations;
2192
2697
  let createGenerationsForPromptTemplate;
2698
+ // Imperative GET Adapters
2699
+ let createEmbeddings_imperative;
2700
+ // Adapter Metadata
2701
+ const createEmbeddingsMetadata = { apiFamily: 'EinsteinLLM', name: 'createEmbeddings', ttl: 100 };
2193
2702
  // Notify Update Available
2194
2703
  function bindExportsTo(luvio) {
2195
2704
  // LDS Adapters
2705
+ const createEmbeddings_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'createEmbeddings', createEmbeddingsAdapterFactory), createEmbeddingsMetadata);
2196
2706
  function unwrapSnapshotData(factory) {
2197
2707
  const adapter = factory(luvio);
2198
2708
  return (config) => adapter(config).then((snapshot) => snapshot.data);
2199
2709
  }
2200
2710
  return {
2711
+ createEmbeddings: createWireAdapterConstructor(luvio, createEmbeddings_ldsAdapter, createEmbeddingsMetadata),
2201
2712
  createFeedback: unwrapSnapshotData(createFeedbackAdapterFactory),
2202
2713
  createGenerations: unwrapSnapshotData(createGenerationsAdapterFactory),
2203
2714
  createGenerationsForPromptTemplate: unwrapSnapshotData(createGenerationsForPromptTemplateAdapterFactory),
2204
2715
  // Imperative GET Adapters
2716
+ createEmbeddings_imperative: createImperativeAdapter(luvio, createEmbeddings_ldsAdapter, createEmbeddingsMetadata),
2205
2717
  // Notify Update Availables
2206
2718
  };
2207
2719
  }
2208
2720
  withDefaultLuvio((luvio) => {
2209
- ({ createFeedback, createGenerations, createGenerationsForPromptTemplate } =
2210
- bindExportsTo(luvio));
2721
+ ({
2722
+ createEmbeddings,
2723
+ createFeedback,
2724
+ createGenerations,
2725
+ createGenerationsForPromptTemplate,
2726
+ createEmbeddings_imperative,
2727
+ } = bindExportsTo(luvio));
2211
2728
  });
2212
2729
 
2213
- export { createFeedback, createGenerations, createGenerationsForPromptTemplate };
2214
- // version: 1.296.0-b5e933418
2730
+ export { createEmbeddings, createEmbeddings_imperative, createFeedback, createGenerations, createGenerationsForPromptTemplate };
2731
+ // version: 1.297.0-e0cfbd880