@mastra/fastembed 1.3.5-alpha.0 → 1.3.5-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -18444,7 +18444,7 @@ function loadTokenizerFromDir(modelDir, maxLength) {
|
|
|
18444
18444
|
const tokenizerFilePath = path.default.join(modelDir.toString(), "tokenizer_config.json");
|
|
18445
18445
|
if (!fs.default.existsSync(tokenizerFilePath)) throw new Error(`Tokenizer config file not found at ${tokenizerFilePath}`);
|
|
18446
18446
|
const tokenizerConfig = JSON.parse(fs.default.readFileSync(tokenizerFilePath, "utf-8"));
|
|
18447
|
-
maxLength = Math.min(maxLength, tokenizerConfig["model_max_length"]);
|
|
18447
|
+
maxLength = Math.min(maxLength, tokenizerConfig["model_max_length"] ?? maxLength);
|
|
18448
18448
|
const tokensMapPath = path.default.join(modelDir.toString(), "special_tokens_map.json");
|
|
18449
18449
|
if (!fs.default.existsSync(tokensMapPath)) throw new Error(`Tokens map file not found at ${tokensMapPath}`);
|
|
18450
18450
|
const tokensMap = JSON.parse(fs.default.readFileSync(tokensMapPath, "utf-8"));
|
|
@@ -18654,7 +18654,10 @@ var SparseTextEmbedding = class SparseTextEmbedding extends SparseEmbedding {
|
|
|
18654
18654
|
return { tokenizer: loadTokenizerFromDir(modelDir, maxLength) };
|
|
18655
18655
|
}
|
|
18656
18656
|
static async retrieveModel(model, cacheDir, _showDownloadProgress = true) {
|
|
18657
|
-
if (!fs.default.existsSync(cacheDir)) fs.default.mkdirSync(cacheDir, {
|
|
18657
|
+
if (!fs.default.existsSync(cacheDir)) fs.default.mkdirSync(cacheDir, {
|
|
18658
|
+
recursive: true,
|
|
18659
|
+
mode: 493
|
|
18660
|
+
});
|
|
18658
18661
|
const modelDir = path.default.join(cacheDir.toString(), model.replace("/", "_"));
|
|
18659
18662
|
if (fs.default.existsSync(modelDir)) return modelDir;
|
|
18660
18663
|
const filesToDownload = [
|