@digipair/skill-vespa 0.19.4 → 0.20.1

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/index.cjs.js CHANGED
@@ -68122,14 +68122,14 @@ function indent(str, spaces) {
68122
68122
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
68123
68123
  // match is required
68124
68124
  if (!match) {
68125
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
68125
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
68126
68126
  v: nextMatch1
68127
68127
  };
68128
68128
  }
68129
68129
  var token = match.token, offset = match.offset;
68130
68130
  i1 += offset;
68131
68131
  if (token === " ") {
68132
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
68132
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
68133
68133
  }
68134
68134
  tokens1 = _to_consumable_array$1(tokens1).concat([
68135
68135
  token
@@ -68148,7 +68148,7 @@ function indent(str, spaces) {
68148
68148
  if (contextKeys.some(function(el) {
68149
68149
  return el.startsWith(name);
68150
68150
  })) {
68151
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
68151
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
68152
68152
  }
68153
68153
  if (dateTimeIdentifiers.some(function(el) {
68154
68154
  return el === name;
@@ -68167,9 +68167,9 @@ function indent(str, spaces) {
68167
68167
  if (dateTimeIdentifiers.some(function(el) {
68168
68168
  return el.startsWith(name);
68169
68169
  })) {
68170
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
68170
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
68171
68171
  }
68172
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
68172
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
68173
68173
  v: nextMatch1
68174
68174
  };
68175
68175
  };
@@ -72204,11 +72204,13 @@ let VespaService = class VespaService {
72204
72204
  async find(params, _pinsSettingsList, context) {
72205
72205
  var _context_privates_VESPA_SERVER;
72206
72206
  const { baseUrl = (_context_privates_VESPA_SERVER = context.privates.VESPA_SERVER) != null ? _context_privates_VESPA_SERVER : VESPA_SERVER, collection = 'knowledge', limit = 100, orderby = '', query } = params;
72207
+ var _context_privates_VESPA_PREFIX, _ref;
72208
+ const prefix = (_ref = (_context_privates_VESPA_PREFIX = context.privates.VESPA_PREFIX) != null ? _context_privates_VESPA_PREFIX : process.env['VESPA_PREFIX']) != null ? _ref : '';
72207
72209
  if (orderby !== '' && !/^([a-zA-Z0-9_-]+)(,\s*[a-zA-Z0-9_-]+)*(\s+(asc|desc))?$/.test(orderby)) {
72208
72210
  throw new Error('vespa:find - Invalid orderby parameter');
72209
72211
  }
72210
72212
  const orderbySecured = orderby === '' ? '' : `order by ${orderby}`;
72211
- const results = await this.searchDocuments(baseUrl, collection, `is_parent = true and userQuery() ${orderbySecured} limit ${parseInt(limit)}`, {
72213
+ const results = await this.searchDocuments(baseUrl, `${prefix}${collection}`, `is_parent = true and userQuery() ${orderbySecured} limit ${parseInt(limit)}`, {
72212
72214
  query
72213
72215
  });
72214
72216
  return results;
@@ -72216,13 +72218,15 @@ let VespaService = class VespaService {
72216
72218
  async search(params, _pinsSettingsList, context) {
72217
72219
  var _context_privates_VESPA_SERVER;
72218
72220
  const { embeddings = context.privates.MODEL_EMBEDDINGS, baseUrl = (_context_privates_VESPA_SERVER = context.privates.VESPA_SERVER) != null ? _context_privates_VESPA_SERVER : VESPA_SERVER, collection = 'knowledge', limit = 100, orderby = '', targetHits = 50, language = 'fr', filter = 'true', query } = params;
72221
+ var _context_privates_VESPA_PREFIX, _ref;
72222
+ const prefix = (_ref = (_context_privates_VESPA_PREFIX = context.privates.VESPA_PREFIX) != null ? _context_privates_VESPA_PREFIX : process.env['VESPA_PREFIX']) != null ? _ref : '';
72219
72223
  if (orderby !== '' && !/^([a-zA-Z0-9_-]+)(,\s*[a-zA-Z0-9_-]+)*(\s+(asc|desc))?$/.test(orderby)) {
72220
72224
  throw new Error('vespa:find - Invalid orderby parameter');
72221
72225
  }
72222
72226
  const orderbySecured = orderby === '' ? '' : `order by ${orderby}`;
72223
72227
  const modelEmbeddings = await executePinsList(embeddings, context);
72224
72228
  const queryEmbedding = await modelEmbeddings.embedQuery(query);
72225
- const results = await this.searchParentDocuments(baseUrl, collection, `((userQuery()) or ({targetHits:${targetHits}}nearestNeighbor(content_embedding,q))) and (${filter}) ${orderbySecured} limit ${parseInt(limit)}`, {
72229
+ const results = await this.searchParentDocuments(baseUrl, `${prefix}${collection}`, `((userQuery()) or ({targetHits:${targetHits}}nearestNeighbor(content_embedding,q))) and (${filter}) ${orderbySecured} limit ${parseInt(limit)}`, {
72226
72230
  'ranking.profile': 'fusion',
72227
72231
  'input.query(q)': queryEmbedding,
72228
72232
  query,
@@ -72248,12 +72252,16 @@ let VespaService = class VespaService {
72248
72252
  const { embeddings = context.privates.MODEL_EMBEDDINGS, baseUrl = (_context_privates_VESPA_SERVER = context.privates.VESPA_SERVER) != null ? _context_privates_VESPA_SERVER : VESPA_SERVER, collection = 'knowledge', documents } = params;
72249
72253
  const modelEmbeddings = await executePinsList(embeddings, context);
72250
72254
  const results = await this.prepareDocuments(documents);
72251
- return await this.pushDocuments(modelEmbeddings, baseUrl, collection, results);
72255
+ var _context_privates_VESPA_PREFIX, _ref;
72256
+ const prefix = (_ref = (_context_privates_VESPA_PREFIX = context.privates.VESPA_PREFIX) != null ? _context_privates_VESPA_PREFIX : process.env['VESPA_PREFIX']) != null ? _ref : '';
72257
+ return await this.pushDocuments(modelEmbeddings, baseUrl, `${prefix}${collection}`, results);
72252
72258
  }
72253
72259
  async remove(params, _pinsSettingsList, context) {
72254
72260
  var _context_privates_VESPA_SERVER;
72255
72261
  const { baseUrl = (_context_privates_VESPA_SERVER = context.privates.VESPA_SERVER) != null ? _context_privates_VESPA_SERVER : VESPA_SERVER, collection = 'knowledge', selection } = params;
72256
- const response = await fetch(`${baseUrl}/document/v1/Digipair_default/${collection}/docid?selection=${encodeURI(selection)}&cluster=Digipair_default`, {
72262
+ var _context_privates_VESPA_PREFIX, _ref;
72263
+ const prefix = (_ref = (_context_privates_VESPA_PREFIX = context.privates.VESPA_PREFIX) != null ? _context_privates_VESPA_PREFIX : process.env['VESPA_PREFIX']) != null ? _ref : '';
72264
+ const response = await fetch(`${baseUrl}/document/v1/Digipair_default/${prefix}${collection}/docid?selection=${encodeURI(selection)}&cluster=Digipair_default`, {
72257
72265
  method: 'DELETE',
72258
72266
  headers: {
72259
72267
  'Content-Type': 'application/json'
package/index.esm.js CHANGED
@@ -68100,14 +68100,14 @@ function indent(str, spaces) {
68100
68100
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
68101
68101
  // match is required
68102
68102
  if (!match) {
68103
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
68103
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
68104
68104
  v: nextMatch1
68105
68105
  };
68106
68106
  }
68107
68107
  var token = match.token, offset = match.offset;
68108
68108
  i1 += offset;
68109
68109
  if (token === " ") {
68110
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
68110
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
68111
68111
  }
68112
68112
  tokens1 = _to_consumable_array$1(tokens1).concat([
68113
68113
  token
@@ -68126,7 +68126,7 @@ function indent(str, spaces) {
68126
68126
  if (contextKeys.some(function(el) {
68127
68127
  return el.startsWith(name);
68128
68128
  })) {
68129
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
68129
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
68130
68130
  }
68131
68131
  if (dateTimeIdentifiers.some(function(el) {
68132
68132
  return el === name;
@@ -68145,9 +68145,9 @@ function indent(str, spaces) {
68145
68145
  if (dateTimeIdentifiers.some(function(el) {
68146
68146
  return el.startsWith(name);
68147
68147
  })) {
68148
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
68148
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
68149
68149
  }
68150
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
68150
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
68151
68151
  v: nextMatch1
68152
68152
  };
68153
68153
  };
@@ -72182,11 +72182,13 @@ let VespaService = class VespaService {
72182
72182
  async find(params, _pinsSettingsList, context) {
72183
72183
  var _context_privates_VESPA_SERVER;
72184
72184
  const { baseUrl = (_context_privates_VESPA_SERVER = context.privates.VESPA_SERVER) != null ? _context_privates_VESPA_SERVER : VESPA_SERVER, collection = 'knowledge', limit = 100, orderby = '', query } = params;
72185
+ var _context_privates_VESPA_PREFIX, _ref;
72186
+ const prefix = (_ref = (_context_privates_VESPA_PREFIX = context.privates.VESPA_PREFIX) != null ? _context_privates_VESPA_PREFIX : process.env['VESPA_PREFIX']) != null ? _ref : '';
72185
72187
  if (orderby !== '' && !/^([a-zA-Z0-9_-]+)(,\s*[a-zA-Z0-9_-]+)*(\s+(asc|desc))?$/.test(orderby)) {
72186
72188
  throw new Error('vespa:find - Invalid orderby parameter');
72187
72189
  }
72188
72190
  const orderbySecured = orderby === '' ? '' : `order by ${orderby}`;
72189
- const results = await this.searchDocuments(baseUrl, collection, `is_parent = true and userQuery() ${orderbySecured} limit ${parseInt(limit)}`, {
72191
+ const results = await this.searchDocuments(baseUrl, `${prefix}${collection}`, `is_parent = true and userQuery() ${orderbySecured} limit ${parseInt(limit)}`, {
72190
72192
  query
72191
72193
  });
72192
72194
  return results;
@@ -72194,13 +72196,15 @@ let VespaService = class VespaService {
72194
72196
  async search(params, _pinsSettingsList, context) {
72195
72197
  var _context_privates_VESPA_SERVER;
72196
72198
  const { embeddings = context.privates.MODEL_EMBEDDINGS, baseUrl = (_context_privates_VESPA_SERVER = context.privates.VESPA_SERVER) != null ? _context_privates_VESPA_SERVER : VESPA_SERVER, collection = 'knowledge', limit = 100, orderby = '', targetHits = 50, language = 'fr', filter = 'true', query } = params;
72199
+ var _context_privates_VESPA_PREFIX, _ref;
72200
+ const prefix = (_ref = (_context_privates_VESPA_PREFIX = context.privates.VESPA_PREFIX) != null ? _context_privates_VESPA_PREFIX : process.env['VESPA_PREFIX']) != null ? _ref : '';
72197
72201
  if (orderby !== '' && !/^([a-zA-Z0-9_-]+)(,\s*[a-zA-Z0-9_-]+)*(\s+(asc|desc))?$/.test(orderby)) {
72198
72202
  throw new Error('vespa:find - Invalid orderby parameter');
72199
72203
  }
72200
72204
  const orderbySecured = orderby === '' ? '' : `order by ${orderby}`;
72201
72205
  const modelEmbeddings = await executePinsList(embeddings, context);
72202
72206
  const queryEmbedding = await modelEmbeddings.embedQuery(query);
72203
- const results = await this.searchParentDocuments(baseUrl, collection, `((userQuery()) or ({targetHits:${targetHits}}nearestNeighbor(content_embedding,q))) and (${filter}) ${orderbySecured} limit ${parseInt(limit)}`, {
72207
+ const results = await this.searchParentDocuments(baseUrl, `${prefix}${collection}`, `((userQuery()) or ({targetHits:${targetHits}}nearestNeighbor(content_embedding,q))) and (${filter}) ${orderbySecured} limit ${parseInt(limit)}`, {
72204
72208
  'ranking.profile': 'fusion',
72205
72209
  'input.query(q)': queryEmbedding,
72206
72210
  query,
@@ -72226,12 +72230,16 @@ let VespaService = class VespaService {
72226
72230
  const { embeddings = context.privates.MODEL_EMBEDDINGS, baseUrl = (_context_privates_VESPA_SERVER = context.privates.VESPA_SERVER) != null ? _context_privates_VESPA_SERVER : VESPA_SERVER, collection = 'knowledge', documents } = params;
72227
72231
  const modelEmbeddings = await executePinsList(embeddings, context);
72228
72232
  const results = await this.prepareDocuments(documents);
72229
- return await this.pushDocuments(modelEmbeddings, baseUrl, collection, results);
72233
+ var _context_privates_VESPA_PREFIX, _ref;
72234
+ const prefix = (_ref = (_context_privates_VESPA_PREFIX = context.privates.VESPA_PREFIX) != null ? _context_privates_VESPA_PREFIX : process.env['VESPA_PREFIX']) != null ? _ref : '';
72235
+ return await this.pushDocuments(modelEmbeddings, baseUrl, `${prefix}${collection}`, results);
72230
72236
  }
72231
72237
  async remove(params, _pinsSettingsList, context) {
72232
72238
  var _context_privates_VESPA_SERVER;
72233
72239
  const { baseUrl = (_context_privates_VESPA_SERVER = context.privates.VESPA_SERVER) != null ? _context_privates_VESPA_SERVER : VESPA_SERVER, collection = 'knowledge', selection } = params;
72234
- const response = await fetch(`${baseUrl}/document/v1/Digipair_default/${collection}/docid?selection=${encodeURI(selection)}&cluster=Digipair_default`, {
72240
+ var _context_privates_VESPA_PREFIX, _ref;
72241
+ const prefix = (_ref = (_context_privates_VESPA_PREFIX = context.privates.VESPA_PREFIX) != null ? _context_privates_VESPA_PREFIX : process.env['VESPA_PREFIX']) != null ? _ref : '';
72242
+ const response = await fetch(`${baseUrl}/document/v1/Digipair_default/${prefix}${collection}/docid?selection=${encodeURI(selection)}&cluster=Digipair_default`, {
72235
72243
  method: 'DELETE',
72236
72244
  headers: {
72237
72245
  'Content-Type': 'application/json'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-vespa",
3
- "version": "0.19.4",
3
+ "version": "0.20.1",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"