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: Ollama checking model exists (#2682)

Vương Hữu Hưng (Hans)ff399e552806
diff --git a/mem0/embeddings/ollama.py b/mem0/embeddings/ollama.py
index 6f6d11810..49b7c2e94 100644
--- a/mem0/embeddings/ollama.py
+++ b/mem0/embeddings/ollama.py
@@ -36,7 +36,7 @@ class OllamaEmbedding(EmbeddingBase):
Ensure the specified model exists locally. If not, pull it from Ollama.
"""
local_models = self.client.list()["models"]
- if not any(model.get("name") == self.config.model for model in local_models):
+ if not any(model.get("name") == self.config.model or model.get("model") == self.config.model for model in local_models):
self.client.pull(self.config.model)
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]] = None):