@salesforce/lds-adapters-service-einsteinllm 1.296.1 → 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.
@@ -4,10 +4,11 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, StoreKeyMap, createResourceParams as createResourceParams$4, typeCheckConfig as typeCheckConfig$4 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
11
+ const { stringify: JSONStringify$1 } = JSON;
11
12
  const { isArray: ArrayIsArray$1 } = Array;
12
13
  /**
13
14
  * Validates an adapter config is well-formed.
@@ -41,6 +42,68 @@ function untrustedIsObject(untrusted) {
41
42
  function areRequiredParametersPresent(config, configPropertyNames) {
42
43
  return configPropertyNames.parameters.required.every(req => req in config);
43
44
  }
45
+ const snapshotRefreshOptions = {
46
+ overrides: {
47
+ headers: {
48
+ 'Cache-Control': 'no-cache',
49
+ },
50
+ }
51
+ };
52
+ /**
53
+ * A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
54
+ * This is needed because insertion order for JSON.stringify(object) affects output:
55
+ * JSON.stringify({a: 1, b: 2})
56
+ * "{"a":1,"b":2}"
57
+ * JSON.stringify({b: 2, a: 1})
58
+ * "{"b":2,"a":1}"
59
+ * @param data Data to be JSON-stringified.
60
+ * @returns JSON.stringified value with consistent ordering of keys.
61
+ */
62
+ function stableJSONStringify(node) {
63
+ // This is for Date values.
64
+ if (node && node.toJSON && typeof node.toJSON === 'function') {
65
+ // eslint-disable-next-line no-param-reassign
66
+ node = node.toJSON();
67
+ }
68
+ if (node === undefined) {
69
+ return;
70
+ }
71
+ if (typeof node === 'number') {
72
+ return isFinite(node) ? '' + node : 'null';
73
+ }
74
+ if (typeof node !== 'object') {
75
+ return JSONStringify$1(node);
76
+ }
77
+ let i;
78
+ let out;
79
+ if (ArrayIsArray$1(node)) {
80
+ out = '[';
81
+ for (i = 0; i < node.length; i++) {
82
+ if (i) {
83
+ out += ',';
84
+ }
85
+ out += stableJSONStringify(node[i]) || 'null';
86
+ }
87
+ return out + ']';
88
+ }
89
+ if (node === null) {
90
+ return 'null';
91
+ }
92
+ const keys = ObjectKeys$1(node).sort();
93
+ out = '';
94
+ for (i = 0; i < keys.length; i++) {
95
+ const key = keys[i];
96
+ const value = stableJSONStringify(node[key]);
97
+ if (!value) {
98
+ continue;
99
+ }
100
+ if (out) {
101
+ out += ',';
102
+ }
103
+ out += JSONStringify$1(key) + ':' + value;
104
+ }
105
+ return '{' + out + '}';
106
+ }
44
107
  function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
45
108
  return {
46
109
  name,
@@ -66,6 +129,7 @@ const keyPrefix = 'EinsteinLLM';
66
129
 
67
130
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
68
131
  const { isArray: ArrayIsArray } = Array;
132
+ const { stringify: JSONStringify } = JSON;
69
133
  function equalsArray(a, b, equalsItem) {
70
134
  const aLength = a.length;
71
135
  const bLength = b.length;
@@ -104,6 +168,413 @@ function createLink(ref) {
104
168
  };
105
169
  }
106
170
 
171
+ function validate$k(obj, path = 'EinsteinLlmEmbeddingsAdditionalConfigInputRepresentation') {
172
+ const v_error = (() => {
173
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
174
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
175
+ }
176
+ if (obj.additionalParameters !== undefined) {
177
+ const obj_additionalParameters = obj.additionalParameters;
178
+ const path_additionalParameters = path + '.additionalParameters';
179
+ if (typeof obj_additionalParameters !== 'object' || ArrayIsArray(obj_additionalParameters) || obj_additionalParameters === null) {
180
+ return new TypeError('Expected "object" but received "' + typeof obj_additionalParameters + '" (at "' + path_additionalParameters + '")');
181
+ }
182
+ const obj_additionalParameters_keys = ObjectKeys(obj_additionalParameters);
183
+ for (let i = 0; i < obj_additionalParameters_keys.length; i++) {
184
+ const key = obj_additionalParameters_keys[i];
185
+ const obj_additionalParameters_prop = obj_additionalParameters[key];
186
+ const path_additionalParameters_prop = path_additionalParameters + '["' + key + '"]';
187
+ if (obj_additionalParameters_prop === undefined) {
188
+ return new TypeError('Expected "defined" but received "' + typeof obj_additionalParameters_prop + '" (at "' + path_additionalParameters_prop + '")');
189
+ }
190
+ }
191
+ }
192
+ const obj_applicationName = obj.applicationName;
193
+ const path_applicationName = path + '.applicationName';
194
+ if (typeof obj_applicationName !== 'string') {
195
+ return new TypeError('Expected "string" but received "' + typeof obj_applicationName + '" (at "' + path_applicationName + '")');
196
+ }
197
+ if (obj.enablePiiMasking !== undefined) {
198
+ const obj_enablePiiMasking = obj.enablePiiMasking;
199
+ const path_enablePiiMasking = path + '.enablePiiMasking';
200
+ if (typeof obj_enablePiiMasking !== 'boolean') {
201
+ return new TypeError('Expected "boolean" but received "' + typeof obj_enablePiiMasking + '" (at "' + path_enablePiiMasking + '")');
202
+ }
203
+ }
204
+ if (obj.model !== undefined) {
205
+ const obj_model = obj.model;
206
+ const path_model = path + '.model';
207
+ if (typeof obj_model !== 'string') {
208
+ return new TypeError('Expected "string" but received "' + typeof obj_model + '" (at "' + path_model + '")');
209
+ }
210
+ }
211
+ })();
212
+ return v_error === undefined ? null : v_error;
213
+ }
214
+
215
+ function validate$j(obj, path = 'WrappedListString') {
216
+ const v_error = (() => {
217
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
218
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
219
+ }
220
+ const obj_wrappedListString = obj.wrappedListString;
221
+ const path_wrappedListString = path + '.wrappedListString';
222
+ if (!ArrayIsArray(obj_wrappedListString)) {
223
+ return new TypeError('Expected "array" but received "' + typeof obj_wrappedListString + '" (at "' + path_wrappedListString + '")');
224
+ }
225
+ for (let i = 0; i < obj_wrappedListString.length; i++) {
226
+ const obj_wrappedListString_item = obj_wrappedListString[i];
227
+ const path_wrappedListString_item = path_wrappedListString + '[' + i + ']';
228
+ if (typeof obj_wrappedListString_item !== 'string') {
229
+ return new TypeError('Expected "string" but received "' + typeof obj_wrappedListString_item + '" (at "' + path_wrappedListString_item + '")');
230
+ }
231
+ }
232
+ })();
233
+ return v_error === undefined ? null : v_error;
234
+ }
235
+
236
+ function validate$i(obj, path = 'EinsteinLlmEmbeddingsInputRepresentation') {
237
+ const v_error = (() => {
238
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
239
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
240
+ }
241
+ const obj_additionalConfig = obj.additionalConfig;
242
+ const path_additionalConfig = path + '.additionalConfig';
243
+ const referencepath_additionalConfigValidationError = validate$k(obj_additionalConfig, path_additionalConfig);
244
+ if (referencepath_additionalConfigValidationError !== null) {
245
+ let message = 'Object doesn\'t match EinsteinLlmEmbeddingsAdditionalConfigInputRepresentation (at "' + path_additionalConfig + '")\n';
246
+ message += referencepath_additionalConfigValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
247
+ return new TypeError(message);
248
+ }
249
+ const obj_prompts = obj.prompts;
250
+ const path_prompts = path + '.prompts';
251
+ const referencepath_promptsValidationError = validate$j(obj_prompts, path_prompts);
252
+ if (referencepath_promptsValidationError !== null) {
253
+ let message = 'Object doesn\'t match WrappedListString (at "' + path_prompts + '")\n';
254
+ message += referencepath_promptsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
255
+ return new TypeError(message);
256
+ }
257
+ if (obj.provider !== undefined) {
258
+ const obj_provider = obj.provider;
259
+ const path_provider = path + '.provider';
260
+ if (typeof obj_provider !== 'string') {
261
+ return new TypeError('Expected "string" but received "' + typeof obj_provider + '" (at "' + path_provider + '")');
262
+ }
263
+ }
264
+ })();
265
+ return v_error === undefined ? null : v_error;
266
+ }
267
+
268
+ const VERSION$c = "5ed5ccc6fa6f15691ec0fc1080e41fe6";
269
+ function validate$h(obj, path = 'EinsteinLlmEmbeddingItemRepresentation') {
270
+ const v_error = (() => {
271
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
272
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
273
+ }
274
+ const obj_embedding = obj.embedding;
275
+ const path_embedding = path + '.embedding';
276
+ if (!ArrayIsArray(obj_embedding)) {
277
+ return new TypeError('Expected "array" but received "' + typeof obj_embedding + '" (at "' + path_embedding + '")');
278
+ }
279
+ for (let i = 0; i < obj_embedding.length; i++) {
280
+ obj_embedding[i];
281
+ }
282
+ const obj_index = obj.index;
283
+ const path_index = path + '.index';
284
+ if (typeof obj_index !== 'number' || (typeof obj_index === 'number' && Math.floor(obj_index) !== obj_index)) {
285
+ return new TypeError('Expected "integer" but received "' + typeof obj_index + '" (at "' + path_index + '")');
286
+ }
287
+ })();
288
+ return v_error === undefined ? null : v_error;
289
+ }
290
+ const select$g = function EinsteinLlmEmbeddingItemRepresentationSelect() {
291
+ return {
292
+ kind: 'Fragment',
293
+ version: VERSION$c,
294
+ private: [],
295
+ selections: [
296
+ {
297
+ name: 'embedding',
298
+ kind: 'Scalar',
299
+ plural: true
300
+ },
301
+ {
302
+ name: 'index',
303
+ kind: 'Scalar'
304
+ }
305
+ ]
306
+ };
307
+ };
308
+ function equals$c(existing, incoming) {
309
+ const existing_index = existing.index;
310
+ const incoming_index = incoming.index;
311
+ if (!(existing_index === incoming_index)) {
312
+ return false;
313
+ }
314
+ const existing_embedding = existing.embedding;
315
+ const incoming_embedding = incoming.embedding;
316
+ const equals_embedding_items = equalsArray(existing_embedding, incoming_embedding, (existing_embedding_item, incoming_embedding_item) => {
317
+ if (!(existing_embedding_item === incoming_embedding_item)) {
318
+ return false;
319
+ }
320
+ });
321
+ if (equals_embedding_items === false) {
322
+ return false;
323
+ }
324
+ return true;
325
+ }
326
+
327
+ const TTL$3 = 100;
328
+ const VERSION$b = "d9873651f09d29764ef4d4231eb653d7";
329
+ function validate$g(obj, path = 'EinsteinLlmEmbeddingsRepresentation') {
330
+ const v_error = (() => {
331
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
332
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
333
+ }
334
+ const obj_embeddings = obj.embeddings;
335
+ const path_embeddings = path + '.embeddings';
336
+ if (!ArrayIsArray(obj_embeddings)) {
337
+ return new TypeError('Expected "array" but received "' + typeof obj_embeddings + '" (at "' + path_embeddings + '")');
338
+ }
339
+ for (let i = 0; i < obj_embeddings.length; i++) {
340
+ const obj_embeddings_item = obj_embeddings[i];
341
+ const path_embeddings_item = path_embeddings + '[' + i + ']';
342
+ const referencepath_embeddings_itemValidationError = validate$h(obj_embeddings_item, path_embeddings_item);
343
+ if (referencepath_embeddings_itemValidationError !== null) {
344
+ let message = 'Object doesn\'t match EinsteinLlmEmbeddingItemRepresentation (at "' + path_embeddings_item + '")\n';
345
+ message += referencepath_embeddings_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
346
+ return new TypeError(message);
347
+ }
348
+ }
349
+ const obj_parameters = obj.parameters;
350
+ const path_parameters = path + '.parameters';
351
+ if (typeof obj_parameters !== 'object' || ArrayIsArray(obj_parameters) || obj_parameters === null) {
352
+ return new TypeError('Expected "object" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
353
+ }
354
+ const obj_parameters_keys = ObjectKeys(obj_parameters);
355
+ for (let i = 0; i < obj_parameters_keys.length; i++) {
356
+ const key = obj_parameters_keys[i];
357
+ const obj_parameters_prop = obj_parameters[key];
358
+ const path_parameters_prop = path_parameters + '["' + key + '"]';
359
+ if (obj_parameters_prop === undefined) {
360
+ return new TypeError('Expected "defined" but received "' + typeof obj_parameters_prop + '" (at "' + path_parameters_prop + '")');
361
+ }
362
+ }
363
+ })();
364
+ return v_error === undefined ? null : v_error;
365
+ }
366
+ const RepresentationType$3 = 'EinsteinLlmEmbeddingsRepresentation';
367
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
368
+ return input;
369
+ }
370
+ const select$f = function EinsteinLlmEmbeddingsRepresentationSelect() {
371
+ const { selections: EinsteinLlmEmbeddingItemRepresentation__selections, opaque: EinsteinLlmEmbeddingItemRepresentation__opaque, } = select$g();
372
+ return {
373
+ kind: 'Fragment',
374
+ version: VERSION$b,
375
+ private: [],
376
+ selections: [
377
+ {
378
+ name: 'embeddings',
379
+ kind: 'Object',
380
+ plural: true,
381
+ selections: EinsteinLlmEmbeddingItemRepresentation__selections
382
+ },
383
+ {
384
+ name: 'parameters',
385
+ kind: 'Object',
386
+ // any
387
+ }
388
+ ]
389
+ };
390
+ };
391
+ function equals$b(existing, incoming) {
392
+ const existing_embeddings = existing.embeddings;
393
+ const incoming_embeddings = incoming.embeddings;
394
+ const equals_embeddings_items = equalsArray(existing_embeddings, incoming_embeddings, (existing_embeddings_item, incoming_embeddings_item) => {
395
+ if (!(equals$c(existing_embeddings_item, incoming_embeddings_item))) {
396
+ return false;
397
+ }
398
+ });
399
+ if (equals_embeddings_items === false) {
400
+ return false;
401
+ }
402
+ const existing_parameters = existing.parameters;
403
+ const incoming_parameters = incoming.parameters;
404
+ const equals_parameters_props = equalsObject(existing_parameters, incoming_parameters, (existing_parameters_prop, incoming_parameters_prop) => {
405
+ if (JSONStringify(incoming_parameters_prop) !== JSONStringify(existing_parameters_prop)) {
406
+ return false;
407
+ }
408
+ });
409
+ if (equals_parameters_props === false) {
410
+ return false;
411
+ }
412
+ return true;
413
+ }
414
+ const ingest$3 = function EinsteinLlmEmbeddingsRepresentationIngest(input, path, luvio, store, timestamp) {
415
+ if (process.env.NODE_ENV !== 'production') {
416
+ const validateError = validate$g(input);
417
+ if (validateError !== null) {
418
+ throw validateError;
419
+ }
420
+ }
421
+ const key = path.fullPath;
422
+ const ttlToUse = TTL$3;
423
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "EinsteinLLM", VERSION$b, RepresentationType$3, equals$b);
424
+ return createLink(key);
425
+ };
426
+ function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
427
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
428
+ const rootKey = fullPathFactory();
429
+ rootKeySet.set(rootKey, {
430
+ namespace: keyPrefix,
431
+ representationName: RepresentationType$3,
432
+ mergeable: false
433
+ });
434
+ }
435
+
436
+ function select$e(luvio, params) {
437
+ return select$f();
438
+ }
439
+ function keyBuilder$4(luvio, params) {
440
+ 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) + ')';
441
+ }
442
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
443
+ getTypeCacheKeys$3(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
444
+ }
445
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
446
+ const { body } = response;
447
+ const key = keyBuilder$4(luvio, resourceParams);
448
+ luvio.storeIngest(key, ingest$3, body);
449
+ const snapshot = luvio.storeLookup({
450
+ recordId: key,
451
+ node: select$e(),
452
+ variables: {},
453
+ }, snapshotRefresh);
454
+ if (process.env.NODE_ENV !== 'production') {
455
+ if (snapshot.state !== 'Fulfilled') {
456
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
457
+ }
458
+ }
459
+ deepFreeze(snapshot.data);
460
+ return snapshot;
461
+ }
462
+ function ingestError(luvio, params, error, snapshotRefresh) {
463
+ const key = keyBuilder$4(luvio, params);
464
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
465
+ const storeMetadataParams = {
466
+ ttl: TTL$3,
467
+ namespace: keyPrefix,
468
+ version: VERSION$b,
469
+ representationName: RepresentationType$3
470
+ };
471
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
472
+ return errorSnapshot;
473
+ }
474
+ function createResourceRequest$3(config) {
475
+ const headers = {};
476
+ return {
477
+ baseUri: '/services/data/v62.0',
478
+ basePath: '/einstein/llm/embeddings',
479
+ method: 'post',
480
+ body: config.body,
481
+ urlParams: {},
482
+ queryParams: {},
483
+ headers,
484
+ priority: 'normal',
485
+ };
486
+ }
487
+
488
+ const adapterName$3 = 'createEmbeddings';
489
+ const createEmbeddings_ConfigPropertyMetadata = [
490
+ generateParamConfigMetadata('embeddingsInput', true, 2 /* Body */, 4 /* Unsupported */),
491
+ ];
492
+ const createEmbeddings_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, createEmbeddings_ConfigPropertyMetadata);
493
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(createEmbeddings_ConfigPropertyMetadata);
494
+ function keyBuilder$3(luvio, config) {
495
+ const resourceParams = createResourceParams$3(config);
496
+ return keyBuilder$4(luvio, resourceParams);
497
+ }
498
+ function typeCheckConfig$3(untrustedConfig) {
499
+ const config = {};
500
+ const untrustedConfig_embeddingsInput = untrustedConfig.embeddingsInput;
501
+ const referenceEinsteinLlmEmbeddingsInputRepresentationValidationError = validate$i(untrustedConfig_embeddingsInput);
502
+ if (referenceEinsteinLlmEmbeddingsInputRepresentationValidationError === null) {
503
+ config.embeddingsInput = untrustedConfig_embeddingsInput;
504
+ }
505
+ return config;
506
+ }
507
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
508
+ if (!untrustedIsObject(untrustedConfig)) {
509
+ return null;
510
+ }
511
+ if (process.env.NODE_ENV !== 'production') {
512
+ validateConfig(untrustedConfig, configPropertyNames);
513
+ }
514
+ const config = typeCheckConfig$3(untrustedConfig);
515
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
516
+ return null;
517
+ }
518
+ return config;
519
+ }
520
+ function adapterFragment(luvio, config) {
521
+ createResourceParams$3(config);
522
+ return select$e();
523
+ }
524
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
525
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
526
+ config,
527
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
528
+ });
529
+ return luvio.storeBroadcast().then(() => snapshot);
530
+ }
531
+ function onFetchResponseError(luvio, config, resourceParams, response) {
532
+ const snapshot = ingestError(luvio, resourceParams, response, {
533
+ config,
534
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
535
+ });
536
+ return luvio.storeBroadcast().then(() => snapshot);
537
+ }
538
+ function buildNetworkSnapshot$3(luvio, config, options) {
539
+ const resourceParams = createResourceParams$3(config);
540
+ const request = createResourceRequest$3(resourceParams);
541
+ return luvio.dispatchResourceRequest(request, options)
542
+ .then((response) => {
543
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
544
+ const cache = new StoreKeyMap();
545
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
546
+ return cache;
547
+ });
548
+ }, (response) => {
549
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
550
+ });
551
+ }
552
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
553
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, 'get', false);
554
+ }
555
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
556
+ const { luvio, config } = context;
557
+ const selector = {
558
+ recordId: keyBuilder$3(luvio, config),
559
+ node: adapterFragment(luvio, config),
560
+ variables: {},
561
+ };
562
+ const cacheSnapshot = storeLookup(selector, {
563
+ config,
564
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
565
+ });
566
+ return cacheSnapshot;
567
+ }
568
+ const createEmbeddingsAdapterFactory = (luvio) => function EinsteinLLM__createEmbeddings(untrustedConfig, requestContext) {
569
+ const config = validateAdapterConfig$3(untrustedConfig, createEmbeddings_ConfigPropertyNames);
570
+ // Invalid or incomplete config
571
+ if (config === null) {
572
+ return null;
573
+ }
574
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
575
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
576
+ };
577
+
107
578
  function validate$f(obj, path = 'EinsteinLlmFeedbackInputRepresentation') {
108
579
  const v_error = (() => {
109
580
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
@@ -264,7 +735,7 @@ const createFeedback_ConfigPropertyMetadata = [
264
735
  generateParamConfigMetadata('feedbackInput', true, 2 /* Body */, 4 /* Unsupported */),
265
736
  ];
266
737
  const createFeedback_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, createFeedback_ConfigPropertyMetadata);
267
- const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(createFeedback_ConfigPropertyMetadata);
738
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(createFeedback_ConfigPropertyMetadata);
268
739
  function typeCheckConfig$2(untrustedConfig) {
269
740
  const config = {};
270
741
  const untrustedConfig_feedbackInput = untrustedConfig.feedbackInput;
@@ -842,7 +1313,7 @@ function equals$8(existing, incoming) {
842
1313
  return true;
843
1314
  }
844
1315
 
845
- const VERSION$7 = "aebe0f32437ab18bd126a1fb5ff48d9b";
1316
+ const VERSION$7 = "4a07778ff6c595d91c575188146647a1";
846
1317
  function validate$9(obj, path = 'EinsteinLlmGenerationItemRepresentation') {
847
1318
  const v_error = (() => {
848
1319
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
@@ -879,6 +1350,13 @@ function validate$9(obj, path = 'EinsteinLlmGenerationItemRepresentation') {
879
1350
  return new TypeError(message);
880
1351
  }
881
1352
  }
1353
+ if (obj.isSummarized !== undefined) {
1354
+ const obj_isSummarized = obj.isSummarized;
1355
+ const path_isSummarized = path + '.isSummarized';
1356
+ if (typeof obj_isSummarized !== 'boolean') {
1357
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSummarized + '" (at "' + path_isSummarized + '")');
1358
+ }
1359
+ }
882
1360
  const obj_parameters = obj.parameters;
883
1361
  const path_parameters = path + '.parameters';
884
1362
  if (typeof obj_parameters !== 'string') {
@@ -943,6 +1421,11 @@ const select$9 = function EinsteinLlmGenerationItemRepresentationSelect() {
943
1421
  selections: EinsteinLlmGenerationsContentQualityRepresentation__selections,
944
1422
  required: false
945
1423
  },
1424
+ {
1425
+ name: 'isSummarized',
1426
+ kind: 'Scalar',
1427
+ required: false
1428
+ },
946
1429
  {
947
1430
  name: 'parameters',
948
1431
  kind: 'Scalar'
@@ -966,6 +1449,19 @@ const select$9 = function EinsteinLlmGenerationItemRepresentationSelect() {
966
1449
  };
967
1450
  };
968
1451
  function equals$7(existing, incoming) {
1452
+ const existing_isSummarized = existing.isSummarized;
1453
+ const incoming_isSummarized = incoming.isSummarized;
1454
+ // if at least one of these optionals is defined
1455
+ if (existing_isSummarized !== undefined || incoming_isSummarized !== undefined) {
1456
+ // if one of these is not defined we know the other is defined and therefore
1457
+ // not equal
1458
+ if (existing_isSummarized === undefined || incoming_isSummarized === undefined) {
1459
+ return false;
1460
+ }
1461
+ if (!(existing_isSummarized === incoming_isSummarized)) {
1462
+ return false;
1463
+ }
1464
+ }
969
1465
  const existing_parameters = existing.parameters;
970
1466
  const incoming_parameters = incoming.parameters;
971
1467
  if (!(existing_parameters === incoming_parameters)) {
@@ -1282,7 +1778,7 @@ const createGenerations_ConfigPropertyMetadata = [
1282
1778
  generateParamConfigMetadata('generationsInput', true, 2 /* Body */, 4 /* Unsupported */),
1283
1779
  ];
1284
1780
  const createGenerations_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, createGenerations_ConfigPropertyMetadata);
1285
- const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(createGenerations_ConfigPropertyMetadata);
1781
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(createGenerations_ConfigPropertyMetadata);
1286
1782
  function typeCheckConfig$1(untrustedConfig) {
1287
1783
  const config = {};
1288
1784
  const untrustedConfig_generationsInput = untrustedConfig.generationsInput;
@@ -1385,6 +1881,13 @@ function validate$5(obj, path = 'EinsteinPromptTemplateGenerationsInputRepresent
1385
1881
  if (typeof obj_isPreview !== 'boolean') {
1386
1882
  return new TypeError('Expected "boolean" but received "' + typeof obj_isPreview + '" (at "' + path_isPreview + '")');
1387
1883
  }
1884
+ if (obj.outputLanguage !== undefined) {
1885
+ const obj_outputLanguage = obj.outputLanguage;
1886
+ const path_outputLanguage = path + '.outputLanguage';
1887
+ if (typeof obj_outputLanguage !== 'string') {
1888
+ return new TypeError('Expected "string" but received "' + typeof obj_outputLanguage + '" (at "' + path_outputLanguage + '")');
1889
+ }
1890
+ }
1388
1891
  if (obj.provider !== undefined) {
1389
1892
  const obj_provider = obj.provider;
1390
1893
  const path_provider = path + '.provider';
@@ -2125,10 +2628,10 @@ const createGenerationsForPromptTemplate_ConfigPropertyMetadata = [
2125
2628
  generateParamConfigMetadata('promptTemplateGenerationsInput', true, 2 /* Body */, 4 /* Unsupported */),
2126
2629
  ];
2127
2630
  const createGenerationsForPromptTemplate_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
2128
- const createResourceParams = /*#__PURE__*/ createResourceParams$3(createGenerationsForPromptTemplate_ConfigPropertyMetadata);
2631
+ const createResourceParams = /*#__PURE__*/ createResourceParams$4(createGenerationsForPromptTemplate_ConfigPropertyMetadata);
2129
2632
  function typeCheckConfig(untrustedConfig) {
2130
2633
  const config = {};
2131
- typeCheckConfig$3(untrustedConfig, config, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
2634
+ typeCheckConfig$4(untrustedConfig, config, createGenerationsForPromptTemplate_ConfigPropertyMetadata);
2132
2635
  const untrustedConfig_promptTemplateGenerationsInput = untrustedConfig.promptTemplateGenerationsInput;
2133
2636
  const referenceEinsteinPromptTemplateGenerationsInputRepresentationValidationError = validate$5(untrustedConfig_promptTemplateGenerationsInput);
2134
2637
  if (referenceEinsteinPromptTemplateGenerationsInputRepresentationValidationError === null) {
@@ -2178,4 +2681,4 @@ const createGenerationsForPromptTemplateAdapterFactory = (luvio) => {
2178
2681
  };
2179
2682
  };
2180
2683
 
2181
- export { createFeedbackAdapterFactory, createGenerationsAdapterFactory, createGenerationsForPromptTemplateAdapterFactory };
2684
+ export { createEmbeddingsAdapterFactory, createFeedbackAdapterFactory, createGenerationsAdapterFactory, createGenerationsForPromptTemplateAdapterFactory };
@@ -0,0 +1,28 @@
1
+ import { AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata, Luvio as $64$luvio_engine_Luvio, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, Fragment as $64$luvio_engine_Fragment, Snapshot as $64$luvio_engine_Snapshot, FetchResponse as $64$luvio_engine_FetchResponse, ErrorResponse as $64$luvio_engine_ErrorResponse, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, CoercedAdapterRequestContext as $64$luvio_engine_CoercedAdapterRequestContext, StoreLookup as $64$luvio_engine_StoreLookup, 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 { EinsteinLlmEmbeddingsInputRepresentation as types_EinsteinLlmEmbeddingsInputRepresentation_EinsteinLlmEmbeddingsInputRepresentation } from '../types/EinsteinLlmEmbeddingsInputRepresentation';
4
+ import { ResourceRequestConfig as resources_postEinsteinLlmEmbeddings_ResourceRequestConfig } from '../resources/postEinsteinLlmEmbeddings';
5
+ import { EinsteinLlmEmbeddingsRepresentation as types_EinsteinLlmEmbeddingsRepresentation_EinsteinLlmEmbeddingsRepresentation } from '../types/EinsteinLlmEmbeddingsRepresentation';
6
+ export declare const adapterName = "createEmbeddings";
7
+ export declare const createEmbeddings_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
8
+ export declare const createEmbeddings_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
9
+ export interface CreateEmbeddingsConfig {
10
+ embeddingsInput: types_EinsteinLlmEmbeddingsInputRepresentation_EinsteinLlmEmbeddingsInputRepresentation;
11
+ }
12
+ export declare const createResourceParams: (config: CreateEmbeddingsConfig) => resources_postEinsteinLlmEmbeddings_ResourceRequestConfig;
13
+ export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, config: CreateEmbeddingsConfig): string;
14
+ export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, config: CreateEmbeddingsConfig): $64$luvio_engine_NormalizedKeyMetadata;
15
+ export declare function typeCheckConfig(untrustedConfig: adapter$45$utils_Untrusted<CreateEmbeddingsConfig>): adapter$45$utils_Untrusted<CreateEmbeddingsConfig>;
16
+ export declare function validateAdapterConfig(untrustedConfig: unknown, configPropertyNames: adapter$45$utils_AdapterValidationConfig): CreateEmbeddingsConfig | null;
17
+ export declare function adapterFragment(luvio: $64$luvio_engine_Luvio, config: CreateEmbeddingsConfig): $64$luvio_engine_Fragment;
18
+ export declare function buildCachedSnapshot(luvio: $64$luvio_engine_Luvio, config: CreateEmbeddingsConfig): $64$luvio_engine_Snapshot<types_EinsteinLlmEmbeddingsRepresentation_EinsteinLlmEmbeddingsRepresentation, any>;
19
+ export declare function onFetchResponseSuccess(luvio: $64$luvio_engine_Luvio, config: CreateEmbeddingsConfig, resourceParams: resources_postEinsteinLlmEmbeddings_ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_EinsteinLlmEmbeddingsRepresentation_EinsteinLlmEmbeddingsRepresentation>): Promise<import("@luvio/engine").FulfilledSnapshot<types_EinsteinLlmEmbeddingsRepresentation_EinsteinLlmEmbeddingsRepresentation, {}> | import("@luvio/engine").StaleSnapshot<types_EinsteinLlmEmbeddingsRepresentation_EinsteinLlmEmbeddingsRepresentation, {}> | import("@luvio/engine").PendingSnapshot<types_EinsteinLlmEmbeddingsRepresentation_EinsteinLlmEmbeddingsRepresentation, any>>;
20
+ export declare function onFetchResponseError(luvio: $64$luvio_engine_Luvio, config: CreateEmbeddingsConfig, resourceParams: resources_postEinsteinLlmEmbeddings_ResourceRequestConfig, response: $64$luvio_engine_ErrorResponse): Promise<import("@luvio/engine").ErrorSnapshot>;
21
+ export declare function buildNetworkSnapshot(luvio: $64$luvio_engine_Luvio, config: CreateEmbeddingsConfig, options?: $64$luvio_engine_DispatchResourceRequestContext): Promise<$64$luvio_engine_Snapshot<types_EinsteinLlmEmbeddingsRepresentation_EinsteinLlmEmbeddingsRepresentation, any>>;
22
+ export type BuildSnapshotContext = {
23
+ luvio: $64$luvio_engine_Luvio;
24
+ config: CreateEmbeddingsConfig;
25
+ };
26
+ export declare function buildNetworkSnapshotCachePolicy(context: BuildSnapshotContext, coercedAdapterRequestContext: $64$luvio_engine_CoercedAdapterRequestContext): Promise<$64$luvio_engine_Snapshot<types_EinsteinLlmEmbeddingsRepresentation_EinsteinLlmEmbeddingsRepresentation, any>>;
27
+ export declare function buildCachedSnapshotCachePolicy(context: BuildSnapshotContext, storeLookup: $64$luvio_engine_StoreLookup<types_EinsteinLlmEmbeddingsRepresentation_EinsteinLlmEmbeddingsRepresentation>): $64$luvio_engine_Snapshot<types_EinsteinLlmEmbeddingsRepresentation_EinsteinLlmEmbeddingsRepresentation, any>;
28
+ export declare const createEmbeddingsAdapterFactory: $64$luvio_engine_AdapterFactory<CreateEmbeddingsConfig, types_EinsteinLlmEmbeddingsRepresentation_EinsteinLlmEmbeddingsRepresentation>;
@@ -1,3 +1,4 @@
1
+ export { createEmbeddingsAdapterFactory } from '../adapters/createEmbeddings';
1
2
  export { createFeedbackAdapterFactory } from '../adapters/createFeedback';
2
3
  export { createGenerationsAdapterFactory } from '../adapters/createGenerations';
3
4
  export { createGenerationsForPromptTemplateAdapterFactory } from '../adapters/createGenerationsForPromptTemplate';
@@ -1,4 +1,6 @@
1
+ declare let createEmbeddings: any;
1
2
  declare let createFeedback: any;
2
3
  declare let createGenerations: any;
3
4
  declare let createGenerationsForPromptTemplate: any;
4
- export { createFeedback, createGenerations, createGenerationsForPromptTemplate };
5
+ declare let createEmbeddings_imperative: any;
6
+ export { createEmbeddings, createFeedback, createGenerations, createGenerationsForPromptTemplate, createEmbeddings_imperative, };