@mastra/core 0.1.27-alpha.27 → 0.1.27-alpha.28

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.
@@ -15,6 +15,7 @@ var openai = require('@ai-sdk/openai');
15
15
  var xai = require('@ai-sdk/xai');
16
16
  var ai = require('ai');
17
17
  var anthropicVertexAi = require('anthropic-vertex-ai');
18
+ var voyageAiProvider = require('voyage-ai-provider');
18
19
  var redis = require('@upstash/redis');
19
20
  var fs = require('fs');
20
21
  var path = require('path');
@@ -1294,7 +1295,7 @@ var LLM = (_model = /*#__PURE__*/_classPrivateFieldLooseKey("model"), _tools$1 =
1294
1295
  };
1295
1296
  _proto.createEmbedding = /*#__PURE__*/function () {
1296
1297
  var _createEmbedding = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref4) {
1297
- var model, value, maxRetries, embeddingModel, openai$1, cohere$1;
1298
+ var model, value, maxRetries, embeddingModel, openai$1, cohere$1, amazon, google$1, mistral$1, voyage;
1298
1299
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1299
1300
  while (1) switch (_context.prev = _context.next) {
1300
1301
  case 0:
@@ -1307,7 +1308,7 @@ var LLM = (_model = /*#__PURE__*/_classPrivateFieldLooseKey("model"), _tools$1 =
1307
1308
  apiKey: process.env.OPENAI_API_KEY
1308
1309
  });
1309
1310
  embeddingModel = openai$1.embedding(model.name);
1310
- _context.next = 12;
1311
+ _context.next = 32;
1311
1312
  break;
1312
1313
  case 6:
1313
1314
  if (!(model.provider === 'COHERE')) {
@@ -1318,33 +1319,83 @@ var LLM = (_model = /*#__PURE__*/_classPrivateFieldLooseKey("model"), _tools$1 =
1318
1319
  apiKey: process.env.COHERE_API_KEY
1319
1320
  });
1320
1321
  embeddingModel = cohere$1.embedding(model.name);
1321
- _context.next = 12;
1322
+ _context.next = 32;
1322
1323
  break;
1323
1324
  case 11:
1325
+ if (!(model.provider === 'AMAZON')) {
1326
+ _context.next = 16;
1327
+ break;
1328
+ }
1329
+ amazon = amazonBedrock.createAmazonBedrock({
1330
+ region: process.env.AWS_REGION || '',
1331
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID || '',
1332
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || '',
1333
+ sessionToken: process.env.AWS_SESSION_TOKEN || ''
1334
+ });
1335
+ embeddingModel = amazon.embedding(model.name);
1336
+ _context.next = 32;
1337
+ break;
1338
+ case 16:
1339
+ if (!(model.provider === 'GOOGLE')) {
1340
+ _context.next = 21;
1341
+ break;
1342
+ }
1343
+ google$1 = google.createGoogleGenerativeAI({
1344
+ baseURL: 'https://generativelanguage.googleapis.com/v1beta',
1345
+ apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY || ''
1346
+ });
1347
+ embeddingModel = google$1.textEmbeddingModel(model.name);
1348
+ _context.next = 32;
1349
+ break;
1350
+ case 21:
1351
+ if (!(model.provider === 'MISTRAL')) {
1352
+ _context.next = 26;
1353
+ break;
1354
+ }
1355
+ mistral$1 = mistral.createMistral({
1356
+ baseURL: 'https://api.mistral.ai/v1',
1357
+ apiKey: process.env.MISTRAL_API_KEY || ''
1358
+ });
1359
+ embeddingModel = mistral$1.textEmbeddingModel(model.name);
1360
+ _context.next = 32;
1361
+ break;
1362
+ case 26:
1363
+ if (!(model.provider === 'VOYAGE')) {
1364
+ _context.next = 31;
1365
+ break;
1366
+ }
1367
+ voyage = voyageAiProvider.createVoyage({
1368
+ baseURL: 'https://api.voyageai.com/v1',
1369
+ apiKey: process.env.VOYAGE_API_KEY || ''
1370
+ });
1371
+ embeddingModel = voyage.textEmbeddingModel(model.name);
1372
+ _context.next = 32;
1373
+ break;
1374
+ case 31:
1324
1375
  throw new Error("Invalid embedding model");
1325
- case 12:
1376
+ case 32:
1326
1377
  if (!(value instanceof Array)) {
1327
- _context.next = 16;
1378
+ _context.next = 36;
1328
1379
  break;
1329
1380
  }
1330
- _context.next = 15;
1381
+ _context.next = 35;
1331
1382
  return ai.embedMany({
1332
1383
  model: embeddingModel,
1333
1384
  values: value,
1334
1385
  maxRetries: maxRetries
1335
1386
  });
1336
- case 15:
1387
+ case 35:
1337
1388
  return _context.abrupt("return", _context.sent);
1338
- case 16:
1339
- _context.next = 18;
1389
+ case 36:
1390
+ _context.next = 38;
1340
1391
  return ai.embed({
1341
1392
  model: embeddingModel,
1342
1393
  value: value,
1343
1394
  maxRetries: maxRetries
1344
1395
  });
1345
- case 18:
1396
+ case 38:
1346
1397
  return _context.abrupt("return", _context.sent);
1347
- case 19:
1398
+ case 39:
1348
1399
  case "end":
1349
1400
  return _context.stop();
1350
1401
  }