claude-memory-layer 1.0.20 → 1.0.21

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.
@@ -91,8 +91,8 @@ var ConfigSchema = z.object({
91
91
  }).default({}),
92
92
  embedding: z.object({
93
93
  provider: z.enum(["local", "openai"]).default("local"),
94
- model: z.string().default("jinaai/jina-embeddings-v5-text-nano"),
95
- openaiModel: z.string().default("jinaai/jina-embeddings-v5-text-nano"),
94
+ model: z.string().default("jinaai/jina-embeddings-v5-text-nano-text-matching"),
95
+ openaiModel: z.string().default("jinaai/jina-embeddings-v5-text-nano-text-matching"),
96
96
  batchSize: z.number().default(32)
97
97
  }).default({}),
98
98
  retrieval: z.object({
@@ -3996,13 +3996,15 @@ var VectorStore = class {
3996
3996
  };
3997
3997
 
3998
3998
  // src/core/embedder.ts
3999
- import { pipeline } from "@xenova/transformers";
3999
+ import { pipeline } from "@huggingface/transformers";
4000
4000
  var Embedder = class {
4001
4001
  pipeline = null;
4002
4002
  modelName;
4003
+ activeModelName;
4003
4004
  initialized = false;
4004
- constructor(modelName = "jinaai/jina-embeddings-v5-text-nano") {
4005
+ constructor(modelName = "jinaai/jina-embeddings-v5-text-nano-text-matching") {
4005
4006
  this.modelName = modelName;
4007
+ this.activeModelName = modelName;
4006
4008
  }
4007
4009
  /**
4008
4010
  * Initialize the embedding pipeline
@@ -4010,8 +4012,21 @@ var Embedder = class {
4010
4012
  async initialize() {
4011
4013
  if (this.initialized)
4012
4014
  return;
4013
- this.pipeline = await pipeline("feature-extraction", this.modelName);
4014
- this.initialized = true;
4015
+ try {
4016
+ this.pipeline = await pipeline("feature-extraction", this.modelName);
4017
+ this.activeModelName = this.modelName;
4018
+ this.initialized = true;
4019
+ return;
4020
+ } catch (primaryError) {
4021
+ const fallbackModel = process.env.CLAUDE_MEMORY_EMBEDDING_FALLBACK_MODEL || "onnx-community/embeddinggemma-300m-ONNX";
4022
+ if (fallbackModel === this.modelName) {
4023
+ throw primaryError;
4024
+ }
4025
+ console.warn(`[Embedder] Primary model failed (${this.modelName}). Falling back to ${fallbackModel}`);
4026
+ this.pipeline = await pipeline("feature-extraction", fallbackModel);
4027
+ this.activeModelName = fallbackModel;
4028
+ this.initialized = true;
4029
+ }
4015
4030
  }
4016
4031
  /**
4017
4032
  * Generate embedding for a single text
@@ -4028,7 +4043,7 @@ var Embedder = class {
4028
4043
  const vector = Array.from(output.data);
4029
4044
  return {
4030
4045
  vector,
4031
- model: this.modelName,
4046
+ model: this.activeModelName,
4032
4047
  dimensions: vector.length
4033
4048
  };
4034
4049
  }
@@ -4052,7 +4067,7 @@ var Embedder = class {
4052
4067
  const vector = Array.from(output.data);
4053
4068
  results.push({
4054
4069
  vector,
4055
- model: this.modelName,
4070
+ model: this.activeModelName,
4056
4071
  dimensions: vector.length
4057
4072
  });
4058
4073
  }
@@ -4076,7 +4091,7 @@ var Embedder = class {
4076
4091
  * Get model name
4077
4092
  */
4078
4093
  getModelName() {
4079
- return this.modelName;
4094
+ return this.activeModelName;
4080
4095
  }
4081
4096
  };
4082
4097
  var defaultEmbedder = null;