@mastra/fastembed 1.3.5-alpha.1 → 1.3.5-alpha.3
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/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +65 -13
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +110 -35
- package/dist/fastembed.d.ts.map +1 -1
- package/dist/index.cjs +70 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +69 -86
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create$1 = Object.create;
|
|
4
4
|
var __defProp$4 = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
@@ -20,7 +20,6 @@ var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
let fs_promises = require("fs/promises");
|
|
25
24
|
fs_promises = __toESM$1(fs_promises, 1);
|
|
26
25
|
let os = require("os");
|
|
@@ -35,7 +34,7 @@ let _anush008_tokenizers = require("@anush008/tokenizers");
|
|
|
35
34
|
let _huggingface_hub = require("@huggingface/hub");
|
|
36
35
|
let onnxruntime_node = require("onnxruntime-node");
|
|
37
36
|
onnxruntime_node = __toESM$1(onnxruntime_node, 1);
|
|
38
|
-
|
|
37
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/util.js
|
|
39
38
|
function getEnumValues(entries) {
|
|
40
39
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
41
40
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -587,8 +586,7 @@ function constantCatch(value) {
|
|
|
587
586
|
fn[CONSTANT_CATCH] = true;
|
|
588
587
|
return fn;
|
|
589
588
|
}
|
|
590
|
-
|
|
591
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/core.js
|
|
589
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/core.js
|
|
592
590
|
var _a$8;
|
|
593
591
|
const _zodDesc = {
|
|
594
592
|
value: void 0,
|
|
@@ -694,8 +692,7 @@ function config(newConfig) {
|
|
|
694
692
|
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
695
693
|
return globalConfig;
|
|
696
694
|
}
|
|
697
|
-
|
|
698
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/errors.js
|
|
695
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/errors.js
|
|
699
696
|
function _getMessage() {
|
|
700
697
|
const internals = this._zod;
|
|
701
698
|
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
@@ -809,8 +806,7 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
809
806
|
processError(error);
|
|
810
807
|
return fieldErrors;
|
|
811
808
|
}
|
|
812
|
-
|
|
813
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/parse.js
|
|
809
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/parse.js
|
|
814
810
|
function finalizeParams(callee, params) {
|
|
815
811
|
return {
|
|
816
812
|
callee: params?.callee ?? callee,
|
|
@@ -1012,8 +1008,7 @@ const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
1012
1008
|
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1013
1009
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
1014
1010
|
};
|
|
1015
|
-
|
|
1016
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/regexes.js
|
|
1011
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/regexes.js
|
|
1017
1012
|
/**
|
|
1018
1013
|
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
1019
1014
|
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
@@ -1085,8 +1080,7 @@ const boolean$1 = /^(?:true|false)$/i;
|
|
|
1085
1080
|
const _null$2 = /^null$/i;
|
|
1086
1081
|
const lowercase = /^[^A-Z]*$/;
|
|
1087
1082
|
const uppercase = /^[^a-z]*$/;
|
|
1088
|
-
|
|
1089
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/checks.js
|
|
1083
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/checks.js
|
|
1090
1084
|
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
1091
1085
|
var _a;
|
|
1092
1086
|
inst._zod ?? (inst._zod = {});
|
|
@@ -1416,8 +1410,7 @@ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (ins
|
|
|
1416
1410
|
payload.value = def.tx(payload.value);
|
|
1417
1411
|
};
|
|
1418
1412
|
});
|
|
1419
|
-
|
|
1420
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/doc.js
|
|
1413
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/doc.js
|
|
1421
1414
|
var Doc = class {
|
|
1422
1415
|
constructor(args = [], closed = {}) {
|
|
1423
1416
|
this.content = [];
|
|
@@ -1450,15 +1443,13 @@ var Doc = class {
|
|
|
1450
1443
|
return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
|
|
1451
1444
|
}
|
|
1452
1445
|
};
|
|
1453
|
-
|
|
1454
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/versions.js
|
|
1446
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/versions.js
|
|
1455
1447
|
const version = {
|
|
1456
1448
|
major: 4,
|
|
1457
1449
|
minor: 6,
|
|
1458
1450
|
patch: 7
|
|
1459
1451
|
};
|
|
1460
|
-
|
|
1461
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/schemas.js
|
|
1452
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/schemas.js
|
|
1462
1453
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1463
1454
|
var _a;
|
|
1464
1455
|
inst ?? (inst = {});
|
|
@@ -2943,8 +2934,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2943
2934
|
payload.issues.push(issue(_iss));
|
|
2944
2935
|
}
|
|
2945
2936
|
}
|
|
2946
|
-
|
|
2947
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/memoizer.js
|
|
2937
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/memoizer.js
|
|
2948
2938
|
var $ZodCyclicError = class extends Error {
|
|
2949
2939
|
constructor() {
|
|
2950
2940
|
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
@@ -3196,8 +3186,7 @@ function isBackEdge(ctx, value) {
|
|
|
3196
3186
|
const backEdges = ctx[STATE]?.backEdges;
|
|
3197
3187
|
return backEdges !== void 0 && isRef(value) && backEdges.has(value);
|
|
3198
3188
|
}
|
|
3199
|
-
|
|
3200
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/locales/en.js
|
|
3189
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/locales/en.js
|
|
3201
3190
|
const error = () => {
|
|
3202
3191
|
const Sizable = {
|
|
3203
3192
|
string: {
|
|
@@ -3304,8 +3293,7 @@ const error = () => {
|
|
|
3304
3293
|
function en_default() {
|
|
3305
3294
|
return { localeError: error() };
|
|
3306
3295
|
}
|
|
3307
|
-
|
|
3308
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/registries.js
|
|
3296
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/registries.js
|
|
3309
3297
|
var _a$6;
|
|
3310
3298
|
var $ZodRegistry = class {
|
|
3311
3299
|
constructor() {
|
|
@@ -3351,8 +3339,7 @@ function registry() {
|
|
|
3351
3339
|
}
|
|
3352
3340
|
(_a$6 = globalThis).__zod_globalRegistry ?? (_a$6.__zod_globalRegistry = registry());
|
|
3353
3341
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
3354
|
-
|
|
3355
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/api.js
|
|
3342
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/api.js
|
|
3356
3343
|
function snapshotChecks(def) {
|
|
3357
3344
|
if (def.checks) def.checks = [...def.checks];
|
|
3358
3345
|
return def;
|
|
@@ -3886,8 +3873,7 @@ function _check(fn, params) {
|
|
|
3886
3873
|
ch._zod.check = fn;
|
|
3887
3874
|
return ch;
|
|
3888
3875
|
}
|
|
3889
|
-
|
|
3890
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/to-json-schema.js
|
|
3876
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/to-json-schema.js
|
|
3891
3877
|
function assignProps(target, ...sources) {
|
|
3892
3878
|
for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
|
|
3893
3879
|
return target;
|
|
@@ -4330,8 +4316,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
4330
4316
|
extractDefs(ctx, schema);
|
|
4331
4317
|
return finalize(ctx, schema);
|
|
4332
4318
|
};
|
|
4333
|
-
|
|
4334
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/json-schema-processors.js
|
|
4319
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/json-schema-processors.js
|
|
4335
4320
|
const narrowMin = (agg, key, value) => {
|
|
4336
4321
|
if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
|
|
4337
4322
|
};
|
|
@@ -4976,8 +4961,7 @@ function toJSONSchema(input, params) {
|
|
|
4976
4961
|
extractDefs(ctx, input);
|
|
4977
4962
|
return finalize(ctx, input);
|
|
4978
4963
|
}
|
|
4979
|
-
|
|
4980
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/classic/errors.js
|
|
4964
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/classic/errors.js
|
|
4981
4965
|
const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
4982
4966
|
function _lazyMethod(proto, key, make) {
|
|
4983
4967
|
Object.defineProperty(proto, key, {
|
|
@@ -5026,8 +5010,7 @@ const initializer = (inst, issues) => {
|
|
|
5026
5010
|
});
|
|
5027
5011
|
};
|
|
5028
5012
|
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
|
|
5029
|
-
|
|
5030
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/classic/parse.js
|
|
5013
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/classic/parse.js
|
|
5031
5014
|
const parse = /* @__PURE__ */ _parse$2(ZodRealError);
|
|
5032
5015
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
5033
5016
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -5040,8 +5023,7 @@ const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
|
5040
5023
|
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
5041
5024
|
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
5042
5025
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
5043
|
-
|
|
5044
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/classic/schemas.js
|
|
5026
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/classic/schemas.js
|
|
5045
5027
|
function _ensureDefaultLocale() {
|
|
5046
5028
|
if (!globalConfig.localeError) config(en_default());
|
|
5047
5029
|
}
|
|
@@ -5970,8 +5952,7 @@ function _instanceof(cls, params = {}) {
|
|
|
5970
5952
|
};
|
|
5971
5953
|
return inst;
|
|
5972
5954
|
}
|
|
5973
|
-
|
|
5974
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/helpers/util.js
|
|
5955
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/helpers/util.js
|
|
5975
5956
|
var util;
|
|
5976
5957
|
(function(util) {
|
|
5977
5958
|
util.assertEqual = (_) => {};
|
|
@@ -6066,8 +6047,7 @@ const getParsedType = (data) => {
|
|
|
6066
6047
|
default: return ZodParsedType.unknown;
|
|
6067
6048
|
}
|
|
6068
6049
|
};
|
|
6069
|
-
|
|
6070
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/ZodError.js
|
|
6050
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/ZodError.js
|
|
6071
6051
|
const ZodIssueCode = util.arrayToEnum([
|
|
6072
6052
|
"invalid_type",
|
|
6073
6053
|
"invalid_literal",
|
|
@@ -6176,8 +6156,7 @@ var ZodError = class ZodError extends Error {
|
|
|
6176
6156
|
ZodError.create = (issues) => {
|
|
6177
6157
|
return new ZodError(issues);
|
|
6178
6158
|
};
|
|
6179
|
-
|
|
6180
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/locales/en.js
|
|
6159
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/locales/en.js
|
|
6181
6160
|
const errorMap = (issue, _ctx) => {
|
|
6182
6161
|
let message;
|
|
6183
6162
|
switch (issue.code) {
|
|
@@ -6254,14 +6233,12 @@ const errorMap = (issue, _ctx) => {
|
|
|
6254
6233
|
}
|
|
6255
6234
|
return { message };
|
|
6256
6235
|
};
|
|
6257
|
-
|
|
6258
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/errors.js
|
|
6236
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/errors.js
|
|
6259
6237
|
let overrideErrorMap = errorMap;
|
|
6260
6238
|
function getErrorMap() {
|
|
6261
6239
|
return overrideErrorMap;
|
|
6262
6240
|
}
|
|
6263
|
-
|
|
6264
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/helpers/parseUtil.js
|
|
6241
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/helpers/parseUtil.js
|
|
6265
6242
|
const makeIssue = (params) => {
|
|
6266
6243
|
const { data, path, errorMaps, issueData } = params;
|
|
6267
6244
|
const fullPath = [...path, ...issueData.path || []];
|
|
@@ -6364,15 +6341,13 @@ const isAborted = (x) => x.status === "aborted";
|
|
|
6364
6341
|
const isDirty = (x) => x.status === "dirty";
|
|
6365
6342
|
const isValid = (x) => x.status === "valid";
|
|
6366
6343
|
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
6367
|
-
|
|
6368
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/helpers/errorUtil.js
|
|
6344
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/helpers/errorUtil.js
|
|
6369
6345
|
var errorUtil;
|
|
6370
6346
|
(function(errorUtil) {
|
|
6371
6347
|
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
6372
6348
|
errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
6373
6349
|
})(errorUtil || (errorUtil = {}));
|
|
6374
|
-
|
|
6375
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/types.js
|
|
6350
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/types.js
|
|
6376
6351
|
var ParseInputLazyPath = class {
|
|
6377
6352
|
constructor(parent, value, path, key) {
|
|
6378
6353
|
this._cachedPath = [];
|
|
@@ -9532,8 +9507,7 @@ ZodOptional.create;
|
|
|
9532
9507
|
ZodNullable.create;
|
|
9533
9508
|
ZodEffects.createWithPreprocess;
|
|
9534
9509
|
ZodPipeline.create;
|
|
9535
|
-
|
|
9536
|
-
//#region ../_vendored/ai_v5/dist/dist-OCi48HWi.js
|
|
9510
|
+
// ../_vendored/ai_v5/dist/dist-DRvrQv6K.js
|
|
9537
9511
|
var marker$1$6 = "vercel.ai.error";
|
|
9538
9512
|
var symbol$1$6 = Symbol.for(marker$1$6);
|
|
9539
9513
|
var _a$1$6;
|
|
@@ -10751,8 +10725,7 @@ function asSchema$2(schema) {
|
|
|
10751
10725
|
}) : isSchema$2(schema) ? schema : typeof schema === "function" ? schema() : zodSchema$2(schema);
|
|
10752
10726
|
}
|
|
10753
10727
|
var { btoa: btoa$3, atob: atob$5 } = globalThis;
|
|
10754
|
-
|
|
10755
|
-
//#region ../_vendored/ai_v5/dist/index.js
|
|
10728
|
+
// ../_vendored/ai_v5/dist/index.js
|
|
10756
10729
|
/** only globals that common to node and browsers are allowed */
|
|
10757
10730
|
var _globalThis$1 = typeof globalThis === "object" ? globalThis : global;
|
|
10758
10731
|
var VERSION$1$3 = "1.9.0";
|
|
@@ -11540,40 +11513,40 @@ var API_NAME$5 = "trace";
|
|
|
11540
11513
|
})().getInstance();
|
|
11541
11514
|
var __defProp$3 = Object.defineProperty;
|
|
11542
11515
|
var __export$2 = (target, all) => {
|
|
11543
|
-
for (var
|
|
11544
|
-
get: all[
|
|
11516
|
+
for (var name17 in all) __defProp$3(target, name17, {
|
|
11517
|
+
get: all[name17],
|
|
11545
11518
|
enumerable: true
|
|
11546
11519
|
});
|
|
11547
11520
|
};
|
|
11548
|
-
var
|
|
11549
|
-
var
|
|
11550
|
-
var
|
|
11551
|
-
var
|
|
11521
|
+
var name7$4 = "AI_NoObjectGeneratedError";
|
|
11522
|
+
var marker7$4 = `vercel.ai.error.${name7$4}`;
|
|
11523
|
+
var symbol7$4 = Symbol.for(marker7$4);
|
|
11524
|
+
var _a7$4;
|
|
11552
11525
|
var NoObjectGeneratedError$2 = class extends AISDKError$2 {
|
|
11553
11526
|
constructor({ message = "No object generated.", cause, text: text2, response, usage, finishReason }) {
|
|
11554
11527
|
super({
|
|
11555
|
-
name:
|
|
11528
|
+
name: name7$4,
|
|
11556
11529
|
message,
|
|
11557
11530
|
cause
|
|
11558
11531
|
});
|
|
11559
|
-
this[
|
|
11532
|
+
this[_a7$4] = true;
|
|
11560
11533
|
this.text = text2;
|
|
11561
11534
|
this.response = response;
|
|
11562
11535
|
this.usage = usage;
|
|
11563
11536
|
this.finishReason = finishReason;
|
|
11564
11537
|
}
|
|
11565
11538
|
static isInstance(error) {
|
|
11566
|
-
return AISDKError$2.hasMarker(error,
|
|
11539
|
+
return AISDKError$2.hasMarker(error, marker7$4);
|
|
11567
11540
|
}
|
|
11568
11541
|
};
|
|
11569
|
-
|
|
11542
|
+
_a7$4 = symbol7$4;
|
|
11570
11543
|
var dataContentSchema$2 = union([
|
|
11571
11544
|
string(),
|
|
11572
11545
|
_instanceof(Uint8Array),
|
|
11573
11546
|
_instanceof(ArrayBuffer),
|
|
11574
11547
|
custom((value) => {
|
|
11575
|
-
var
|
|
11576
|
-
return (_b = (
|
|
11548
|
+
var _a17, _b;
|
|
11549
|
+
return (_b = (_a17 = globalThis.Buffer) == null ? void 0 : _a17.isBuffer(value)) != null ? _b : false;
|
|
11577
11550
|
}, { message: "Must be a Buffer" })
|
|
11578
11551
|
]);
|
|
11579
11552
|
var jsonValueSchema$2 = lazy(() => union([
|
|
@@ -12063,8 +12036,7 @@ function customProvider$2({ languageModels, textEmbeddingModels, imageModels, tr
|
|
|
12063
12036
|
}
|
|
12064
12037
|
};
|
|
12065
12038
|
}
|
|
12066
|
-
|
|
12067
|
-
//#region ../_vendored/ai_v4/dist/dist-Cm5DZgxA.js
|
|
12039
|
+
// ../_vendored/ai_v4/dist/dist-DlRWVOEI.js
|
|
12068
12040
|
var marker$4 = "vercel.ai.error";
|
|
12069
12041
|
var symbol$4 = Symbol.for(marker$4);
|
|
12070
12042
|
var _a$4;
|
|
@@ -12199,8 +12171,7 @@ Error message: ${getErrorMessage(cause)}`,
|
|
|
12199
12171
|
};
|
|
12200
12172
|
_a13$3 = symbol13$3;
|
|
12201
12173
|
var TypeValidationError$1 = _TypeValidationError;
|
|
12202
|
-
|
|
12203
|
-
//#region ../_vendored/ai_v4/dist/index.js
|
|
12174
|
+
// ../_vendored/ai_v4/dist/index.js
|
|
12204
12175
|
var __create = Object.create;
|
|
12205
12176
|
var __defProp$1 = Object.defineProperty;
|
|
12206
12177
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -15331,8 +15302,7 @@ function trimStartOfStream() {
|
|
|
15331
15302
|
return text2;
|
|
15332
15303
|
};
|
|
15333
15304
|
}
|
|
15334
|
-
|
|
15335
|
-
//#region ../_vendored/ai_v6/dist/dist-B3lfSiDN.js
|
|
15305
|
+
// ../_vendored/ai_v6/dist/dist-Dl1sIpsh.js
|
|
15336
15306
|
var marker$1 = "vercel.ai.error";
|
|
15337
15307
|
var symbol$1 = Symbol.for(marker$1);
|
|
15338
15308
|
var _a$1;
|
|
@@ -16569,8 +16539,7 @@ async function resolve(value) {
|
|
|
16569
16539
|
return value;
|
|
16570
16540
|
}
|
|
16571
16541
|
new TextDecoder();
|
|
16572
|
-
|
|
16573
|
-
//#region ../_vendored/ai_v6/dist/index.js
|
|
16542
|
+
// ../_vendored/ai_v6/dist/index.js
|
|
16574
16543
|
const VERSION$1 = "1.9.1";
|
|
16575
16544
|
const re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
16576
16545
|
/**
|
|
@@ -18339,8 +18308,7 @@ function customProvider({ languageModels, embeddingModels, imageModels, transcri
|
|
|
18339
18308
|
}
|
|
18340
18309
|
};
|
|
18341
18310
|
}
|
|
18342
|
-
|
|
18343
|
-
//#region src/fastembed.ts
|
|
18311
|
+
// src/fastembed.ts
|
|
18344
18312
|
/**
|
|
18345
18313
|
* Forked from fastembed-js (https://github.com/Anush008/fastembed-js)
|
|
18346
18314
|
* Original author: Anush008 <anushshetty90@gmail.com>
|
|
@@ -18411,6 +18379,7 @@ let SparseEmbeddingModel = /* @__PURE__ */ function(SparseEmbeddingModel) {
|
|
|
18411
18379
|
return SparseEmbeddingModel;
|
|
18412
18380
|
}({});
|
|
18413
18381
|
function normalize(v) {
|
|
18382
|
+
if (v.some((val) => !Number.isFinite(val))) throw new Error("Model produced a non-finite dense embedding value");
|
|
18414
18383
|
const norm = Math.sqrt(v.reduce((acc, val) => acc + val * val, 0));
|
|
18415
18384
|
const epsilon = 1e-12;
|
|
18416
18385
|
return v.map((val) => val / Math.max(norm, epsilon));
|
|
@@ -18425,7 +18394,7 @@ function getEmbeddings(data, dimensions, masks) {
|
|
|
18425
18394
|
for (let tokenIndex = 0; tokenIndex < sequenceLength; tokenIndex++) {
|
|
18426
18395
|
if (masks[batchIndex][tokenIndex] === 0n) continue;
|
|
18427
18396
|
tokenCount++;
|
|
18428
|
-
for (let dimension = 0; dimension < hiddenSize; dimension++) embedding[dimension]
|
|
18397
|
+
for (let dimension = 0; dimension < hiddenSize; dimension++) embedding[dimension] += data[start + tokenIndex * hiddenSize + dimension];
|
|
18429
18398
|
}
|
|
18430
18399
|
return embedding.map((value) => value / Math.max(tokenCount, 1));
|
|
18431
18400
|
});
|
|
@@ -18470,6 +18439,18 @@ function loadTokenizerFromDir(modelDir, maxLength) {
|
|
|
18470
18439
|
function assertValidBatchSize(batchSize) {
|
|
18471
18440
|
if (!Number.isSafeInteger(batchSize) || batchSize <= 0) throw new RangeError(`batchSize must be a positive safe integer, received ${String(batchSize)}`);
|
|
18472
18441
|
}
|
|
18442
|
+
function assertValidMaxLength(maxLength) {
|
|
18443
|
+
if (!Number.isSafeInteger(maxLength) || maxLength <= 0) throw new RangeError(`maxLength must be a positive safe integer, received ${String(maxLength)}`);
|
|
18444
|
+
}
|
|
18445
|
+
function getRequiredOutput(outputs, outputName) {
|
|
18446
|
+
const tensor = outputs[outputName];
|
|
18447
|
+
if (!tensor) throw new Error(`Expected model output "${outputName}" was not found. Available outputs: ${Object.keys(outputs).join(", ") || "(none)"}`);
|
|
18448
|
+
return tensor;
|
|
18449
|
+
}
|
|
18450
|
+
function getOutputDimensions(outputName, tensor) {
|
|
18451
|
+
if (tensor.dims.length !== 3) throw new Error(`Expected model output "${outputName}" to have 3 dimensions, received [${tensor.dims.join(", ")}]`);
|
|
18452
|
+
return tensor.dims;
|
|
18453
|
+
}
|
|
18473
18454
|
var FlagEmbedding = class FlagEmbedding extends Embedding {
|
|
18474
18455
|
constructor(tokenizer, session, model) {
|
|
18475
18456
|
super();
|
|
@@ -18478,6 +18459,7 @@ var FlagEmbedding = class FlagEmbedding extends Embedding {
|
|
|
18478
18459
|
this.model = model;
|
|
18479
18460
|
}
|
|
18480
18461
|
static async init({ model = "fast-bge-small-en-v1.5", executionProviders = ["cpu"], maxLength = 512, cacheDir = "local_cache", showDownloadProgress = true, modelAbsoluteDirPath = "", modelName = "" } = {}) {
|
|
18462
|
+
assertValidMaxLength(maxLength);
|
|
18481
18463
|
if (model === "custom") {
|
|
18482
18464
|
if (!modelAbsoluteDirPath) throw new Error("For custom model, modelAbsoluteDirPath is required in FlagEmbedding.init");
|
|
18483
18465
|
if (!modelName) throw new Error("For custom model, modelName is required in FlagEmbedding.init");
|
|
@@ -18578,8 +18560,8 @@ var FlagEmbedding = class FlagEmbedding extends Embedding {
|
|
|
18578
18560
|
token_type_ids: new onnxruntime_node.Tensor("int64", typeIdsArray.flat(), [batchTexts.length, maxLength])
|
|
18579
18561
|
};
|
|
18580
18562
|
if (this.model === "fast-multilingual-e5-large") delete inputs.token_type_ids;
|
|
18581
|
-
const lastHiddenState = (await this.session.run(inputs))
|
|
18582
|
-
yield getEmbeddings(lastHiddenState.data, lastHiddenState
|
|
18563
|
+
const lastHiddenState = getRequiredOutput(await this.session.run(inputs), "last_hidden_state");
|
|
18564
|
+
yield getEmbeddings(lastHiddenState.data, getOutputDimensions("last_hidden_state", lastHiddenState), this.model === "fast-all-MiniLM-L6-v2" || this.model === "fast-multilingual-e5-large" ? maskArray : void 0).map(normalize);
|
|
18583
18565
|
}
|
|
18584
18566
|
}
|
|
18585
18567
|
passageEmbed(texts, batchSize = 256) {
|
|
@@ -18636,6 +18618,7 @@ var SparseTextEmbedding = class SparseTextEmbedding extends SparseEmbedding {
|
|
|
18636
18618
|
this.session = session;
|
|
18637
18619
|
}
|
|
18638
18620
|
static async init({ model = "prithivida/Splade_PP_en_v1", executionProviders = ["cpu"], maxLength = 512, cacheDir = "local_cache", showDownloadProgress = true, modelAbsoluteDirPath = "", modelName = "" } = {}) {
|
|
18621
|
+
assertValidMaxLength(maxLength);
|
|
18639
18622
|
if (model === "custom") {
|
|
18640
18623
|
if (!modelAbsoluteDirPath) throw new Error("For custom model, modelAbsoluteDirPath is required in SparseTextEmbedding.init");
|
|
18641
18624
|
if (!modelName) throw new Error("For custom model, modelName is required in SparseTextEmbedding.init");
|
|
@@ -18719,14 +18702,16 @@ var SparseTextEmbedding = class SparseTextEmbedding extends SparseEmbedding {
|
|
|
18719
18702
|
input_mask: new onnxruntime_node.Tensor("int64", maskArray.flat().map(BigInt), [batchTexts.length, maxLength]),
|
|
18720
18703
|
segment_ids: new onnxruntime_node.Tensor("int64", typeIdsArray.flat(), [batchTexts.length, maxLength])
|
|
18721
18704
|
};
|
|
18722
|
-
const outputTensor = (await this.session.run(inputs))
|
|
18705
|
+
const outputTensor = getRequiredOutput(await this.session.run(inputs), "output");
|
|
18723
18706
|
const logits = outputTensor.cpuData;
|
|
18724
|
-
const [currentBatchSize, seqLen, currentVocabSize] = outputTensor
|
|
18707
|
+
const [currentBatchSize, seqLen, currentVocabSize] = getOutputDimensions("output", outputTensor);
|
|
18725
18708
|
const sparseVectors = [];
|
|
18726
18709
|
for (let batchIdx = 0; batchIdx < currentBatchSize; batchIdx++) {
|
|
18727
18710
|
const valuesArr = new Float32Array(currentVocabSize).fill(0);
|
|
18728
18711
|
for (let seqIdx = 0; seqIdx < seqLen; seqIdx++) if (maskArray[batchIdx][seqIdx] > 0) for (let vocabIdx = 0; vocabIdx < currentVocabSize; vocabIdx++) {
|
|
18729
|
-
const
|
|
18712
|
+
const logitIdx = batchIdx * seqLen * currentVocabSize + seqIdx * currentVocabSize + vocabIdx;
|
|
18713
|
+
const logitValue = logits[logitIdx];
|
|
18714
|
+
if (!Number.isFinite(logitValue)) throw new Error(`Model produced a non-finite sparse embedding value at index ${logitIdx}`);
|
|
18730
18715
|
const logValue = Math.log(1 + Math.max(0, logitValue));
|
|
18731
18716
|
valuesArr[vocabIdx] = Math.max(valuesArr[vocabIdx], logValue);
|
|
18732
18717
|
}
|
|
@@ -18757,8 +18742,7 @@ var SparseTextEmbedding = class SparseTextEmbedding extends SparseEmbedding {
|
|
|
18757
18742
|
}];
|
|
18758
18743
|
}
|
|
18759
18744
|
};
|
|
18760
|
-
|
|
18761
|
-
//#region src/model-cache.ts
|
|
18745
|
+
// src/model-cache.ts
|
|
18762
18746
|
async function getModelCachePath() {
|
|
18763
18747
|
const cachePath = path.default.join(os.default.homedir(), ".cache", "mastra", "fastembed-models");
|
|
18764
18748
|
await fs_promises.default.mkdir(cachePath, { recursive: true });
|
|
@@ -18784,8 +18768,7 @@ async function warmupFastEmbedModels() {
|
|
|
18784
18768
|
await FlagEmbedding.retrieveModel("fast-bge-small-en-v1.5", cacheDir, false);
|
|
18785
18769
|
await FlagEmbedding.retrieveModel("fast-bge-base-en-v1.5", cacheDir, false);
|
|
18786
18770
|
}
|
|
18787
|
-
|
|
18788
|
-
//#region src/index.ts
|
|
18771
|
+
// src/index.ts
|
|
18789
18772
|
/**
|
|
18790
18773
|
* Pre-download fastembed models without creating ONNX sessions.
|
|
18791
18774
|
* Call this before running tests in parallel to avoid concurrent download races.
|
|
@@ -18913,7 +18896,6 @@ const fastembed = Object.assign(fastEmbedProviderV3.embeddingModel(`bge-small-en
|
|
|
18913
18896
|
smallLegacy: fastEmbedLegacyProvider.textEmbeddingModel(`bge-small-en-v1.5`),
|
|
18914
18897
|
baseLegacy: fastEmbedLegacyProvider.textEmbeddingModel(`bge-base-en-v1.5`)
|
|
18915
18898
|
});
|
|
18916
|
-
//#endregion
|
|
18917
18899
|
exports.EmbeddingModel = EmbeddingModel;
|
|
18918
18900
|
exports.ExecutionProvider = ExecutionProvider;
|
|
18919
18901
|
exports.FlagEmbedding = FlagEmbedding;
|