Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

fix(embeddings): set FastEmbed embedding_dims from model metadata at init (#4711)

Prithvi Monangi2ec3c4ab2051
diff --git a/mem0/embeddings/fastembed.py b/mem0/embeddings/fastembed.py
index 83868f283..fadaedb8c 100644
--- a/mem0/embeddings/fastembed.py
+++ b/mem0/embeddings/fastembed.py
@@ -13,7 +13,10 @@ class FastEmbedEmbedding(EmbeddingBase):
super().__init__(config)
self.config.model = self.config.model or "thenlper/gte-large"
- self.dense_model = TextEmbedding(model_name = self.config.model)
+ self.dense_model = TextEmbedding(model_name=self.config.model)
+
+ if not self.config.embedding_dims:
+ self.config.embedding_dims = self.dense_model.embedding_size
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]] = None):
"""