@mastra/core 1.18.0-alpha.4 → 1.18.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/CHANGELOG.md +229 -0
- package/dist/_types/@internal_core/dist/index.d.ts +502 -29
- package/dist/agent/agent-legacy.d.ts +2 -0
- package/dist/agent/agent-legacy.d.ts.map +1 -1
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +8 -8
- package/dist/agent/index.js +1 -1
- package/dist/{chunk-2RGBP3A3.cjs → chunk-2H53MD2U.cjs} +68 -68
- package/dist/{chunk-2RGBP3A3.cjs.map → chunk-2H53MD2U.cjs.map} +1 -1
- package/dist/{chunk-CEWIMGYP.js → chunk-2M3HWTRI.js} +4 -4
- package/dist/{chunk-CEWIMGYP.js.map → chunk-2M3HWTRI.js.map} +1 -1
- package/dist/{chunk-UZ426KMJ.cjs → chunk-4BZRWJBH.cjs} +32 -32
- package/dist/{chunk-UZ426KMJ.cjs.map → chunk-4BZRWJBH.cjs.map} +1 -1
- package/dist/{chunk-LQHNR4L7.js → chunk-4FMKWOPC.js} +3 -3
- package/dist/{chunk-LQHNR4L7.js.map → chunk-4FMKWOPC.js.map} +1 -1
- package/dist/{chunk-WINCOFML.js → chunk-6Z4GSLLO.js} +3 -3
- package/dist/{chunk-WINCOFML.js.map → chunk-6Z4GSLLO.js.map} +1 -1
- package/dist/{chunk-JYVH24UY.js → chunk-7GLVV6CZ.js} +5 -5
- package/dist/{chunk-JYVH24UY.js.map → chunk-7GLVV6CZ.js.map} +1 -1
- package/dist/{chunk-VYVPUH6H.cjs → chunk-BF7IH4JU.cjs} +189 -35
- package/dist/chunk-BF7IH4JU.cjs.map +1 -0
- package/dist/{chunk-GIBIKVUG.js → chunk-EKFG6JWW.js} +7 -7
- package/dist/{chunk-GIBIKVUG.js.map → chunk-EKFG6JWW.js.map} +1 -1
- package/dist/{chunk-F77BL7Z7.js → chunk-GJ62FP5X.js} +4 -4
- package/dist/{chunk-F77BL7Z7.js.map → chunk-GJ62FP5X.js.map} +1 -1
- package/dist/{chunk-ULPWI6DN.cjs → chunk-GJIN53S6.cjs} +9 -9
- package/dist/{chunk-ULPWI6DN.cjs.map → chunk-GJIN53S6.cjs.map} +1 -1
- package/dist/{chunk-HJVPOP5S.js → chunk-I4ZSA3XJ.js} +4 -4
- package/dist/{chunk-HJVPOP5S.js.map → chunk-I4ZSA3XJ.js.map} +1 -1
- package/dist/{chunk-2OZQLYLM.cjs → chunk-J47RNLSY.cjs} +176 -173
- package/dist/chunk-J47RNLSY.cjs.map +1 -0
- package/dist/{chunk-DJ2RXLO3.js → chunk-K7AE4BHR.js} +4 -4
- package/dist/{chunk-DJ2RXLO3.js.map → chunk-K7AE4BHR.js.map} +1 -1
- package/dist/{chunk-RIUDLIP3.cjs → chunk-KLVNQDUR.cjs} +3 -3
- package/dist/chunk-KLVNQDUR.cjs.map +1 -0
- package/dist/{chunk-SMWXSQXP.cjs → chunk-KOTSKPTF.cjs} +19 -19
- package/dist/{chunk-SMWXSQXP.cjs.map → chunk-KOTSKPTF.cjs.map} +1 -1
- package/dist/{chunk-QE7OKYS3.js → chunk-KRFGPA2H.js} +174 -36
- package/dist/chunk-KRFGPA2H.js.map +1 -0
- package/dist/{chunk-5M3CKUAS.cjs → chunk-L3X22YTN.cjs} +185 -185
- package/dist/{chunk-5M3CKUAS.cjs.map → chunk-L3X22YTN.cjs.map} +1 -1
- package/dist/{chunk-OJQCLQK7.cjs → chunk-LKZQG2ZZ.cjs} +13 -13
- package/dist/{chunk-OJQCLQK7.cjs.map → chunk-LKZQG2ZZ.cjs.map} +1 -1
- package/dist/{chunk-ERAZTMF6.js → chunk-MJF7NZEF.js} +437 -8
- package/dist/chunk-MJF7NZEF.js.map +1 -0
- package/dist/{chunk-RHQHBU6R.js → chunk-PMWMEK4T.js} +3 -3
- package/dist/{chunk-RHQHBU6R.js.map → chunk-PMWMEK4T.js.map} +1 -1
- package/dist/{chunk-IKYWIQB2.cjs → chunk-PWFPYJGG.cjs} +20 -20
- package/dist/{chunk-IKYWIQB2.cjs.map → chunk-PWFPYJGG.cjs.map} +1 -1
- package/dist/{chunk-B5LIMU4I.js → chunk-RTBZOGTO.js} +3 -3
- package/dist/{chunk-B5LIMU4I.js.map → chunk-RTBZOGTO.js.map} +1 -1
- package/dist/{chunk-E7LJ7F56.cjs → chunk-RTXCZT3M.cjs} +5 -5
- package/dist/{chunk-E7LJ7F56.cjs.map → chunk-RTXCZT3M.cjs.map} +1 -1
- package/dist/{chunk-4QLIPOI7.cjs → chunk-TVZCMQTV.cjs} +82 -82
- package/dist/{chunk-4QLIPOI7.cjs.map → chunk-TVZCMQTV.cjs.map} +1 -1
- package/dist/{chunk-QOFOOVPM.js → chunk-UPBMT3QM.js} +9 -9
- package/dist/{chunk-QOFOOVPM.js.map → chunk-UPBMT3QM.js.map} +1 -1
- package/dist/{chunk-CGDV5YUS.cjs → chunk-V2NQOABM.cjs} +455 -26
- package/dist/chunk-V2NQOABM.cjs.map +1 -0
- package/dist/{chunk-Z5FE6LBA.js → chunk-XOBRMYFA.js} +3 -3
- package/dist/chunk-XOBRMYFA.js.map +1 -0
- package/dist/{chunk-6DDSP6ZE.js → chunk-XQN3BKCI.js} +5 -5
- package/dist/{chunk-6DDSP6ZE.js.map → chunk-XQN3BKCI.js.map} +1 -1
- package/dist/{chunk-ATKRXBCX.cjs → chunk-XQRTJIC7.cjs} +9 -9
- package/dist/{chunk-ATKRXBCX.cjs.map → chunk-XQRTJIC7.cjs.map} +1 -1
- package/dist/{chunk-A2FSD2KN.cjs → chunk-ZQE2VUYD.cjs} +7 -7
- package/dist/{chunk-A2FSD2KN.cjs.map → chunk-ZQE2VUYD.cjs.map} +1 -1
- package/dist/{chunk-T3TFXXGP.js → chunk-ZRLAR66M.js} +12 -9
- package/dist/chunk-ZRLAR66M.js.map +1 -0
- package/dist/{chunk-4LDFFARO.cjs → chunk-ZVGS2O2W.cjs} +6 -6
- package/dist/{chunk-4LDFFARO.cjs.map → chunk-ZVGS2O2W.cjs.map} +1 -1
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +560 -496
- package/dist/evals/index.cjs +23 -23
- package/dist/evals/index.js +3 -3
- package/dist/evals/scoreTraces/index.cjs +7 -7
- package/dist/evals/scoreTraces/index.js +3 -3
- package/dist/harness/index.cjs +7 -7
- package/dist/harness/index.js +5 -5
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/llm/index.cjs +16 -16
- package/dist/llm/index.js +5 -5
- package/dist/loop/index.cjs +14 -14
- package/dist/loop/index.js +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +14 -14
- package/dist/memory/index.js +1 -1
- package/dist/models-dev-5WY37RVC.cjs +12 -0
- package/dist/{models-dev-THY3NOPF.cjs.map → models-dev-5WY37RVC.cjs.map} +1 -1
- package/dist/models-dev-Y2UFJEOO.js +3 -0
- package/dist/{models-dev-JGKQCSEN.js.map → models-dev-Y2UFJEOO.js.map} +1 -1
- package/dist/netlify-ADZQ5ZNY.cjs +12 -0
- package/dist/{netlify-NL6O2R7M.cjs.map → netlify-ADZQ5ZNY.cjs.map} +1 -1
- package/dist/netlify-I4AUVRO2.js +3 -0
- package/dist/{netlify-6TILQFDV.js.map → netlify-I4AUVRO2.js.map} +1 -1
- package/dist/observability/index.cjs +18 -18
- package/dist/observability/index.js +1 -1
- package/dist/observability/types/tracing.d.ts +2 -0
- package/dist/observability/types/tracing.d.ts.map +1 -1
- package/dist/processor-provider/index.cjs +10 -10
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +44 -44
- package/dist/processors/index.js +1 -1
- package/dist/provider-registry-C7SZ5ZT4.js +3 -0
- package/dist/{provider-registry-CRD5YYZY.js.map → provider-registry-C7SZ5ZT4.js.map} +1 -1
- package/dist/provider-registry-I5RW3MEE.cjs +40 -0
- package/dist/{provider-registry-KXOHTVQF.cjs.map → provider-registry-I5RW3MEE.cjs.map} +1 -1
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/storage/constants.cjs +56 -56
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/observability/base.d.ts +10 -2
- package/dist/storage/domains/observability/base.d.ts.map +1 -1
- package/dist/storage/domains/observability/feedback.d.ts +1 -1
- package/dist/storage/domains/observability/feedback.d.ts.map +1 -1
- package/dist/storage/domains/observability/inmemory.d.ts +13 -2
- package/dist/storage/domains/observability/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/observability/scores.d.ts +1 -1
- package/dist/storage/domains/observability/scores.d.ts.map +1 -1
- package/dist/storage/index.cjs +334 -270
- package/dist/storage/index.js +3 -3
- package/dist/stream/index.cjs +8 -8
- package/dist/stream/index.js +1 -1
- package/dist/test-utils/llm-mock.cjs +4 -4
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/utils.cjs +23 -23
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +7 -7
- package/dist/vector/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +24 -24
- package/dist/workflows/index.js +1 -1
- package/package.json +9 -9
- package/dist/chunk-2OZQLYLM.cjs.map +0 -1
- package/dist/chunk-CGDV5YUS.cjs.map +0 -1
- package/dist/chunk-ERAZTMF6.js.map +0 -1
- package/dist/chunk-QE7OKYS3.js.map +0 -1
- package/dist/chunk-RIUDLIP3.cjs.map +0 -1
- package/dist/chunk-T3TFXXGP.js.map +0 -1
- package/dist/chunk-VYVPUH6H.cjs.map +0 -1
- package/dist/chunk-Z5FE6LBA.js.map +0 -1
- package/dist/models-dev-JGKQCSEN.js +0 -3
- package/dist/models-dev-THY3NOPF.cjs +0 -12
- package/dist/netlify-6TILQFDV.js +0 -3
- package/dist/netlify-NL6O2R7M.cjs +0 -12
- package/dist/provider-registry-CRD5YYZY.js +0 -3
- package/dist/provider-registry-KXOHTVQF.cjs +0 -40
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
3
|
+
var chunkL3X22YTN_cjs = require('./chunk-L3X22YTN.cjs');
|
|
4
|
+
var chunkGJIN53S6_cjs = require('./chunk-GJIN53S6.cjs');
|
|
5
|
+
var chunkKLVNQDUR_cjs = require('./chunk-KLVNQDUR.cjs');
|
|
6
|
+
var chunkRTXCZT3M_cjs = require('./chunk-RTXCZT3M.cjs');
|
|
7
|
+
var chunkLKZQG2ZZ_cjs = require('./chunk-LKZQG2ZZ.cjs');
|
|
8
8
|
var chunk2VD5OGOT_cjs = require('./chunk-2VD5OGOT.cjs');
|
|
9
9
|
var chunk5WBEMKE2_cjs = require('./chunk-5WBEMKE2.cjs');
|
|
10
10
|
var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
|
|
@@ -90,7 +90,7 @@ var AISDKV6LanguageModel = class {
|
|
|
90
90
|
return {
|
|
91
91
|
request: result.request,
|
|
92
92
|
response: result.response,
|
|
93
|
-
stream:
|
|
93
|
+
stream: chunkLKZQG2ZZ_cjs.createStreamFromGenerateResult(result)
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
async doStream(options) {
|
|
@@ -104,7 +104,7 @@ chunkBVWXTWXP_cjs.__export(dist_exports, {
|
|
|
104
104
|
DEFAULT_MAX_DOWNLOAD_SIZE: () => DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
105
105
|
DelayedPromise: () => DelayedPromise,
|
|
106
106
|
DownloadError: () => DownloadError,
|
|
107
|
-
EventSourceParserStream: () =>
|
|
107
|
+
EventSourceParserStream: () => chunkKLVNQDUR_cjs.EventSourceParserStream,
|
|
108
108
|
VERSION: () => VERSION,
|
|
109
109
|
asSchema: () => asSchema,
|
|
110
110
|
asValidator: () => asValidator,
|
|
@@ -290,7 +290,7 @@ var marker = `vercel.ai.error.${name}`;
|
|
|
290
290
|
var symbol = Symbol.for(marker);
|
|
291
291
|
var _a;
|
|
292
292
|
var _b;
|
|
293
|
-
var DownloadError = class extends (_b =
|
|
293
|
+
var DownloadError = class extends (_b = chunkKLVNQDUR_cjs.AISDKError, _a = symbol, _b) {
|
|
294
294
|
constructor({
|
|
295
295
|
url,
|
|
296
296
|
statusCode,
|
|
@@ -305,7 +305,7 @@ var DownloadError = class extends (_b = chunkRIUDLIP3_cjs.AISDKError, _a = symbo
|
|
|
305
305
|
this.statusText = statusText;
|
|
306
306
|
}
|
|
307
307
|
static isInstance(error) {
|
|
308
|
-
return
|
|
308
|
+
return chunkKLVNQDUR_cjs.AISDKError.hasMarker(error, marker);
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
311
|
var DEFAULT_MAX_DOWNLOAD_SIZE = 2 * 1024 * 1024 * 1024;
|
|
@@ -379,7 +379,7 @@ var createIdGenerator = ({
|
|
|
379
379
|
return generator;
|
|
380
380
|
}
|
|
381
381
|
if (alphabet.includes(separator)) {
|
|
382
|
-
throw new
|
|
382
|
+
throw new chunkKLVNQDUR_cjs.InvalidArgumentError({
|
|
383
383
|
argument: "separator",
|
|
384
384
|
message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
|
|
385
385
|
});
|
|
@@ -415,7 +415,7 @@ function handleFetchError({
|
|
|
415
415
|
if (error instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES.includes(error.message.toLowerCase())) {
|
|
416
416
|
const cause = error.cause;
|
|
417
417
|
if (cause != null) {
|
|
418
|
-
return new
|
|
418
|
+
return new chunkKLVNQDUR_cjs.APICallError({
|
|
419
419
|
message: `Cannot connect to API: ${cause.message}`,
|
|
420
420
|
cause,
|
|
421
421
|
url,
|
|
@@ -503,10 +503,10 @@ var getFromApi = async ({
|
|
|
503
503
|
requestBodyValues: {}
|
|
504
504
|
});
|
|
505
505
|
} catch (error) {
|
|
506
|
-
if (isAbortError(error) ||
|
|
506
|
+
if (isAbortError(error) || chunkKLVNQDUR_cjs.APICallError.isInstance(error)) {
|
|
507
507
|
throw error;
|
|
508
508
|
}
|
|
509
|
-
throw new
|
|
509
|
+
throw new chunkKLVNQDUR_cjs.APICallError({
|
|
510
510
|
message: "Failed to process error response",
|
|
511
511
|
cause: error,
|
|
512
512
|
statusCode: response.status,
|
|
@@ -525,11 +525,11 @@ var getFromApi = async ({
|
|
|
525
525
|
});
|
|
526
526
|
} catch (error) {
|
|
527
527
|
if (error instanceof Error) {
|
|
528
|
-
if (isAbortError(error) ||
|
|
528
|
+
if (isAbortError(error) || chunkKLVNQDUR_cjs.APICallError.isInstance(error)) {
|
|
529
529
|
throw error;
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
|
-
throw new
|
|
532
|
+
throw new chunkKLVNQDUR_cjs.APICallError({
|
|
533
533
|
message: "Failed to process successful response",
|
|
534
534
|
cause: error,
|
|
535
535
|
statusCode: response.status,
|
|
@@ -601,23 +601,23 @@ function loadApiKey({
|
|
|
601
601
|
return apiKey;
|
|
602
602
|
}
|
|
603
603
|
if (apiKey != null) {
|
|
604
|
-
throw new
|
|
604
|
+
throw new chunkKLVNQDUR_cjs.LoadAPIKeyError({
|
|
605
605
|
message: `${description} API key must be a string.`
|
|
606
606
|
});
|
|
607
607
|
}
|
|
608
608
|
if (typeof process === "undefined") {
|
|
609
|
-
throw new
|
|
609
|
+
throw new chunkKLVNQDUR_cjs.LoadAPIKeyError({
|
|
610
610
|
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter. Environment variables is not supported in this environment.`
|
|
611
611
|
});
|
|
612
612
|
}
|
|
613
613
|
apiKey = process.env[environmentVariableName];
|
|
614
614
|
if (apiKey == null) {
|
|
615
|
-
throw new
|
|
615
|
+
throw new chunkKLVNQDUR_cjs.LoadAPIKeyError({
|
|
616
616
|
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter or the ${environmentVariableName} environment variable.`
|
|
617
617
|
});
|
|
618
618
|
}
|
|
619
619
|
if (typeof apiKey !== "string") {
|
|
620
|
-
throw new
|
|
620
|
+
throw new chunkKLVNQDUR_cjs.LoadAPIKeyError({
|
|
621
621
|
message: `${description} API key must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
|
|
622
622
|
});
|
|
623
623
|
}
|
|
@@ -649,23 +649,23 @@ function loadSetting({
|
|
|
649
649
|
return settingValue;
|
|
650
650
|
}
|
|
651
651
|
if (settingValue != null) {
|
|
652
|
-
throw new
|
|
652
|
+
throw new chunkKLVNQDUR_cjs.LoadSettingError({
|
|
653
653
|
message: `${description} setting must be a string.`
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
656
|
if (typeof process === "undefined") {
|
|
657
|
-
throw new
|
|
657
|
+
throw new chunkKLVNQDUR_cjs.LoadSettingError({
|
|
658
658
|
message: `${description} setting is missing. Pass it using the '${settingName}' parameter. Environment variables is not supported in this environment.`
|
|
659
659
|
});
|
|
660
660
|
}
|
|
661
661
|
settingValue = process.env[environmentVariableName];
|
|
662
662
|
if (settingValue == null) {
|
|
663
|
-
throw new
|
|
663
|
+
throw new chunkKLVNQDUR_cjs.LoadSettingError({
|
|
664
664
|
message: `${description} setting is missing. Pass it using the '${settingName}' parameter or the ${environmentVariableName} environment variable.`
|
|
665
665
|
});
|
|
666
666
|
}
|
|
667
667
|
if (typeof settingValue !== "string") {
|
|
668
|
-
throw new
|
|
668
|
+
throw new chunkKLVNQDUR_cjs.LoadSettingError({
|
|
669
669
|
message: `${description} setting must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
|
|
670
670
|
});
|
|
671
671
|
}
|
|
@@ -753,7 +753,7 @@ function standardSchemaValidator(standardSchema) {
|
|
|
753
753
|
const result = await standardSchema["~standard"].validate(value);
|
|
754
754
|
return result.issues == null ? { success: true, value: result.value } : {
|
|
755
755
|
success: false,
|
|
756
|
-
error: new
|
|
756
|
+
error: new chunkKLVNQDUR_cjs.TypeValidationError({
|
|
757
757
|
value,
|
|
758
758
|
cause: result.issues
|
|
759
759
|
})
|
|
@@ -766,7 +766,7 @@ async function validateTypes({
|
|
|
766
766
|
}) {
|
|
767
767
|
const result = await safeValidateTypes({ value, schema });
|
|
768
768
|
if (!result.success) {
|
|
769
|
-
throw
|
|
769
|
+
throw chunkKLVNQDUR_cjs.TypeValidationError.wrap({ value, cause: result.error });
|
|
770
770
|
}
|
|
771
771
|
return result.value;
|
|
772
772
|
}
|
|
@@ -785,13 +785,13 @@ async function safeValidateTypes({
|
|
|
785
785
|
}
|
|
786
786
|
return {
|
|
787
787
|
success: false,
|
|
788
|
-
error:
|
|
788
|
+
error: chunkKLVNQDUR_cjs.TypeValidationError.wrap({ value, cause: result.error }),
|
|
789
789
|
rawValue: value
|
|
790
790
|
};
|
|
791
791
|
} catch (error) {
|
|
792
792
|
return {
|
|
793
793
|
success: false,
|
|
794
|
-
error:
|
|
794
|
+
error: chunkKLVNQDUR_cjs.TypeValidationError.wrap({ value, cause: error }),
|
|
795
795
|
rawValue: value
|
|
796
796
|
};
|
|
797
797
|
}
|
|
@@ -807,10 +807,10 @@ async function parseJSON({
|
|
|
807
807
|
}
|
|
808
808
|
return validateTypes({ value, schema });
|
|
809
809
|
} catch (error) {
|
|
810
|
-
if (
|
|
810
|
+
if (chunkKLVNQDUR_cjs.JSONParseError.isInstance(error) || chunkKLVNQDUR_cjs.TypeValidationError.isInstance(error)) {
|
|
811
811
|
throw error;
|
|
812
812
|
}
|
|
813
|
-
throw new
|
|
813
|
+
throw new chunkKLVNQDUR_cjs.JSONParseError({ text, cause: error });
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
816
|
async function safeParseJSON({
|
|
@@ -826,7 +826,7 @@ async function safeParseJSON({
|
|
|
826
826
|
} catch (error) {
|
|
827
827
|
return {
|
|
828
828
|
success: false,
|
|
829
|
-
error:
|
|
829
|
+
error: chunkKLVNQDUR_cjs.JSONParseError.isInstance(error) ? error : new chunkKLVNQDUR_cjs.JSONParseError({ text, cause: error }),
|
|
830
830
|
rawValue: void 0
|
|
831
831
|
};
|
|
832
832
|
}
|
|
@@ -843,7 +843,7 @@ function parseJsonEventStream({
|
|
|
843
843
|
stream,
|
|
844
844
|
schema
|
|
845
845
|
}) {
|
|
846
|
-
return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new
|
|
846
|
+
return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new chunkKLVNQDUR_cjs.EventSourceParserStream()).pipeThrough(
|
|
847
847
|
new TransformStream({
|
|
848
848
|
async transform({ data }, controller) {
|
|
849
849
|
if (data === "[DONE]") {
|
|
@@ -867,7 +867,7 @@ async function parseProviderOptions({
|
|
|
867
867
|
schema
|
|
868
868
|
});
|
|
869
869
|
if (!parsedProviderOptions.success) {
|
|
870
|
-
throw new
|
|
870
|
+
throw new chunkKLVNQDUR_cjs.InvalidArgumentError({
|
|
871
871
|
argument: "providerOptions",
|
|
872
872
|
message: `invalid ${provider} provider options`,
|
|
873
873
|
cause: parsedProviderOptions.error
|
|
@@ -949,10 +949,10 @@ var postToApi = async ({
|
|
|
949
949
|
requestBodyValues: body.values
|
|
950
950
|
});
|
|
951
951
|
} catch (error) {
|
|
952
|
-
if (isAbortError(error) ||
|
|
952
|
+
if (isAbortError(error) || chunkKLVNQDUR_cjs.APICallError.isInstance(error)) {
|
|
953
953
|
throw error;
|
|
954
954
|
}
|
|
955
|
-
throw new
|
|
955
|
+
throw new chunkKLVNQDUR_cjs.APICallError({
|
|
956
956
|
message: "Failed to process error response",
|
|
957
957
|
cause: error,
|
|
958
958
|
statusCode: response.status,
|
|
@@ -971,11 +971,11 @@ var postToApi = async ({
|
|
|
971
971
|
});
|
|
972
972
|
} catch (error) {
|
|
973
973
|
if (error instanceof Error) {
|
|
974
|
-
if (isAbortError(error) ||
|
|
974
|
+
if (isAbortError(error) || chunkKLVNQDUR_cjs.APICallError.isInstance(error)) {
|
|
975
975
|
throw error;
|
|
976
976
|
}
|
|
977
977
|
}
|
|
978
|
-
throw new
|
|
978
|
+
throw new chunkKLVNQDUR_cjs.APICallError({
|
|
979
979
|
message: "Failed to process successful response",
|
|
980
980
|
cause: error,
|
|
981
981
|
statusCode: response.status,
|
|
@@ -1069,7 +1069,7 @@ var createJsonErrorResponseHandler = ({
|
|
|
1069
1069
|
if (responseBody.trim() === "") {
|
|
1070
1070
|
return {
|
|
1071
1071
|
responseHeaders,
|
|
1072
|
-
value: new
|
|
1072
|
+
value: new chunkKLVNQDUR_cjs.APICallError({
|
|
1073
1073
|
message: response.statusText,
|
|
1074
1074
|
url,
|
|
1075
1075
|
requestBodyValues,
|
|
@@ -1087,7 +1087,7 @@ var createJsonErrorResponseHandler = ({
|
|
|
1087
1087
|
});
|
|
1088
1088
|
return {
|
|
1089
1089
|
responseHeaders,
|
|
1090
|
-
value: new
|
|
1090
|
+
value: new chunkKLVNQDUR_cjs.APICallError({
|
|
1091
1091
|
message: errorToMessage(parsedError),
|
|
1092
1092
|
url,
|
|
1093
1093
|
requestBodyValues,
|
|
@@ -1101,7 +1101,7 @@ var createJsonErrorResponseHandler = ({
|
|
|
1101
1101
|
} catch (parseError) {
|
|
1102
1102
|
return {
|
|
1103
1103
|
responseHeaders,
|
|
1104
|
-
value: new
|
|
1104
|
+
value: new chunkKLVNQDUR_cjs.APICallError({
|
|
1105
1105
|
message: response.statusText,
|
|
1106
1106
|
url,
|
|
1107
1107
|
requestBodyValues,
|
|
@@ -1116,7 +1116,7 @@ var createJsonErrorResponseHandler = ({
|
|
|
1116
1116
|
var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) => {
|
|
1117
1117
|
const responseHeaders = extractResponseHeaders(response);
|
|
1118
1118
|
if (response.body == null) {
|
|
1119
|
-
throw new
|
|
1119
|
+
throw new chunkKLVNQDUR_cjs.EmptyResponseBodyError({});
|
|
1120
1120
|
}
|
|
1121
1121
|
return {
|
|
1122
1122
|
responseHeaders,
|
|
@@ -1129,7 +1129,7 @@ var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) =>
|
|
|
1129
1129
|
var createJsonStreamResponseHandler = (chunkSchema) => async ({ response }) => {
|
|
1130
1130
|
const responseHeaders = extractResponseHeaders(response);
|
|
1131
1131
|
if (response.body == null) {
|
|
1132
|
-
throw new
|
|
1132
|
+
throw new chunkKLVNQDUR_cjs.EmptyResponseBodyError({});
|
|
1133
1133
|
}
|
|
1134
1134
|
let buffer = "";
|
|
1135
1135
|
return {
|
|
@@ -1161,7 +1161,7 @@ var createJsonResponseHandler = (responseSchema) => async ({ response, url, requ
|
|
|
1161
1161
|
});
|
|
1162
1162
|
const responseHeaders = extractResponseHeaders(response);
|
|
1163
1163
|
if (!parsedResult.success) {
|
|
1164
|
-
throw new
|
|
1164
|
+
throw new chunkKLVNQDUR_cjs.APICallError({
|
|
1165
1165
|
message: "Invalid JSON response",
|
|
1166
1166
|
cause: parsedResult.error,
|
|
1167
1167
|
statusCode: response.status,
|
|
@@ -1180,7 +1180,7 @@ var createJsonResponseHandler = (responseSchema) => async ({ response, url, requ
|
|
|
1180
1180
|
var createBinaryResponseHandler = () => async ({ response, url, requestBodyValues }) => {
|
|
1181
1181
|
const responseHeaders = extractResponseHeaders(response);
|
|
1182
1182
|
if (!response.body) {
|
|
1183
|
-
throw new
|
|
1183
|
+
throw new chunkKLVNQDUR_cjs.APICallError({
|
|
1184
1184
|
message: "Response body is empty",
|
|
1185
1185
|
url,
|
|
1186
1186
|
requestBodyValues,
|
|
@@ -1196,7 +1196,7 @@ var createBinaryResponseHandler = () => async ({ response, url, requestBodyValue
|
|
|
1196
1196
|
value: new Uint8Array(buffer)
|
|
1197
1197
|
};
|
|
1198
1198
|
} catch (error) {
|
|
1199
|
-
throw new
|
|
1199
|
+
throw new chunkKLVNQDUR_cjs.APICallError({
|
|
1200
1200
|
message: "Failed to read response as array buffer",
|
|
1201
1201
|
url,
|
|
1202
1202
|
requestBodyValues,
|
|
@@ -1212,7 +1212,7 @@ var createStatusCodeErrorResponseHandler = () => async ({ response, url, request
|
|
|
1212
1212
|
const responseBody = await response.text();
|
|
1213
1213
|
return {
|
|
1214
1214
|
responseHeaders,
|
|
1215
|
-
value: new
|
|
1215
|
+
value: new chunkKLVNQDUR_cjs.APICallError({
|
|
1216
1216
|
message: response.statusText,
|
|
1217
1217
|
url,
|
|
1218
1218
|
requestBodyValues,
|
|
@@ -2634,7 +2634,7 @@ function convertToOpenAIChatMessages({
|
|
|
2634
2634
|
};
|
|
2635
2635
|
} else if (part.mediaType.startsWith("audio/")) {
|
|
2636
2636
|
if (part.data instanceof URL) {
|
|
2637
|
-
throw new
|
|
2637
|
+
throw new chunkKLVNQDUR_cjs.UnsupportedFunctionalityError({
|
|
2638
2638
|
functionality: "audio file parts with URLs"
|
|
2639
2639
|
});
|
|
2640
2640
|
}
|
|
@@ -2659,14 +2659,14 @@ function convertToOpenAIChatMessages({
|
|
|
2659
2659
|
};
|
|
2660
2660
|
}
|
|
2661
2661
|
default: {
|
|
2662
|
-
throw new
|
|
2662
|
+
throw new chunkKLVNQDUR_cjs.UnsupportedFunctionalityError({
|
|
2663
2663
|
functionality: `audio content parts with media type ${part.mediaType}`
|
|
2664
2664
|
});
|
|
2665
2665
|
}
|
|
2666
2666
|
}
|
|
2667
2667
|
} else if (part.mediaType === "application/pdf") {
|
|
2668
2668
|
if (part.data instanceof URL) {
|
|
2669
|
-
throw new
|
|
2669
|
+
throw new chunkKLVNQDUR_cjs.UnsupportedFunctionalityError({
|
|
2670
2670
|
functionality: "PDF file parts with URLs"
|
|
2671
2671
|
});
|
|
2672
2672
|
}
|
|
@@ -2678,7 +2678,7 @@ function convertToOpenAIChatMessages({
|
|
|
2678
2678
|
}
|
|
2679
2679
|
};
|
|
2680
2680
|
} else {
|
|
2681
|
-
throw new
|
|
2681
|
+
throw new chunkKLVNQDUR_cjs.UnsupportedFunctionalityError({
|
|
2682
2682
|
functionality: `file part media type ${part.mediaType}`
|
|
2683
2683
|
});
|
|
2684
2684
|
}
|
|
@@ -3066,7 +3066,7 @@ function prepareChatTools({
|
|
|
3066
3066
|
};
|
|
3067
3067
|
default: {
|
|
3068
3068
|
const _exhaustiveCheck = type;
|
|
3069
|
-
throw new
|
|
3069
|
+
throw new chunkKLVNQDUR_cjs.UnsupportedFunctionalityError({
|
|
3070
3070
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
3071
3071
|
});
|
|
3072
3072
|
}
|
|
@@ -3458,19 +3458,19 @@ var OpenAIChatLanguageModel = class {
|
|
|
3458
3458
|
const index = toolCallDelta.index;
|
|
3459
3459
|
if (toolCalls[index] == null) {
|
|
3460
3460
|
if (toolCallDelta.type != null && toolCallDelta.type !== "function") {
|
|
3461
|
-
throw new
|
|
3461
|
+
throw new chunkKLVNQDUR_cjs.InvalidResponseDataError({
|
|
3462
3462
|
data: toolCallDelta,
|
|
3463
3463
|
message: `Expected 'function' type.`
|
|
3464
3464
|
});
|
|
3465
3465
|
}
|
|
3466
3466
|
if (toolCallDelta.id == null) {
|
|
3467
|
-
throw new
|
|
3467
|
+
throw new chunkKLVNQDUR_cjs.InvalidResponseDataError({
|
|
3468
3468
|
data: toolCallDelta,
|
|
3469
3469
|
message: `Expected 'id' to be a string.`
|
|
3470
3470
|
});
|
|
3471
3471
|
}
|
|
3472
3472
|
if (((_m = toolCallDelta.function) == null ? void 0 : _m.name) == null) {
|
|
3473
|
-
throw new
|
|
3473
|
+
throw new chunkKLVNQDUR_cjs.InvalidResponseDataError({
|
|
3474
3474
|
data: toolCallDelta,
|
|
3475
3475
|
message: `Expected 'function.name' to be a string.`
|
|
3476
3476
|
});
|
|
@@ -3586,7 +3586,7 @@ function convertToOpenAICompletionPrompt({
|
|
|
3586
3586
|
for (const { role, content } of prompt) {
|
|
3587
3587
|
switch (role) {
|
|
3588
3588
|
case "system": {
|
|
3589
|
-
throw new
|
|
3589
|
+
throw new chunkKLVNQDUR_cjs.InvalidPromptError({
|
|
3590
3590
|
message: "Unexpected system message in prompt: ${content}",
|
|
3591
3591
|
prompt
|
|
3592
3592
|
});
|
|
@@ -3612,7 +3612,7 @@ ${userMessage}
|
|
|
3612
3612
|
return part.text;
|
|
3613
3613
|
}
|
|
3614
3614
|
case "tool-call": {
|
|
3615
|
-
throw new
|
|
3615
|
+
throw new chunkKLVNQDUR_cjs.UnsupportedFunctionalityError({
|
|
3616
3616
|
functionality: "tool-call messages"
|
|
3617
3617
|
});
|
|
3618
3618
|
}
|
|
@@ -3625,7 +3625,7 @@ ${assistantMessage}
|
|
|
3625
3625
|
break;
|
|
3626
3626
|
}
|
|
3627
3627
|
case "tool": {
|
|
3628
|
-
throw new
|
|
3628
|
+
throw new chunkKLVNQDUR_cjs.UnsupportedFunctionalityError({
|
|
3629
3629
|
functionality: "tool messages"
|
|
3630
3630
|
});
|
|
3631
3631
|
}
|
|
@@ -4038,7 +4038,7 @@ var OpenAIEmbeddingModel = class {
|
|
|
4038
4038
|
}) {
|
|
4039
4039
|
var _a2;
|
|
4040
4040
|
if (values.length > this.maxEmbeddingsPerCall) {
|
|
4041
|
-
throw new
|
|
4041
|
+
throw new chunkKLVNQDUR_cjs.TooManyEmbeddingValuesForCallError({
|
|
4042
4042
|
provider: this.provider,
|
|
4043
4043
|
modelId: this.modelId,
|
|
4044
4044
|
maxEmbeddingsPerCall: this.maxEmbeddingsPerCall,
|
|
@@ -4655,7 +4655,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
4655
4655
|
}
|
|
4656
4656
|
};
|
|
4657
4657
|
} else {
|
|
4658
|
-
throw new
|
|
4658
|
+
throw new chunkKLVNQDUR_cjs.UnsupportedFunctionalityError({
|
|
4659
4659
|
functionality: `file part media type ${part.mediaType}`
|
|
4660
4660
|
});
|
|
4661
4661
|
}
|
|
@@ -5720,7 +5720,7 @@ async function prepareResponsesTools({
|
|
|
5720
5720
|
};
|
|
5721
5721
|
default: {
|
|
5722
5722
|
const _exhaustiveCheck = type;
|
|
5723
|
-
throw new
|
|
5723
|
+
throw new chunkKLVNQDUR_cjs.UnsupportedFunctionalityError({
|
|
5724
5724
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
5725
5725
|
});
|
|
5726
5726
|
}
|
|
@@ -5978,7 +5978,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5978
5978
|
fetch: this.config.fetch
|
|
5979
5979
|
});
|
|
5980
5980
|
if (response.error) {
|
|
5981
|
-
throw new
|
|
5981
|
+
throw new chunkKLVNQDUR_cjs.APICallError({
|
|
5982
5982
|
message: response.error.message,
|
|
5983
5983
|
url,
|
|
5984
5984
|
requestBodyValues: body,
|
|
@@ -6921,7 +6921,7 @@ function createAzure(options = {}) {
|
|
|
6921
6921
|
createAzure();
|
|
6922
6922
|
|
|
6923
6923
|
// src/llm/model/gateways/azure.ts
|
|
6924
|
-
var AzureOpenAIGateway = class extends
|
|
6924
|
+
var AzureOpenAIGateway = class extends chunkKLVNQDUR_cjs.MastraModelGateway {
|
|
6925
6925
|
constructor(config) {
|
|
6926
6926
|
super();
|
|
6927
6927
|
this.config = config;
|
|
@@ -7129,7 +7129,7 @@ var AzureOpenAIGateway = class extends chunkRIUDLIP3_cjs.MastraModelGateway {
|
|
|
7129
7129
|
apiKey,
|
|
7130
7130
|
apiVersion,
|
|
7131
7131
|
useDeploymentBasedUrls: true,
|
|
7132
|
-
headers: { "User-Agent":
|
|
7132
|
+
headers: { "User-Agent": chunkKLVNQDUR_cjs.MASTRA_USER_AGENT, ...headers }
|
|
7133
7133
|
})(modelId);
|
|
7134
7134
|
}
|
|
7135
7135
|
};
|
|
@@ -7365,9 +7365,9 @@ function stableHeaderKey(headers) {
|
|
|
7365
7365
|
return JSON.stringify(entries.sort(([a], [b]) => a.localeCompare(b)));
|
|
7366
7366
|
}
|
|
7367
7367
|
function getStaticProvidersByGateway(name2) {
|
|
7368
|
-
return Object.fromEntries(Object.entries(
|
|
7368
|
+
return Object.fromEntries(Object.entries(chunkRTXCZT3M_cjs.PROVIDER_REGISTRY).filter(([_provider, config]) => config.gateway === name2));
|
|
7369
7369
|
}
|
|
7370
|
-
var defaultGateways = [new
|
|
7370
|
+
var defaultGateways = [new chunkGJIN53S6_cjs.NetlifyGateway(), new chunkL3X22YTN_cjs.ModelsDevGateway(getStaticProvidersByGateway(`models.dev`))];
|
|
7371
7371
|
var ModelRouterLanguageModel = class _ModelRouterLanguageModel {
|
|
7372
7372
|
specificationVersion = "v2";
|
|
7373
7373
|
defaultObjectGenerationMode = "json";
|
|
@@ -7412,7 +7412,7 @@ var ModelRouterLanguageModel = class _ModelRouterLanguageModel {
|
|
|
7412
7412
|
};
|
|
7413
7413
|
this.gateway = findGatewayForModel(normalizedConfig.id, [...customGateways || [], ...defaultGateways]);
|
|
7414
7414
|
const gatewayPrefix = this.gateway.id === "models.dev" ? void 0 : this.gateway.id;
|
|
7415
|
-
const parsed =
|
|
7415
|
+
const parsed = chunkL3X22YTN_cjs.parseModelRouterId(normalizedConfig.id, gatewayPrefix);
|
|
7416
7416
|
this.provider = parsed.providerId || "openai-compatible";
|
|
7417
7417
|
if (parsed.providerId && parsed.modelId !== normalizedConfig.id) {
|
|
7418
7418
|
parsedConfig.id = parsed.modelId;
|
|
@@ -7458,7 +7458,7 @@ var ModelRouterLanguageModel = class _ModelRouterLanguageModel {
|
|
|
7458
7458
|
const model = await this.resolveLanguageModel({
|
|
7459
7459
|
apiKey,
|
|
7460
7460
|
headers: this.config.headers,
|
|
7461
|
-
...
|
|
7461
|
+
...chunkL3X22YTN_cjs.parseModelRouterId(this.config.routerId, gatewayPrefix)
|
|
7462
7462
|
});
|
|
7463
7463
|
const modelSupportedUrls = model.supportedUrls;
|
|
7464
7464
|
if (!modelSupportedUrls) {
|
|
@@ -7522,13 +7522,13 @@ var ModelRouterLanguageModel = class _ModelRouterLanguageModel {
|
|
|
7522
7522
|
const model = await this.resolveLanguageModel({
|
|
7523
7523
|
apiKey,
|
|
7524
7524
|
headers: this.config.headers,
|
|
7525
|
-
...
|
|
7525
|
+
...chunkL3X22YTN_cjs.parseModelRouterId(this.config.routerId, gatewayPrefix)
|
|
7526
7526
|
});
|
|
7527
7527
|
if (isLanguageModelV3(model)) {
|
|
7528
7528
|
const aiSDKV6Model = new AISDKV6LanguageModel(model);
|
|
7529
7529
|
return aiSDKV6Model.doGenerate(options);
|
|
7530
7530
|
}
|
|
7531
|
-
const aiSDKV5Model = new
|
|
7531
|
+
const aiSDKV5Model = new chunkLKZQG2ZZ_cjs.AISDKV5LanguageModel(model);
|
|
7532
7532
|
return aiSDKV5Model.doGenerate(options);
|
|
7533
7533
|
}
|
|
7534
7534
|
async doStream(options) {
|
|
@@ -7562,13 +7562,13 @@ var ModelRouterLanguageModel = class _ModelRouterLanguageModel {
|
|
|
7562
7562
|
headers: this.config.headers,
|
|
7563
7563
|
transport: resolvedTransport,
|
|
7564
7564
|
openaiWebSocket: websocket,
|
|
7565
|
-
...
|
|
7565
|
+
...chunkL3X22YTN_cjs.parseModelRouterId(this.config.routerId, gatewayPrefix)
|
|
7566
7566
|
});
|
|
7567
7567
|
if (isLanguageModelV3(model)) {
|
|
7568
7568
|
const aiSDKV6Model = new AISDKV6LanguageModel(model);
|
|
7569
7569
|
return aiSDKV6Model.doStream(options);
|
|
7570
7570
|
}
|
|
7571
|
-
const aiSDKV5Model = new
|
|
7571
|
+
const aiSDKV5Model = new chunkLKZQG2ZZ_cjs.AISDKV5LanguageModel(model);
|
|
7572
7572
|
return aiSDKV5Model.doStream(options);
|
|
7573
7573
|
}
|
|
7574
7574
|
async resolveLanguageModel({
|
|
@@ -7589,7 +7589,7 @@ var ModelRouterLanguageModel = class _ModelRouterLanguageModel {
|
|
|
7589
7589
|
return _ModelRouterLanguageModel.modelInstances.get(key);
|
|
7590
7590
|
}
|
|
7591
7591
|
if (this.config.url) {
|
|
7592
|
-
const modelInstance2 =
|
|
7592
|
+
const modelInstance2 = chunkKLVNQDUR_cjs.createOpenAICompatible({
|
|
7593
7593
|
name: providerId,
|
|
7594
7594
|
apiKey,
|
|
7595
7595
|
baseURL: this.config.url,
|
|
@@ -7632,7 +7632,7 @@ var ModelRouterLanguageModel = class _ModelRouterLanguageModel {
|
|
|
7632
7632
|
url: openaiWebSocket?.url,
|
|
7633
7633
|
headers: openaiWebSocket?.headers
|
|
7634
7634
|
});
|
|
7635
|
-
const modelInstance =
|
|
7635
|
+
const modelInstance = chunkKLVNQDUR_cjs.createOpenAI({
|
|
7636
7636
|
apiKey,
|
|
7637
7637
|
baseURL,
|
|
7638
7638
|
headers,
|
|
@@ -7657,12 +7657,12 @@ async function resolveModelConfig(modelConfig, requestContext = new chunk5WBEMKE
|
|
|
7657
7657
|
if (typeof modelConfig === "function") {
|
|
7658
7658
|
modelConfig = await modelConfig({ requestContext, mastra });
|
|
7659
7659
|
}
|
|
7660
|
-
if (modelConfig instanceof ModelRouterLanguageModel || modelConfig instanceof
|
|
7660
|
+
if (modelConfig instanceof ModelRouterLanguageModel || modelConfig instanceof chunkLKZQG2ZZ_cjs.AISDKV5LanguageModel || modelConfig instanceof AISDKV6LanguageModel) {
|
|
7661
7661
|
return modelConfig;
|
|
7662
7662
|
}
|
|
7663
7663
|
if (typeof modelConfig === "object" && "specificationVersion" in modelConfig) {
|
|
7664
7664
|
if (modelConfig.specificationVersion === "v2") {
|
|
7665
|
-
return new
|
|
7665
|
+
return new chunkLKZQG2ZZ_cjs.AISDKV5LanguageModel(modelConfig);
|
|
7666
7666
|
}
|
|
7667
7667
|
if (modelConfig.specificationVersion === "v3") {
|
|
7668
7668
|
return new AISDKV6LanguageModel(modelConfig);
|
|
@@ -7671,7 +7671,7 @@ async function resolveModelConfig(modelConfig, requestContext = new chunk5WBEMKE
|
|
|
7671
7671
|
return modelConfig;
|
|
7672
7672
|
}
|
|
7673
7673
|
if (typeof modelConfig.doStream === "function" && typeof modelConfig.doGenerate === "function") {
|
|
7674
|
-
return new
|
|
7674
|
+
return new chunkLKZQG2ZZ_cjs.AISDKV5LanguageModel(modelConfig);
|
|
7675
7675
|
}
|
|
7676
7676
|
return modelConfig;
|
|
7677
7677
|
}
|
|
@@ -7758,14 +7758,14 @@ var ModelRouterEmbeddingModel = class {
|
|
|
7758
7758
|
this.modelId = normalizedConfig.modelId;
|
|
7759
7759
|
if (normalizedConfig.url) {
|
|
7760
7760
|
const apiKey = normalizedConfig.apiKey || "";
|
|
7761
|
-
this.providerModel =
|
|
7761
|
+
this.providerModel = chunkKLVNQDUR_cjs.createOpenAICompatible({
|
|
7762
7762
|
name: normalizedConfig.providerId,
|
|
7763
7763
|
apiKey,
|
|
7764
7764
|
baseURL: normalizedConfig.url,
|
|
7765
7765
|
headers: normalizedConfig.headers
|
|
7766
7766
|
}).textEmbeddingModel(normalizedConfig.modelId);
|
|
7767
7767
|
} else {
|
|
7768
|
-
const registry =
|
|
7768
|
+
const registry = chunkRTXCZT3M_cjs.GatewayRegistry.getInstance();
|
|
7769
7769
|
const providerConfig = registry.getProviderConfig(normalizedConfig.providerId);
|
|
7770
7770
|
if (!providerConfig) {
|
|
7771
7771
|
throw new Error(`Unknown provider: ${normalizedConfig.providerId}`);
|
|
@@ -7787,18 +7787,18 @@ var ModelRouterEmbeddingModel = class {
|
|
|
7787
7787
|
throw new Error(`API key not found for provider ${normalizedConfig.providerId}. Set ${envVarDisplay}`);
|
|
7788
7788
|
}
|
|
7789
7789
|
if (normalizedConfig.providerId === "openai") {
|
|
7790
|
-
this.providerModel =
|
|
7790
|
+
this.providerModel = chunkKLVNQDUR_cjs.createOpenAI({ apiKey }).textEmbeddingModel(
|
|
7791
7791
|
normalizedConfig.modelId
|
|
7792
7792
|
);
|
|
7793
7793
|
} else if (normalizedConfig.providerId === "google") {
|
|
7794
|
-
this.providerModel =
|
|
7794
|
+
this.providerModel = chunkKLVNQDUR_cjs.createGoogleGenerativeAI({ apiKey }).textEmbedding(
|
|
7795
7795
|
normalizedConfig.modelId
|
|
7796
7796
|
);
|
|
7797
7797
|
} else {
|
|
7798
7798
|
if (!providerConfig.url) {
|
|
7799
7799
|
throw new Error(`Provider ${normalizedConfig.providerId} does not have a URL configured`);
|
|
7800
7800
|
}
|
|
7801
|
-
this.providerModel =
|
|
7801
|
+
this.providerModel = chunkKLVNQDUR_cjs.createOpenAICompatible({
|
|
7802
7802
|
name: normalizedConfig.providerId,
|
|
7803
7803
|
apiKey,
|
|
7804
7804
|
baseURL: providerConfig.url
|
|
@@ -7824,5 +7824,5 @@ exports.EMBEDDING_MODELS = EMBEDDING_MODELS;
|
|
|
7824
7824
|
exports.ModelRouterEmbeddingModel = ModelRouterEmbeddingModel;
|
|
7825
7825
|
exports.ModelRouterLanguageModel = ModelRouterLanguageModel;
|
|
7826
7826
|
exports.resolveModelConfig = resolveModelConfig;
|
|
7827
|
-
//# sourceMappingURL=chunk-
|
|
7828
|
-
//# sourceMappingURL=chunk-
|
|
7827
|
+
//# sourceMappingURL=chunk-TVZCMQTV.cjs.map
|
|
7828
|
+
//# sourceMappingURL=chunk-TVZCMQTV.cjs.map
|