mem0ai-azure-mysql 0.1.116.3__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.3 → mem0ai_azure_mysql-0.1.116.4}/PKG-INFO +1 -1
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/azure_openai.py +17 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/base.py +13 -1
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/graph_memory.py +10 -9
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/main.py +3 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/utils.py +17 -1
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/pyproject.toml +1 -1
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/.gitignore +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/README.md +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/client/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/client/main.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/client/project.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/client/utils.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/dbs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/dbs/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/dbs/mysql.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/embeddings/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/embeddings/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/enums.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/anthropic.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/aws_bedrock.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/azure.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/deepseek.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/lmstudio.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/ollama.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/vllm.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/prompts.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/azure_ai_search.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/baidu.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/chroma.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/databricks.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/elasticsearch.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/faiss.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/milvus.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/mongodb.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/opensearch.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/pgvector.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/pinecone.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/qdrant.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/redis.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/supabase.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/upstash_vector.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/vertex_ai_vector_search.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/weaviate.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/dbs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/dbs/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/dbs/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/dbs/mysql.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/aws_bedrock.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/gemini.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/huggingface.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/lmstudio.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/mock.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/ollama.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/together.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/embeddings/vertexai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/neptune/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/neptune/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/neptune/main.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/tools.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/graphs/utils.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/anthropic.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/aws_bedrock.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/azure_openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/azure_openai_structured.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/deepseek.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/gemini.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/groq.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/litellm.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/lmstudio.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/ollama.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/openai_structured.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/sarvam.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/together.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/vllm.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/llms/xai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/kuzu_memory.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/memgraph_memory.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/setup.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/storage.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/memory/telemetry.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/proxy/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/proxy/main.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/utils/factory.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/azure_ai_search.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/baidu.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/chroma.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/databricks.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/elasticsearch.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/faiss.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/milvus.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/mongodb.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/opensearch.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/pgvector.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/pinecone.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/qdrant.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/redis.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/supabase.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/upstash_vector.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/vertex_ai_vector_search.py +0 -0
- {mem0ai_azure_mysql-0.1.116.3 → 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.3 → 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
|
|
@@ -114,8 +114,6 @@ class MemoryGraph:
|
|
|
114
114
|
logger.info(f"Searching for query in neo4j: {query} with filters: {filters}")
|
|
115
115
|
entity_type_map = self._retrieve_nodes_from_data(query, filters)
|
|
116
116
|
search_output = self._search_graph_db(node_list=list(entity_type_map.keys()), filters=filters)
|
|
117
|
-
print(f'entity_type_map: {entity_type_map}')
|
|
118
|
-
print(f'search_output: {search_output}')
|
|
119
117
|
|
|
120
118
|
if not search_output:
|
|
121
119
|
return []
|
|
@@ -158,14 +156,12 @@ class MemoryGraph:
|
|
|
158
156
|
base_url=rerank_config.get("base_url"),
|
|
159
157
|
)
|
|
160
158
|
docs = [f'{item["source"]} {item["relationship"]} {item["destination"]}' for item in search_output]
|
|
161
|
-
print(f'docs: {docs}')
|
|
162
159
|
response = co.rerank(
|
|
163
160
|
model=rerank_config.get("model"),
|
|
164
161
|
query=query,
|
|
165
162
|
documents=docs,
|
|
166
163
|
top_n=self.top_k,
|
|
167
164
|
)
|
|
168
|
-
print(f'response.results: {response.results}')
|
|
169
165
|
|
|
170
166
|
reranked_results = []
|
|
171
167
|
for result in response.results:
|
|
@@ -176,7 +172,6 @@ class MemoryGraph:
|
|
|
176
172
|
original_output["destination"],
|
|
177
173
|
result.relevance_score
|
|
178
174
|
])
|
|
179
|
-
print(f'reranked_results: {reranked_results}')
|
|
180
175
|
return reranked_results
|
|
181
176
|
|
|
182
177
|
def delete_all(self, filters):
|
|
@@ -243,6 +238,7 @@ class MemoryGraph:
|
|
|
243
238
|
|
|
244
239
|
return final_results
|
|
245
240
|
|
|
241
|
+
@time_perf
|
|
246
242
|
def _retrieve_nodes_from_data(self, data, filters):
|
|
247
243
|
"""Extracts all the entities mentioned in the query."""
|
|
248
244
|
_tools = [EXTRACT_ENTITIES_TOOL]
|
|
@@ -276,6 +272,7 @@ class MemoryGraph:
|
|
|
276
272
|
logger.debug(f"Entity type map: {entity_type_map}\n search_results={search_results}")
|
|
277
273
|
return entity_type_map
|
|
278
274
|
|
|
275
|
+
@time_perf
|
|
279
276
|
def _establish_nodes_relations_from_data(self, data, filters, entity_type_map):
|
|
280
277
|
"""Establish relations among the extracted nodes."""
|
|
281
278
|
|
|
@@ -318,6 +315,7 @@ class MemoryGraph:
|
|
|
318
315
|
logger.debug(f"Extracted entities: {entities}")
|
|
319
316
|
return entities
|
|
320
317
|
|
|
318
|
+
@time_perf
|
|
321
319
|
def _search_graph_db(self, node_list, filters, limit=100):
|
|
322
320
|
"""Search similar nodes among and their respective incoming and outgoing relations."""
|
|
323
321
|
result_relations = []
|
|
@@ -329,9 +327,9 @@ class MemoryGraph:
|
|
|
329
327
|
if filters.get("run_id"):
|
|
330
328
|
node_props.append("run_id: $run_id")
|
|
331
329
|
node_props_str = ", ".join(node_props)
|
|
330
|
+
n_embeddings = self.embedding_model.embed_in_batch(node_list)
|
|
332
331
|
|
|
333
|
-
for
|
|
334
|
-
n_embedding = self.embedding_model.embed(node)
|
|
332
|
+
for n_embedding in n_embeddings:
|
|
335
333
|
|
|
336
334
|
cypher_query = f"""
|
|
337
335
|
MATCH (n {self.node_label} {{{node_props_str}}})
|
|
@@ -377,7 +375,8 @@ class MemoryGraph:
|
|
|
377
375
|
unique_relations.append(rel)
|
|
378
376
|
|
|
379
377
|
return unique_relations
|
|
380
|
-
|
|
378
|
+
|
|
379
|
+
@time_perf
|
|
381
380
|
def _get_delete_entities_from_search_output(self, search_output, data, filters):
|
|
382
381
|
"""Get the entities to be deleted from the search output."""
|
|
383
382
|
search_output_string = format_entities(search_output)
|
|
@@ -414,6 +413,7 @@ class MemoryGraph:
|
|
|
414
413
|
logger.debug(f"Deleted relationships: {to_be_deleted}")
|
|
415
414
|
return to_be_deleted
|
|
416
415
|
|
|
416
|
+
@time_perf
|
|
417
417
|
def _delete_entities(self, to_be_deleted, filters):
|
|
418
418
|
"""Delete the entities from the graph."""
|
|
419
419
|
user_id = filters["user_id"]
|
|
@@ -469,6 +469,7 @@ class MemoryGraph:
|
|
|
469
469
|
|
|
470
470
|
return results
|
|
471
471
|
|
|
472
|
+
@time_perf
|
|
472
473
|
def _add_entities(self, to_be_added, filters, entity_type_map):
|
|
473
474
|
"""Add the new entities to the graph. Merge the nodes if they already exist."""
|
|
474
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.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/embeddings/__init__.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → 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.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/llms/anthropic.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → 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.3 → 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.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/baidu.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → 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.3 → 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.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/milvus.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → 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.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/pgvector.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/pinecone.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/qdrant.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/configs/vector_stores/redis.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → 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.3 → 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.3 → 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.3 → 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.3 → 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.3 → 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.3 → 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.3 → 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.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/__init__.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → 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.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/databricks.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → 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.3 → 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.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/opensearch.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/pgvector.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → 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.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/supabase.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.3 → 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.3 → mem0ai_azure_mysql-0.1.116.4}/mem0/vector_stores/weaviate.py
RENAMED
|
File without changes
|