@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.js
CHANGED
|
@@ -7,7 +7,7 @@ import { pipeline } from "stream/promises";
|
|
|
7
7
|
import { AddedToken, Tokenizer } from "@anush008/tokenizers";
|
|
8
8
|
import { downloadFile } from "@huggingface/hub";
|
|
9
9
|
import * as ort from "onnxruntime-node";
|
|
10
|
-
|
|
10
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/util.js
|
|
11
11
|
function getEnumValues(entries) {
|
|
12
12
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
13
13
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -559,8 +559,7 @@ function constantCatch(value) {
|
|
|
559
559
|
fn[CONSTANT_CATCH] = true;
|
|
560
560
|
return fn;
|
|
561
561
|
}
|
|
562
|
-
|
|
563
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/core.js
|
|
562
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/core.js
|
|
564
563
|
var _a$8;
|
|
565
564
|
const _zodDesc = {
|
|
566
565
|
value: void 0,
|
|
@@ -666,8 +665,7 @@ function config(newConfig) {
|
|
|
666
665
|
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
667
666
|
return globalConfig;
|
|
668
667
|
}
|
|
669
|
-
|
|
670
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/errors.js
|
|
668
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/errors.js
|
|
671
669
|
function _getMessage() {
|
|
672
670
|
const internals = this._zod;
|
|
673
671
|
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
@@ -781,8 +779,7 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
781
779
|
processError(error);
|
|
782
780
|
return fieldErrors;
|
|
783
781
|
}
|
|
784
|
-
|
|
785
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/parse.js
|
|
782
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/parse.js
|
|
786
783
|
function finalizeParams(callee, params) {
|
|
787
784
|
return {
|
|
788
785
|
callee: params?.callee ?? callee,
|
|
@@ -984,8 +981,7 @@ const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
984
981
|
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
985
982
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
986
983
|
};
|
|
987
|
-
|
|
988
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/regexes.js
|
|
984
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/regexes.js
|
|
989
985
|
/**
|
|
990
986
|
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
991
987
|
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
@@ -1057,8 +1053,7 @@ const boolean$1 = /^(?:true|false)$/i;
|
|
|
1057
1053
|
const _null$2 = /^null$/i;
|
|
1058
1054
|
const lowercase = /^[^A-Z]*$/;
|
|
1059
1055
|
const uppercase = /^[^a-z]*$/;
|
|
1060
|
-
|
|
1061
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/checks.js
|
|
1056
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/checks.js
|
|
1062
1057
|
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
1063
1058
|
var _a;
|
|
1064
1059
|
inst._zod ?? (inst._zod = {});
|
|
@@ -1388,8 +1383,7 @@ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (ins
|
|
|
1388
1383
|
payload.value = def.tx(payload.value);
|
|
1389
1384
|
};
|
|
1390
1385
|
});
|
|
1391
|
-
|
|
1392
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/doc.js
|
|
1386
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/doc.js
|
|
1393
1387
|
var Doc = class {
|
|
1394
1388
|
constructor(args = [], closed = {}) {
|
|
1395
1389
|
this.content = [];
|
|
@@ -1422,15 +1416,13 @@ var Doc = class {
|
|
|
1422
1416
|
return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
|
|
1423
1417
|
}
|
|
1424
1418
|
};
|
|
1425
|
-
|
|
1426
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/versions.js
|
|
1419
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/versions.js
|
|
1427
1420
|
const version = {
|
|
1428
1421
|
major: 4,
|
|
1429
1422
|
minor: 6,
|
|
1430
1423
|
patch: 7
|
|
1431
1424
|
};
|
|
1432
|
-
|
|
1433
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/schemas.js
|
|
1425
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/schemas.js
|
|
1434
1426
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1435
1427
|
var _a;
|
|
1436
1428
|
inst ?? (inst = {});
|
|
@@ -2915,8 +2907,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2915
2907
|
payload.issues.push(issue(_iss));
|
|
2916
2908
|
}
|
|
2917
2909
|
}
|
|
2918
|
-
|
|
2919
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/memoizer.js
|
|
2910
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/memoizer.js
|
|
2920
2911
|
var $ZodCyclicError = class extends Error {
|
|
2921
2912
|
constructor() {
|
|
2922
2913
|
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
@@ -3168,8 +3159,7 @@ function isBackEdge(ctx, value) {
|
|
|
3168
3159
|
const backEdges = ctx[STATE]?.backEdges;
|
|
3169
3160
|
return backEdges !== void 0 && isRef(value) && backEdges.has(value);
|
|
3170
3161
|
}
|
|
3171
|
-
|
|
3172
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/locales/en.js
|
|
3162
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/locales/en.js
|
|
3173
3163
|
const error = () => {
|
|
3174
3164
|
const Sizable = {
|
|
3175
3165
|
string: {
|
|
@@ -3276,8 +3266,7 @@ const error = () => {
|
|
|
3276
3266
|
function en_default() {
|
|
3277
3267
|
return { localeError: error() };
|
|
3278
3268
|
}
|
|
3279
|
-
|
|
3280
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/registries.js
|
|
3269
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/registries.js
|
|
3281
3270
|
var _a$6;
|
|
3282
3271
|
var $ZodRegistry = class {
|
|
3283
3272
|
constructor() {
|
|
@@ -3323,8 +3312,7 @@ function registry() {
|
|
|
3323
3312
|
}
|
|
3324
3313
|
(_a$6 = globalThis).__zod_globalRegistry ?? (_a$6.__zod_globalRegistry = registry());
|
|
3325
3314
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
3326
|
-
|
|
3327
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/api.js
|
|
3315
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/api.js
|
|
3328
3316
|
function snapshotChecks(def) {
|
|
3329
3317
|
if (def.checks) def.checks = [...def.checks];
|
|
3330
3318
|
return def;
|
|
@@ -3858,8 +3846,7 @@ function _check(fn, params) {
|
|
|
3858
3846
|
ch._zod.check = fn;
|
|
3859
3847
|
return ch;
|
|
3860
3848
|
}
|
|
3861
|
-
|
|
3862
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/to-json-schema.js
|
|
3849
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/to-json-schema.js
|
|
3863
3850
|
function assignProps(target, ...sources) {
|
|
3864
3851
|
for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
|
|
3865
3852
|
return target;
|
|
@@ -4302,8 +4289,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
4302
4289
|
extractDefs(ctx, schema);
|
|
4303
4290
|
return finalize(ctx, schema);
|
|
4304
4291
|
};
|
|
4305
|
-
|
|
4306
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/json-schema-processors.js
|
|
4292
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/json-schema-processors.js
|
|
4307
4293
|
const narrowMin = (agg, key, value) => {
|
|
4308
4294
|
if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
|
|
4309
4295
|
};
|
|
@@ -4948,8 +4934,7 @@ function toJSONSchema(input, params) {
|
|
|
4948
4934
|
extractDefs(ctx, input);
|
|
4949
4935
|
return finalize(ctx, input);
|
|
4950
4936
|
}
|
|
4951
|
-
|
|
4952
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/classic/errors.js
|
|
4937
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/classic/errors.js
|
|
4953
4938
|
const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
4954
4939
|
function _lazyMethod(proto, key, make) {
|
|
4955
4940
|
Object.defineProperty(proto, key, {
|
|
@@ -4998,8 +4983,7 @@ const initializer = (inst, issues) => {
|
|
|
4998
4983
|
});
|
|
4999
4984
|
};
|
|
5000
4985
|
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
|
|
5001
|
-
|
|
5002
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/classic/parse.js
|
|
4986
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/classic/parse.js
|
|
5003
4987
|
const parse = /* @__PURE__ */ _parse$2(ZodRealError);
|
|
5004
4988
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
5005
4989
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -5012,8 +4996,7 @@ const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
|
5012
4996
|
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
5013
4997
|
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
5014
4998
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
5015
|
-
|
|
5016
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/classic/schemas.js
|
|
4999
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/classic/schemas.js
|
|
5017
5000
|
function _ensureDefaultLocale() {
|
|
5018
5001
|
if (!globalConfig.localeError) config(en_default());
|
|
5019
5002
|
}
|
|
@@ -5942,8 +5925,7 @@ function _instanceof(cls, params = {}) {
|
|
|
5942
5925
|
};
|
|
5943
5926
|
return inst;
|
|
5944
5927
|
}
|
|
5945
|
-
|
|
5946
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/helpers/util.js
|
|
5928
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/helpers/util.js
|
|
5947
5929
|
var util;
|
|
5948
5930
|
(function(util) {
|
|
5949
5931
|
util.assertEqual = (_) => {};
|
|
@@ -6038,8 +6020,7 @@ const getParsedType = (data) => {
|
|
|
6038
6020
|
default: return ZodParsedType.unknown;
|
|
6039
6021
|
}
|
|
6040
6022
|
};
|
|
6041
|
-
|
|
6042
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/ZodError.js
|
|
6023
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/ZodError.js
|
|
6043
6024
|
const ZodIssueCode = util.arrayToEnum([
|
|
6044
6025
|
"invalid_type",
|
|
6045
6026
|
"invalid_literal",
|
|
@@ -6148,8 +6129,7 @@ var ZodError = class ZodError extends Error {
|
|
|
6148
6129
|
ZodError.create = (issues) => {
|
|
6149
6130
|
return new ZodError(issues);
|
|
6150
6131
|
};
|
|
6151
|
-
|
|
6152
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/locales/en.js
|
|
6132
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/locales/en.js
|
|
6153
6133
|
const errorMap = (issue, _ctx) => {
|
|
6154
6134
|
let message;
|
|
6155
6135
|
switch (issue.code) {
|
|
@@ -6226,14 +6206,12 @@ const errorMap = (issue, _ctx) => {
|
|
|
6226
6206
|
}
|
|
6227
6207
|
return { message };
|
|
6228
6208
|
};
|
|
6229
|
-
|
|
6230
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/errors.js
|
|
6209
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/errors.js
|
|
6231
6210
|
let overrideErrorMap = errorMap;
|
|
6232
6211
|
function getErrorMap() {
|
|
6233
6212
|
return overrideErrorMap;
|
|
6234
6213
|
}
|
|
6235
|
-
|
|
6236
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/helpers/parseUtil.js
|
|
6214
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/helpers/parseUtil.js
|
|
6237
6215
|
const makeIssue = (params) => {
|
|
6238
6216
|
const { data, path, errorMaps, issueData } = params;
|
|
6239
6217
|
const fullPath = [...path, ...issueData.path || []];
|
|
@@ -6336,15 +6314,13 @@ const isAborted = (x) => x.status === "aborted";
|
|
|
6336
6314
|
const isDirty = (x) => x.status === "dirty";
|
|
6337
6315
|
const isValid = (x) => x.status === "valid";
|
|
6338
6316
|
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
6339
|
-
|
|
6340
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/helpers/errorUtil.js
|
|
6317
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/helpers/errorUtil.js
|
|
6341
6318
|
var errorUtil;
|
|
6342
6319
|
(function(errorUtil) {
|
|
6343
6320
|
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
6344
6321
|
errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
6345
6322
|
})(errorUtil || (errorUtil = {}));
|
|
6346
|
-
|
|
6347
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/types.js
|
|
6323
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v3/types.js
|
|
6348
6324
|
var ParseInputLazyPath = class {
|
|
6349
6325
|
constructor(parent, value, path, key) {
|
|
6350
6326
|
this._cachedPath = [];
|
|
@@ -9504,8 +9480,7 @@ ZodOptional.create;
|
|
|
9504
9480
|
ZodNullable.create;
|
|
9505
9481
|
ZodEffects.createWithPreprocess;
|
|
9506
9482
|
ZodPipeline.create;
|
|
9507
|
-
|
|
9508
|
-
//#region ../_vendored/ai_v5/dist/dist-OCi48HWi.js
|
|
9483
|
+
// ../_vendored/ai_v5/dist/dist-DRvrQv6K.js
|
|
9509
9484
|
var marker$1$6 = "vercel.ai.error";
|
|
9510
9485
|
var symbol$1$6 = Symbol.for(marker$1$6);
|
|
9511
9486
|
var _a$1$6;
|
|
@@ -10723,8 +10698,7 @@ function asSchema$2(schema) {
|
|
|
10723
10698
|
}) : isSchema$2(schema) ? schema : typeof schema === "function" ? schema() : zodSchema$2(schema);
|
|
10724
10699
|
}
|
|
10725
10700
|
var { btoa: btoa$3, atob: atob$5 } = globalThis;
|
|
10726
|
-
|
|
10727
|
-
//#region ../_vendored/ai_v5/dist/index.js
|
|
10701
|
+
// ../_vendored/ai_v5/dist/index.js
|
|
10728
10702
|
/** only globals that common to node and browsers are allowed */
|
|
10729
10703
|
var _globalThis$1 = typeof globalThis === "object" ? globalThis : global;
|
|
10730
10704
|
var VERSION$1$3 = "1.9.0";
|
|
@@ -11512,40 +11486,40 @@ var API_NAME$5 = "trace";
|
|
|
11512
11486
|
})().getInstance();
|
|
11513
11487
|
var __defProp$3 = Object.defineProperty;
|
|
11514
11488
|
var __export$2 = (target, all) => {
|
|
11515
|
-
for (var
|
|
11516
|
-
get: all[
|
|
11489
|
+
for (var name17 in all) __defProp$3(target, name17, {
|
|
11490
|
+
get: all[name17],
|
|
11517
11491
|
enumerable: true
|
|
11518
11492
|
});
|
|
11519
11493
|
};
|
|
11520
|
-
var
|
|
11521
|
-
var
|
|
11522
|
-
var
|
|
11523
|
-
var
|
|
11494
|
+
var name7$4 = "AI_NoObjectGeneratedError";
|
|
11495
|
+
var marker7$4 = `vercel.ai.error.${name7$4}`;
|
|
11496
|
+
var symbol7$4 = Symbol.for(marker7$4);
|
|
11497
|
+
var _a7$4;
|
|
11524
11498
|
var NoObjectGeneratedError$2 = class extends AISDKError$2 {
|
|
11525
11499
|
constructor({ message = "No object generated.", cause, text: text2, response, usage, finishReason }) {
|
|
11526
11500
|
super({
|
|
11527
|
-
name:
|
|
11501
|
+
name: name7$4,
|
|
11528
11502
|
message,
|
|
11529
11503
|
cause
|
|
11530
11504
|
});
|
|
11531
|
-
this[
|
|
11505
|
+
this[_a7$4] = true;
|
|
11532
11506
|
this.text = text2;
|
|
11533
11507
|
this.response = response;
|
|
11534
11508
|
this.usage = usage;
|
|
11535
11509
|
this.finishReason = finishReason;
|
|
11536
11510
|
}
|
|
11537
11511
|
static isInstance(error) {
|
|
11538
|
-
return AISDKError$2.hasMarker(error,
|
|
11512
|
+
return AISDKError$2.hasMarker(error, marker7$4);
|
|
11539
11513
|
}
|
|
11540
11514
|
};
|
|
11541
|
-
|
|
11515
|
+
_a7$4 = symbol7$4;
|
|
11542
11516
|
var dataContentSchema$2 = union([
|
|
11543
11517
|
string(),
|
|
11544
11518
|
_instanceof(Uint8Array),
|
|
11545
11519
|
_instanceof(ArrayBuffer),
|
|
11546
11520
|
custom((value) => {
|
|
11547
|
-
var
|
|
11548
|
-
return (_b = (
|
|
11521
|
+
var _a17, _b;
|
|
11522
|
+
return (_b = (_a17 = globalThis.Buffer) == null ? void 0 : _a17.isBuffer(value)) != null ? _b : false;
|
|
11549
11523
|
}, { message: "Must be a Buffer" })
|
|
11550
11524
|
]);
|
|
11551
11525
|
var jsonValueSchema$2 = lazy(() => union([
|
|
@@ -12035,8 +12009,7 @@ function customProvider$2({ languageModels, textEmbeddingModels, imageModels, tr
|
|
|
12035
12009
|
}
|
|
12036
12010
|
};
|
|
12037
12011
|
}
|
|
12038
|
-
|
|
12039
|
-
//#region ../_vendored/ai_v4/dist/dist-Cm5DZgxA.js
|
|
12012
|
+
// ../_vendored/ai_v4/dist/dist-DlRWVOEI.js
|
|
12040
12013
|
var marker$4 = "vercel.ai.error";
|
|
12041
12014
|
var symbol$4 = Symbol.for(marker$4);
|
|
12042
12015
|
var _a$4;
|
|
@@ -12171,8 +12144,7 @@ Error message: ${getErrorMessage(cause)}`,
|
|
|
12171
12144
|
};
|
|
12172
12145
|
_a13$3 = symbol13$3;
|
|
12173
12146
|
var TypeValidationError$1 = _TypeValidationError;
|
|
12174
|
-
|
|
12175
|
-
//#region ../_vendored/ai_v4/dist/index.js
|
|
12147
|
+
// ../_vendored/ai_v4/dist/index.js
|
|
12176
12148
|
var __create = Object.create;
|
|
12177
12149
|
var __defProp$1 = Object.defineProperty;
|
|
12178
12150
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -15303,8 +15275,7 @@ function trimStartOfStream() {
|
|
|
15303
15275
|
return text2;
|
|
15304
15276
|
};
|
|
15305
15277
|
}
|
|
15306
|
-
|
|
15307
|
-
//#region ../_vendored/ai_v6/dist/dist-B3lfSiDN.js
|
|
15278
|
+
// ../_vendored/ai_v6/dist/dist-Dl1sIpsh.js
|
|
15308
15279
|
var marker$1 = "vercel.ai.error";
|
|
15309
15280
|
var symbol$1 = Symbol.for(marker$1);
|
|
15310
15281
|
var _a$1;
|
|
@@ -16541,8 +16512,7 @@ async function resolve(value) {
|
|
|
16541
16512
|
return value;
|
|
16542
16513
|
}
|
|
16543
16514
|
new TextDecoder();
|
|
16544
|
-
|
|
16545
|
-
//#region ../_vendored/ai_v6/dist/index.js
|
|
16515
|
+
// ../_vendored/ai_v6/dist/index.js
|
|
16546
16516
|
const VERSION$1 = "1.9.1";
|
|
16547
16517
|
const re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
16548
16518
|
/**
|
|
@@ -18311,8 +18281,7 @@ function customProvider({ languageModels, embeddingModels, imageModels, transcri
|
|
|
18311
18281
|
}
|
|
18312
18282
|
};
|
|
18313
18283
|
}
|
|
18314
|
-
|
|
18315
|
-
//#region src/fastembed.ts
|
|
18284
|
+
// src/fastembed.ts
|
|
18316
18285
|
/**
|
|
18317
18286
|
* Forked from fastembed-js (https://github.com/Anush008/fastembed-js)
|
|
18318
18287
|
* Original author: Anush008 <anushshetty90@gmail.com>
|
|
@@ -18383,6 +18352,7 @@ let SparseEmbeddingModel = /* @__PURE__ */ function(SparseEmbeddingModel) {
|
|
|
18383
18352
|
return SparseEmbeddingModel;
|
|
18384
18353
|
}({});
|
|
18385
18354
|
function normalize(v) {
|
|
18355
|
+
if (v.some((val) => !Number.isFinite(val))) throw new Error("Model produced a non-finite dense embedding value");
|
|
18386
18356
|
const norm = Math.sqrt(v.reduce((acc, val) => acc + val * val, 0));
|
|
18387
18357
|
const epsilon = 1e-12;
|
|
18388
18358
|
return v.map((val) => val / Math.max(norm, epsilon));
|
|
@@ -18397,7 +18367,7 @@ function getEmbeddings(data, dimensions, masks) {
|
|
|
18397
18367
|
for (let tokenIndex = 0; tokenIndex < sequenceLength; tokenIndex++) {
|
|
18398
18368
|
if (masks[batchIndex][tokenIndex] === 0n) continue;
|
|
18399
18369
|
tokenCount++;
|
|
18400
|
-
for (let dimension = 0; dimension < hiddenSize; dimension++) embedding[dimension]
|
|
18370
|
+
for (let dimension = 0; dimension < hiddenSize; dimension++) embedding[dimension] += data[start + tokenIndex * hiddenSize + dimension];
|
|
18401
18371
|
}
|
|
18402
18372
|
return embedding.map((value) => value / Math.max(tokenCount, 1));
|
|
18403
18373
|
});
|
|
@@ -18442,6 +18412,18 @@ function loadTokenizerFromDir(modelDir, maxLength) {
|
|
|
18442
18412
|
function assertValidBatchSize(batchSize) {
|
|
18443
18413
|
if (!Number.isSafeInteger(batchSize) || batchSize <= 0) throw new RangeError(`batchSize must be a positive safe integer, received ${String(batchSize)}`);
|
|
18444
18414
|
}
|
|
18415
|
+
function assertValidMaxLength(maxLength) {
|
|
18416
|
+
if (!Number.isSafeInteger(maxLength) || maxLength <= 0) throw new RangeError(`maxLength must be a positive safe integer, received ${String(maxLength)}`);
|
|
18417
|
+
}
|
|
18418
|
+
function getRequiredOutput(outputs, outputName) {
|
|
18419
|
+
const tensor = outputs[outputName];
|
|
18420
|
+
if (!tensor) throw new Error(`Expected model output "${outputName}" was not found. Available outputs: ${Object.keys(outputs).join(", ") || "(none)"}`);
|
|
18421
|
+
return tensor;
|
|
18422
|
+
}
|
|
18423
|
+
function getOutputDimensions(outputName, tensor) {
|
|
18424
|
+
if (tensor.dims.length !== 3) throw new Error(`Expected model output "${outputName}" to have 3 dimensions, received [${tensor.dims.join(", ")}]`);
|
|
18425
|
+
return tensor.dims;
|
|
18426
|
+
}
|
|
18445
18427
|
var FlagEmbedding = class FlagEmbedding extends Embedding {
|
|
18446
18428
|
constructor(tokenizer, session, model) {
|
|
18447
18429
|
super();
|
|
@@ -18450,6 +18432,7 @@ var FlagEmbedding = class FlagEmbedding extends Embedding {
|
|
|
18450
18432
|
this.model = model;
|
|
18451
18433
|
}
|
|
18452
18434
|
static async init({ model = "fast-bge-small-en-v1.5", executionProviders = ["cpu"], maxLength = 512, cacheDir = "local_cache", showDownloadProgress = true, modelAbsoluteDirPath = "", modelName = "" } = {}) {
|
|
18435
|
+
assertValidMaxLength(maxLength);
|
|
18453
18436
|
if (model === "custom") {
|
|
18454
18437
|
if (!modelAbsoluteDirPath) throw new Error("For custom model, modelAbsoluteDirPath is required in FlagEmbedding.init");
|
|
18455
18438
|
if (!modelName) throw new Error("For custom model, modelName is required in FlagEmbedding.init");
|
|
@@ -18550,8 +18533,8 @@ var FlagEmbedding = class FlagEmbedding extends Embedding {
|
|
|
18550
18533
|
token_type_ids: new ort.Tensor("int64", typeIdsArray.flat(), [batchTexts.length, maxLength])
|
|
18551
18534
|
};
|
|
18552
18535
|
if (this.model === "fast-multilingual-e5-large") delete inputs.token_type_ids;
|
|
18553
|
-
const lastHiddenState = (await this.session.run(inputs))
|
|
18554
|
-
yield getEmbeddings(lastHiddenState.data, lastHiddenState
|
|
18536
|
+
const lastHiddenState = getRequiredOutput(await this.session.run(inputs), "last_hidden_state");
|
|
18537
|
+
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);
|
|
18555
18538
|
}
|
|
18556
18539
|
}
|
|
18557
18540
|
passageEmbed(texts, batchSize = 256) {
|
|
@@ -18608,6 +18591,7 @@ var SparseTextEmbedding = class SparseTextEmbedding extends SparseEmbedding {
|
|
|
18608
18591
|
this.session = session;
|
|
18609
18592
|
}
|
|
18610
18593
|
static async init({ model = "prithivida/Splade_PP_en_v1", executionProviders = ["cpu"], maxLength = 512, cacheDir = "local_cache", showDownloadProgress = true, modelAbsoluteDirPath = "", modelName = "" } = {}) {
|
|
18594
|
+
assertValidMaxLength(maxLength);
|
|
18611
18595
|
if (model === "custom") {
|
|
18612
18596
|
if (!modelAbsoluteDirPath) throw new Error("For custom model, modelAbsoluteDirPath is required in SparseTextEmbedding.init");
|
|
18613
18597
|
if (!modelName) throw new Error("For custom model, modelName is required in SparseTextEmbedding.init");
|
|
@@ -18691,14 +18675,16 @@ var SparseTextEmbedding = class SparseTextEmbedding extends SparseEmbedding {
|
|
|
18691
18675
|
input_mask: new ort.Tensor("int64", maskArray.flat().map(BigInt), [batchTexts.length, maxLength]),
|
|
18692
18676
|
segment_ids: new ort.Tensor("int64", typeIdsArray.flat(), [batchTexts.length, maxLength])
|
|
18693
18677
|
};
|
|
18694
|
-
const outputTensor = (await this.session.run(inputs))
|
|
18678
|
+
const outputTensor = getRequiredOutput(await this.session.run(inputs), "output");
|
|
18695
18679
|
const logits = outputTensor.cpuData;
|
|
18696
|
-
const [currentBatchSize, seqLen, currentVocabSize] = outputTensor
|
|
18680
|
+
const [currentBatchSize, seqLen, currentVocabSize] = getOutputDimensions("output", outputTensor);
|
|
18697
18681
|
const sparseVectors = [];
|
|
18698
18682
|
for (let batchIdx = 0; batchIdx < currentBatchSize; batchIdx++) {
|
|
18699
18683
|
const valuesArr = new Float32Array(currentVocabSize).fill(0);
|
|
18700
18684
|
for (let seqIdx = 0; seqIdx < seqLen; seqIdx++) if (maskArray[batchIdx][seqIdx] > 0) for (let vocabIdx = 0; vocabIdx < currentVocabSize; vocabIdx++) {
|
|
18701
|
-
const
|
|
18685
|
+
const logitIdx = batchIdx * seqLen * currentVocabSize + seqIdx * currentVocabSize + vocabIdx;
|
|
18686
|
+
const logitValue = logits[logitIdx];
|
|
18687
|
+
if (!Number.isFinite(logitValue)) throw new Error(`Model produced a non-finite sparse embedding value at index ${logitIdx}`);
|
|
18702
18688
|
const logValue = Math.log(1 + Math.max(0, logitValue));
|
|
18703
18689
|
valuesArr[vocabIdx] = Math.max(valuesArr[vocabIdx], logValue);
|
|
18704
18690
|
}
|
|
@@ -18729,8 +18715,7 @@ var SparseTextEmbedding = class SparseTextEmbedding extends SparseEmbedding {
|
|
|
18729
18715
|
}];
|
|
18730
18716
|
}
|
|
18731
18717
|
};
|
|
18732
|
-
|
|
18733
|
-
//#region src/model-cache.ts
|
|
18718
|
+
// src/model-cache.ts
|
|
18734
18719
|
async function getModelCachePath() {
|
|
18735
18720
|
const cachePath = path.join(os.homedir(), ".cache", "mastra", "fastembed-models");
|
|
18736
18721
|
await fsp.mkdir(cachePath, { recursive: true });
|
|
@@ -18756,8 +18741,7 @@ async function warmupFastEmbedModels() {
|
|
|
18756
18741
|
await FlagEmbedding.retrieveModel("fast-bge-small-en-v1.5", cacheDir, false);
|
|
18757
18742
|
await FlagEmbedding.retrieveModel("fast-bge-base-en-v1.5", cacheDir, false);
|
|
18758
18743
|
}
|
|
18759
|
-
|
|
18760
|
-
//#region src/index.ts
|
|
18744
|
+
// src/index.ts
|
|
18761
18745
|
/**
|
|
18762
18746
|
* Pre-download fastembed models without creating ONNX sessions.
|
|
18763
18747
|
* Call this before running tests in parallel to avoid concurrent download races.
|
|
@@ -18885,7 +18869,6 @@ const fastembed = Object.assign(fastEmbedProviderV3.embeddingModel(`bge-small-en
|
|
|
18885
18869
|
smallLegacy: fastEmbedLegacyProvider.textEmbeddingModel(`bge-small-en-v1.5`),
|
|
18886
18870
|
baseLegacy: fastEmbedLegacyProvider.textEmbeddingModel(`bge-base-en-v1.5`)
|
|
18887
18871
|
});
|
|
18888
|
-
//#endregion
|
|
18889
18872
|
export { EmbeddingModel, ExecutionProvider, FlagEmbedding, SparseEmbeddingModel, SparseTextEmbedding, fastembed, warmup };
|
|
18890
18873
|
|
|
18891
18874
|
//# sourceMappingURL=index.js.map
|