mem0ai-azure-mysql 0.1.116.2__tar.gz → 0.1.116.4__tar.gz
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.
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/PKG-INFO +1 -1
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/azure_openai.py +17 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/base.py +13 -1
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/graph_memory.py +20 -5
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/main.py +3 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/utils.py +17 -1
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/pyproject.toml +1 -1
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/.gitignore +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/README.md +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/client/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/client/main.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/client/project.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/client/utils.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/dbs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/dbs/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/dbs/mysql.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/embeddings/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/embeddings/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/enums.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/anthropic.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/aws_bedrock.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/azure.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/deepseek.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/lmstudio.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/ollama.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/vllm.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/prompts.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/azure_ai_search.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/baidu.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/chroma.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/databricks.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/elasticsearch.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/faiss.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/milvus.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/mongodb.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/opensearch.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/pgvector.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/pinecone.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/qdrant.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/redis.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/supabase.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/upstash_vector.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/vertex_ai_vector_search.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/weaviate.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/dbs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/dbs/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/dbs/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/dbs/mysql.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/aws_bedrock.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/gemini.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/huggingface.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/lmstudio.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/mock.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/ollama.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/together.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/vertexai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/neptune/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/neptune/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/neptune/main.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/tools.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/utils.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/anthropic.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/aws_bedrock.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/azure_openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/azure_openai_structured.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/deepseek.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/gemini.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/groq.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/litellm.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/lmstudio.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/ollama.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/openai_structured.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/sarvam.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/together.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/vllm.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/xai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/kuzu_memory.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/memgraph_memory.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/setup.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/storage.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/telemetry.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/proxy/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/proxy/main.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/utils/factory.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/azure_ai_search.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/baidu.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/chroma.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/databricks.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/elasticsearch.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/faiss.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/milvus.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/mongodb.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/opensearch.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/pgvector.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/pinecone.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/qdrant.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/redis.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/supabase.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/upstash_vector.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/vertex_ai_vector_search.py +0 -0
- {mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/weaviate.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mem0ai-azure-mysql
|
|
3
|
-
Version: 0.1.116.
|
|
3
|
+
Version: 0.1.116.4
|
|
4
4
|
Summary: Long-term memory for AI Agents with Azure DefaultAzureCredential authentication and MySQL history database support
|
|
5
5
|
Requires-Python: <4.0,>=3.9
|
|
6
6
|
Requires-Dist: azure-identity>=1.23.1
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/azure_openai.py
RENAMED
|
@@ -6,6 +6,7 @@ from azure.identity import DefaultAzureCredential, get_bearer_token_provider
|
|
|
6
6
|
|
|
7
7
|
from mem0.configs.embeddings.base import BaseEmbedderConfig
|
|
8
8
|
from mem0.embeddings.base import EmbeddingBase
|
|
9
|
+
from mem0.memory.utils import time_perf
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class AzureOpenAIEmbedding(EmbeddingBase):
|
|
@@ -41,6 +42,7 @@ class AzureOpenAIEmbedding(EmbeddingBase):
|
|
|
41
42
|
**auth_kwargs,
|
|
42
43
|
)
|
|
43
44
|
|
|
45
|
+
@time_perf
|
|
44
46
|
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]] = None):
|
|
45
47
|
"""
|
|
46
48
|
Get the embedding for the given text using OpenAI.
|
|
@@ -53,3 +55,18 @@ class AzureOpenAIEmbedding(EmbeddingBase):
|
|
|
53
55
|
"""
|
|
54
56
|
text = text.replace("\n", " ")
|
|
55
57
|
return self.client.embeddings.create(input=[text], model=self.config.model).data[0].embedding
|
|
58
|
+
|
|
59
|
+
@time_perf
|
|
60
|
+
def embed_in_batch(self, texts, memory_action: Optional[Literal["add", "search", "update"]] = None):
|
|
61
|
+
"""
|
|
62
|
+
Get the embedding for the given texts.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
texts (list[str]): The text list to embed.
|
|
66
|
+
memory_action (optional): The type of embedding to use. Must be one of "add", "search", or "update". Defaults to None.
|
|
67
|
+
Returns:
|
|
68
|
+
list: List of the embedding vector.
|
|
69
|
+
"""
|
|
70
|
+
texts = [text.replace("\n", " ") for text in texts]
|
|
71
|
+
resp = self.client.embeddings.create(input=texts, model=self.config.model)
|
|
72
|
+
return [item.embedding for item in resp.data]
|
|
@@ -18,7 +18,7 @@ class EmbeddingBase(ABC):
|
|
|
18
18
|
self.config = config
|
|
19
19
|
|
|
20
20
|
@abstractmethod
|
|
21
|
-
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]]):
|
|
21
|
+
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]]) -> list[float]:
|
|
22
22
|
"""
|
|
23
23
|
Get the embedding for the given text.
|
|
24
24
|
|
|
@@ -29,3 +29,15 @@ class EmbeddingBase(ABC):
|
|
|
29
29
|
list: The embedding vector.
|
|
30
30
|
"""
|
|
31
31
|
pass
|
|
32
|
+
|
|
33
|
+
def embed_in_batch(self, texts, memory_action: Optional[Literal["add", "search", "update"]]) -> list[list[float]]:
|
|
34
|
+
"""
|
|
35
|
+
Get the embedding for the given texts.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
texts (list[str]): The text list to embed.
|
|
39
|
+
memory_action (optional): The type of embedding to use. Must be one of "add", "search", or "update". Defaults to None.
|
|
40
|
+
Returns:
|
|
41
|
+
list: List of the embedding vector.
|
|
42
|
+
"""
|
|
43
|
+
return [self.embed(text, memory_action) for text in texts]
|
|
@@ -3,7 +3,7 @@ import time
|
|
|
3
3
|
|
|
4
4
|
import cohere
|
|
5
5
|
|
|
6
|
-
from mem0.memory.utils import format_entities, sanitize_relationship_for_cypher
|
|
6
|
+
from mem0.memory.utils import format_entities, sanitize_relationship_for_cypher, time_perf
|
|
7
7
|
|
|
8
8
|
try:
|
|
9
9
|
from langchain_neo4j import Neo4jGraph
|
|
@@ -238,6 +238,7 @@ class MemoryGraph:
|
|
|
238
238
|
|
|
239
239
|
return final_results
|
|
240
240
|
|
|
241
|
+
@time_perf
|
|
241
242
|
def _retrieve_nodes_from_data(self, data, filters):
|
|
242
243
|
"""Extracts all the entities mentioned in the query."""
|
|
243
244
|
_tools = [EXTRACT_ENTITIES_TOOL]
|
|
@@ -271,6 +272,7 @@ class MemoryGraph:
|
|
|
271
272
|
logger.debug(f"Entity type map: {entity_type_map}\n search_results={search_results}")
|
|
272
273
|
return entity_type_map
|
|
273
274
|
|
|
275
|
+
@time_perf
|
|
274
276
|
def _establish_nodes_relations_from_data(self, data, filters, entity_type_map):
|
|
275
277
|
"""Establish relations among the extracted nodes."""
|
|
276
278
|
|
|
@@ -313,6 +315,7 @@ class MemoryGraph:
|
|
|
313
315
|
logger.debug(f"Extracted entities: {entities}")
|
|
314
316
|
return entities
|
|
315
317
|
|
|
318
|
+
@time_perf
|
|
316
319
|
def _search_graph_db(self, node_list, filters, limit=100):
|
|
317
320
|
"""Search similar nodes among and their respective incoming and outgoing relations."""
|
|
318
321
|
result_relations = []
|
|
@@ -324,9 +327,9 @@ class MemoryGraph:
|
|
|
324
327
|
if filters.get("run_id"):
|
|
325
328
|
node_props.append("run_id: $run_id")
|
|
326
329
|
node_props_str = ", ".join(node_props)
|
|
330
|
+
n_embeddings = self.embedding_model.embed_in_batch(node_list)
|
|
327
331
|
|
|
328
|
-
for
|
|
329
|
-
n_embedding = self.embedding_model.embed(node)
|
|
332
|
+
for n_embedding in n_embeddings:
|
|
330
333
|
|
|
331
334
|
cypher_query = f"""
|
|
332
335
|
MATCH (n {self.node_label} {{{node_props_str}}})
|
|
@@ -362,8 +365,18 @@ class MemoryGraph:
|
|
|
362
365
|
ans = self.graph.query(cypher_query, params=params)
|
|
363
366
|
result_relations.extend(ans)
|
|
364
367
|
|
|
365
|
-
|
|
366
|
-
|
|
368
|
+
# Remove duplicates, key is (source, relationship, destination)
|
|
369
|
+
seen = set()
|
|
370
|
+
unique_relations = []
|
|
371
|
+
for rel in result_relations:
|
|
372
|
+
key = (rel["source"], rel["relationship"], rel["destination"])
|
|
373
|
+
if key not in seen:
|
|
374
|
+
seen.add(key)
|
|
375
|
+
unique_relations.append(rel)
|
|
376
|
+
|
|
377
|
+
return unique_relations
|
|
378
|
+
|
|
379
|
+
@time_perf
|
|
367
380
|
def _get_delete_entities_from_search_output(self, search_output, data, filters):
|
|
368
381
|
"""Get the entities to be deleted from the search output."""
|
|
369
382
|
search_output_string = format_entities(search_output)
|
|
@@ -400,6 +413,7 @@ class MemoryGraph:
|
|
|
400
413
|
logger.debug(f"Deleted relationships: {to_be_deleted}")
|
|
401
414
|
return to_be_deleted
|
|
402
415
|
|
|
416
|
+
@time_perf
|
|
403
417
|
def _delete_entities(self, to_be_deleted, filters):
|
|
404
418
|
"""Delete the entities from the graph."""
|
|
405
419
|
user_id = filters["user_id"]
|
|
@@ -455,6 +469,7 @@ class MemoryGraph:
|
|
|
455
469
|
|
|
456
470
|
return results
|
|
457
471
|
|
|
472
|
+
@time_perf
|
|
458
473
|
def _add_entities(self, to_be_added, filters, entity_type_map):
|
|
459
474
|
"""Add the new entities to the graph. Merge the nodes if they already exist."""
|
|
460
475
|
user_id = filters["user_id"]
|
|
@@ -29,6 +29,7 @@ from mem0.memory.utils import (
|
|
|
29
29
|
parse_vision_messages,
|
|
30
30
|
process_telemetry_filters,
|
|
31
31
|
remove_code_blocks,
|
|
32
|
+
time_perf,
|
|
32
33
|
)
|
|
33
34
|
from mem0.utils.factory import (
|
|
34
35
|
EmbedderFactory,
|
|
@@ -282,6 +283,7 @@ class Memory(MemoryBase):
|
|
|
282
283
|
|
|
283
284
|
return {"results": vector_store_result}
|
|
284
285
|
|
|
286
|
+
@time_perf
|
|
285
287
|
def _add_to_vector_store(self, messages, metadata, filters, infer):
|
|
286
288
|
if not infer:
|
|
287
289
|
returned_memories = []
|
|
@@ -451,6 +453,7 @@ class Memory(MemoryBase):
|
|
|
451
453
|
)
|
|
452
454
|
return returned_memories
|
|
453
455
|
|
|
456
|
+
@time_perf
|
|
454
457
|
def _add_to_graph(self, messages, filters):
|
|
455
458
|
added_entities = []
|
|
456
459
|
if self.enable_graph:
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import hashlib
|
|
2
1
|
import re
|
|
2
|
+
import time
|
|
3
|
+
import hashlib
|
|
4
|
+
import logging
|
|
5
|
+
from functools import wraps
|
|
3
6
|
|
|
4
7
|
from mem0.configs.prompts import FACT_RETRIEVAL_PROMPT
|
|
5
8
|
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
6
10
|
|
|
7
11
|
def get_fact_retrieval_messages(message):
|
|
8
12
|
return FACT_RETRIEVAL_PROMPT, f"Input:\n{message}"
|
|
@@ -182,3 +186,15 @@ def sanitize_relationship_for_cypher(relationship) -> str:
|
|
|
182
186
|
sanitized = sanitized.replace(old, new)
|
|
183
187
|
|
|
184
188
|
return re.sub(r"_+", "_", sanitized).strip("_")
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def time_perf(func):
|
|
192
|
+
@wraps(func)
|
|
193
|
+
def wrapper(*args, **kwargs):
|
|
194
|
+
start = time.perf_counter()
|
|
195
|
+
result = func(*args, **kwargs)
|
|
196
|
+
end = time.perf_counter()
|
|
197
|
+
elapsed = end - start
|
|
198
|
+
logger.debug(f"[{func.__name__}] executed in {elapsed:.6f} seconds")
|
|
199
|
+
return result
|
|
200
|
+
return wrapper
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "mem0ai-azure-mysql"
|
|
7
|
-
version = "0.1.116.
|
|
7
|
+
version = "0.1.116.4"
|
|
8
8
|
description = "Long-term memory for AI Agents with Azure DefaultAzureCredential authentication and MySQL history database support"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9,<4.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/embeddings/__init__.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/embeddings/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/anthropic.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/aws_bedrock.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/baidu.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/chroma.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/faiss.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/milvus.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/mongodb.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/pgvector.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/pinecone.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/qdrant.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/redis.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/supabase.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/weaviate.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/aws_bedrock.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/huggingface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/neptune/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/azure_openai_structured.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/openai_structured.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/memgraph_memory.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/__init__.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/azure_ai_search.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/databricks.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/elasticsearch.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/langchain.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/opensearch.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/pgvector.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/pinecone.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/supabase.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/upstash_vector.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.2 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/weaviate.py
RENAMED
|
File without changes
|