mem0ai-azure-mysql 0.1.116.6__tar.gz → 0.1.116.7__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.6 → mem0ai_azure_mysql-0.1.116.7}/PKG-INFO +1 -1
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/memory/graph_memory.py +41 -20
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/memory/main.py +6 -6
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/memory/utils.py +2 -2
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/pyproject.toml +1 -1
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/.gitignore +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/README.md +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/client/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/client/main.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/client/project.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/client/utils.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/dbs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/dbs/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/dbs/mysql.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/embeddings/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/embeddings/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/enums.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/llms/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/llms/anthropic.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/llms/aws_bedrock.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/llms/azure.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/llms/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/llms/deepseek.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/llms/lmstudio.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/llms/ollama.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/llms/openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/llms/vllm.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/prompts.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/azure_ai_search.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/baidu.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/chroma.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/databricks.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/elasticsearch.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/faiss.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/milvus.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/mongodb.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/opensearch.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/pgvector.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/pinecone.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/qdrant.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/redis.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/supabase.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/upstash_vector.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/vertex_ai_vector_search.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/weaviate.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/dbs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/dbs/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/dbs/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/dbs/mysql.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/aws_bedrock.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/azure_openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/gemini.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/huggingface.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/lmstudio.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/mock.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/ollama.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/together.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/vertexai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/graphs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/graphs/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/graphs/neptune/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/graphs/neptune/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/graphs/neptune/main.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/graphs/tools.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/graphs/utils.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/anthropic.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/aws_bedrock.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/azure_openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/azure_openai_structured.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/deepseek.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/gemini.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/groq.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/litellm.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/lmstudio.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/ollama.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/openai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/openai_structured.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/sarvam.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/together.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/vllm.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/llms/xai.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/memory/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/memory/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/memory/kuzu_memory.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/memory/memgraph_memory.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/memory/setup.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/memory/storage.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/memory/telemetry.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/proxy/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/proxy/main.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/utils/factory.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/azure_ai_search.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/baidu.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/base.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/chroma.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/databricks.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/elasticsearch.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/faiss.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/milvus.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/mongodb.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/opensearch.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/pgvector.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/pinecone.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/qdrant.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/redis.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/supabase.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/upstash_vector.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/vertex_ai_vector_search.py +0 -0
- {mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/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.7
|
|
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
|
|
@@ -76,7 +76,7 @@ class MemoryGraph:
|
|
|
76
76
|
self.threshold = self.config.graph_store.config.similarity_threshold
|
|
77
77
|
self.top_k = self.config.graph_store.config.top_k
|
|
78
78
|
|
|
79
|
-
def add(self, data, filters):
|
|
79
|
+
def add(self, data, metadata, filters):
|
|
80
80
|
"""
|
|
81
81
|
Adds data to the graph.
|
|
82
82
|
|
|
@@ -92,7 +92,7 @@ class MemoryGraph:
|
|
|
92
92
|
# TODO: Batch queries with APOC plugin
|
|
93
93
|
# TODO: Add more filter support
|
|
94
94
|
deleted_entities = self._delete_entities(to_be_deleted, filters)
|
|
95
|
-
added_entities = self._add_entities(to_be_added, filters, entity_type_map)
|
|
95
|
+
added_entities = self._add_entities(to_be_added, metadata, filters, entity_type_map)
|
|
96
96
|
|
|
97
97
|
return {"deleted_entities": deleted_entities, "added_entities": added_entities}
|
|
98
98
|
|
|
@@ -129,6 +129,7 @@ class MemoryGraph:
|
|
|
129
129
|
"relationship": item[1],
|
|
130
130
|
"destination": item[2],
|
|
131
131
|
"score": item[3] if len(item) > 3 else 0.0,
|
|
132
|
+
"metadata": item[4] if len(item) > 4 else {},
|
|
132
133
|
}
|
|
133
134
|
)
|
|
134
135
|
|
|
@@ -143,13 +144,9 @@ class MemoryGraph:
|
|
|
143
144
|
@time_perf
|
|
144
145
|
def rerank(self, search_output, query):
|
|
145
146
|
if not self.config.graph_store.config.rerank:
|
|
146
|
-
|
|
147
|
-
[item["source"], item["relationship"], item["destination"]] for item in search_output
|
|
147
|
+
return [
|
|
148
|
+
[item["source"], item["relationship"], item["destination"], 0.0, item.get("metadata", {})] for item in search_output
|
|
148
149
|
]
|
|
149
|
-
bm25 = BM25Okapi(search_outputs_sequence)
|
|
150
|
-
|
|
151
|
-
tokenized_query = query.split(" ")
|
|
152
|
-
return bm25.get_top_n(tokenized_query, search_outputs_sequence, n=5)
|
|
153
150
|
|
|
154
151
|
# Only cohere is supported for now
|
|
155
152
|
rerank_config = self.config.graph_store.config.rerank.config
|
|
@@ -172,7 +169,8 @@ class MemoryGraph:
|
|
|
172
169
|
original_output["source"],
|
|
173
170
|
original_output["relationship"],
|
|
174
171
|
original_output["destination"],
|
|
175
|
-
result.relevance_score
|
|
172
|
+
result.relevance_score,
|
|
173
|
+
original_output["metadata"],
|
|
176
174
|
])
|
|
177
175
|
return reranked_results
|
|
178
176
|
|
|
@@ -338,14 +336,14 @@ class MemoryGraph:
|
|
|
338
336
|
CALL {{
|
|
339
337
|
WITH n, row
|
|
340
338
|
MATCH (n)-[r]->(m {self.node_label} {{{node_props_str}}})
|
|
341
|
-
RETURN n.name AS source, elementId(n) AS source_id, type(r) AS relationship, elementId(r) AS relation_id, m.name AS destination, elementId(m) AS destination_id
|
|
339
|
+
RETURN n.name AS source, elementId(n) AS source_id, n.note_ids AS source_note_ids, type(r) AS relationship, elementId(r) AS relation_id, m.name AS destination, elementId(m) AS destination_id, m.note_ids AS destination_note_ids
|
|
342
340
|
UNION
|
|
343
341
|
WITH n, row
|
|
344
342
|
MATCH (n)<-[r]-(m {self.node_label} {{{node_props_str}}})
|
|
345
|
-
RETURN m.name AS source, elementId(m) AS source_id, type(r) AS relationship, elementId(r) AS relation_id, n.name AS destination, elementId(n) AS destination_id
|
|
343
|
+
RETURN m.name AS source, elementId(m) AS source_id, m.note_ids AS source_note_ids, type(r) AS relationship, elementId(r) AS relation_id, n.name AS destination, elementId(n) AS destination_id, n.note_ids AS destination_note_ids
|
|
346
344
|
}}
|
|
347
|
-
WITH distinct source, source_id, relationship, relation_id, destination, destination_id, similarity
|
|
348
|
-
RETURN source, source_id, relationship, relation_id, destination, destination_id, similarity
|
|
345
|
+
WITH distinct source, source_id, relationship, relation_id, destination, destination_id, similarity, source_note_ids, destination_note_ids
|
|
346
|
+
RETURN source, source_id, relationship, relation_id, destination, destination_id, similarity, {{note_ids: source_note_ids + destination_note_ids}} AS metadata
|
|
349
347
|
ORDER BY similarity DESC
|
|
350
348
|
LIMIT {limit}
|
|
351
349
|
"""
|
|
@@ -373,6 +371,12 @@ class MemoryGraph:
|
|
|
373
371
|
key = (rel["source"], rel["relationship"], rel["destination"])
|
|
374
372
|
if key not in seen:
|
|
375
373
|
seen.add(key)
|
|
374
|
+
|
|
375
|
+
original_metadata = rel.get("metadata", {})
|
|
376
|
+
rel["metadata"] = {
|
|
377
|
+
"note_ids": list(set(original_metadata.get("note_ids", []))),
|
|
378
|
+
}
|
|
379
|
+
|
|
376
380
|
unique_relations.append(rel)
|
|
377
381
|
|
|
378
382
|
return unique_relations
|
|
@@ -471,7 +475,7 @@ class MemoryGraph:
|
|
|
471
475
|
return results
|
|
472
476
|
|
|
473
477
|
@time_perf
|
|
474
|
-
def _add_entities(self, to_be_added, filters, entity_type_map):
|
|
478
|
+
def _add_entities(self, to_be_added, metadata, filters, entity_type_map):
|
|
475
479
|
"""Add the new entities to the graph. Merge the nodes if they already exist."""
|
|
476
480
|
user_id = filters["user_id"]
|
|
477
481
|
agent_id = filters.get("agent_id", None)
|
|
@@ -486,6 +490,9 @@ class MemoryGraph:
|
|
|
486
490
|
entities_to_embed = list(entities_to_embed)
|
|
487
491
|
embeddings = self.embedding_model.embed_in_batch(entities_to_embed)
|
|
488
492
|
embedding_map = {entity: embedding for entity, embedding in zip(entities_to_embed, embeddings)}
|
|
493
|
+
|
|
494
|
+
# metadata
|
|
495
|
+
note_ids = metadata.pop("note_ids", [])
|
|
489
496
|
|
|
490
497
|
for item in to_be_added:
|
|
491
498
|
# entities
|
|
@@ -523,14 +530,17 @@ class MemoryGraph:
|
|
|
523
530
|
MATCH (source)
|
|
524
531
|
WHERE elementId(source) = $source_id
|
|
525
532
|
SET source.mentions = coalesce(source.mentions, 0) + 1
|
|
533
|
+
SET source.note_ids = coalesce(source.note_ids, []) + $note_ids
|
|
526
534
|
WITH source
|
|
527
535
|
MERGE (destination {destination_label} {{{merge_props_str}}})
|
|
528
536
|
ON CREATE SET
|
|
529
537
|
destination.created = timestamp(),
|
|
530
|
-
destination.mentions = 1
|
|
538
|
+
destination.mentions = 1,
|
|
539
|
+
destination.note_ids = $note_ids
|
|
531
540
|
{destination_extra_set}
|
|
532
541
|
ON MATCH SET
|
|
533
|
-
destination.mentions = coalesce(destination.mentions, 0) + 1
|
|
542
|
+
destination.mentions = coalesce(destination.mentions, 0) + 1,
|
|
543
|
+
destination.note_ids = coalesce(destination.note_ids, []) + $note_ids
|
|
534
544
|
WITH source, destination
|
|
535
545
|
CALL db.create.setNodeVectorProperty(destination, 'embedding', $destination_embedding)
|
|
536
546
|
WITH source, destination
|
|
@@ -548,6 +558,7 @@ class MemoryGraph:
|
|
|
548
558
|
"destination_name": destination,
|
|
549
559
|
"destination_embedding": dest_embedding,
|
|
550
560
|
"user_id": user_id,
|
|
561
|
+
"note_ids": note_ids,
|
|
551
562
|
}
|
|
552
563
|
if agent_id:
|
|
553
564
|
params["agent_id"] = agent_id
|
|
@@ -567,14 +578,17 @@ class MemoryGraph:
|
|
|
567
578
|
MATCH (destination)
|
|
568
579
|
WHERE elementId(destination) = $destination_id
|
|
569
580
|
SET destination.mentions = coalesce(destination.mentions, 0) + 1
|
|
581
|
+
SET destination.note_ids = coalesce(destination.note_ids, []) + $note_ids
|
|
570
582
|
WITH destination
|
|
571
583
|
MERGE (source {source_label} {{{merge_props_str}}})
|
|
572
584
|
ON CREATE SET
|
|
573
585
|
source.created = timestamp(),
|
|
574
|
-
source.mentions = 1
|
|
586
|
+
source.mentions = 1,
|
|
587
|
+
source.note_ids = $note_ids
|
|
575
588
|
{source_extra_set}
|
|
576
589
|
ON MATCH SET
|
|
577
|
-
source.mentions = coalesce(source.mentions, 0) + 1
|
|
590
|
+
source.mentions = coalesce(source.mentions, 0) + 1,
|
|
591
|
+
source.note_ids = coalesce(source.note_ids, []) + $note_ids
|
|
578
592
|
WITH source, destination
|
|
579
593
|
CALL db.create.setNodeVectorProperty(source, 'embedding', $source_embedding)
|
|
580
594
|
WITH source, destination
|
|
@@ -592,6 +606,7 @@ class MemoryGraph:
|
|
|
592
606
|
"source_name": source,
|
|
593
607
|
"source_embedding": source_embedding,
|
|
594
608
|
"user_id": user_id,
|
|
609
|
+
"note_ids": note_ids,
|
|
595
610
|
}
|
|
596
611
|
if agent_id:
|
|
597
612
|
params["agent_id"] = agent_id
|
|
@@ -603,10 +618,12 @@ class MemoryGraph:
|
|
|
603
618
|
MATCH (source)
|
|
604
619
|
WHERE elementId(source) = $source_id
|
|
605
620
|
SET source.mentions = coalesce(source.mentions, 0) + 1
|
|
621
|
+
SET source.note_ids = coalesce(source.note_ids, []) + $note_ids
|
|
606
622
|
WITH source
|
|
607
623
|
MATCH (destination)
|
|
608
624
|
WHERE elementId(destination) = $destination_id
|
|
609
625
|
SET destination.mentions = coalesce(destination.mentions, 0) + 1
|
|
626
|
+
SET destination.note_ids = coalesce(destination.note_ids, []) + $note_ids
|
|
610
627
|
MERGE (source)-[r:{relationship}]->(destination)
|
|
611
628
|
ON CREATE SET
|
|
612
629
|
r.created_at = timestamp(),
|
|
@@ -620,6 +637,7 @@ class MemoryGraph:
|
|
|
620
637
|
"source_id": source_node_search_result[0]["elementId(source_candidate)"],
|
|
621
638
|
"destination_id": destination_node_search_result[0]["elementId(destination_candidate)"],
|
|
622
639
|
"user_id": user_id,
|
|
640
|
+
"note_ids": note_ids,
|
|
623
641
|
}
|
|
624
642
|
if agent_id:
|
|
625
643
|
params["agent_id"] = agent_id
|
|
@@ -642,7 +660,8 @@ class MemoryGraph:
|
|
|
642
660
|
cypher = f"""
|
|
643
661
|
MERGE (source {source_label} {{{source_props_str}}})
|
|
644
662
|
ON CREATE SET source.created = timestamp(),
|
|
645
|
-
source.mentions = 1
|
|
663
|
+
source.mentions = 1,
|
|
664
|
+
source.note_ids = $note_ids
|
|
646
665
|
{source_extra_set}
|
|
647
666
|
ON MATCH SET source.mentions = coalesce(source.mentions, 0) + 1
|
|
648
667
|
WITH source
|
|
@@ -650,7 +669,8 @@ class MemoryGraph:
|
|
|
650
669
|
WITH source
|
|
651
670
|
MERGE (destination {destination_label} {{{dest_props_str}}})
|
|
652
671
|
ON CREATE SET destination.created = timestamp(),
|
|
653
|
-
destination.mentions = 1
|
|
672
|
+
destination.mentions = 1,
|
|
673
|
+
destination.note_ids = $note_ids
|
|
654
674
|
{destination_extra_set}
|
|
655
675
|
ON MATCH SET destination.mentions = coalesce(destination.mentions, 0) + 1
|
|
656
676
|
WITH source, destination
|
|
@@ -668,6 +688,7 @@ class MemoryGraph:
|
|
|
668
688
|
"source_embedding": source_embedding,
|
|
669
689
|
"dest_embedding": dest_embedding,
|
|
670
690
|
"user_id": user_id,
|
|
691
|
+
"note_ids": note_ids,
|
|
671
692
|
}
|
|
672
693
|
if agent_id:
|
|
673
694
|
params["agent_id"] = agent_id
|
|
@@ -258,7 +258,7 @@ class Memory(MemoryBase):
|
|
|
258
258
|
|
|
259
259
|
with concurrent.futures.ThreadPoolExecutor() as executor:
|
|
260
260
|
future1 = executor.submit(self._add_to_vector_store, messages, processed_metadata, effective_filters, infer)
|
|
261
|
-
future2 = executor.submit(self._add_to_graph, messages, effective_filters)
|
|
261
|
+
future2 = executor.submit(self._add_to_graph, messages, processed_metadata, effective_filters)
|
|
262
262
|
|
|
263
263
|
concurrent.futures.wait([future1, future2])
|
|
264
264
|
|
|
@@ -454,14 +454,14 @@ class Memory(MemoryBase):
|
|
|
454
454
|
return returned_memories
|
|
455
455
|
|
|
456
456
|
@time_perf
|
|
457
|
-
def _add_to_graph(self, messages, filters):
|
|
457
|
+
def _add_to_graph(self, messages, metadata, filters):
|
|
458
458
|
added_entities = []
|
|
459
459
|
if self.enable_graph:
|
|
460
460
|
if filters.get("user_id") is None:
|
|
461
461
|
filters["user_id"] = "user"
|
|
462
462
|
|
|
463
463
|
data = "\n".join([msg["content"] for msg in messages if "content" in msg and msg["role"] != "system"])
|
|
464
|
-
added_entities = self.graph.add(data, filters)
|
|
464
|
+
added_entities = self.graph.add(data, metadata, filters)
|
|
465
465
|
|
|
466
466
|
return added_entities
|
|
467
467
|
|
|
@@ -1100,7 +1100,7 @@ class AsyncMemory(MemoryBase):
|
|
|
1100
1100
|
vector_store_task = asyncio.create_task(
|
|
1101
1101
|
self._add_to_vector_store(messages, processed_metadata, effective_filters, infer)
|
|
1102
1102
|
)
|
|
1103
|
-
graph_task = asyncio.create_task(self._add_to_graph(messages, effective_filters))
|
|
1103
|
+
graph_task = asyncio.create_task(self._add_to_graph(messages, processed_metadata, effective_filters))
|
|
1104
1104
|
|
|
1105
1105
|
vector_store_result, graph_result = await asyncio.gather(vector_store_task, graph_task)
|
|
1106
1106
|
|
|
@@ -1308,14 +1308,14 @@ class AsyncMemory(MemoryBase):
|
|
|
1308
1308
|
return returned_memories
|
|
1309
1309
|
|
|
1310
1310
|
@time_perf
|
|
1311
|
-
async def _add_to_graph(self, messages, filters):
|
|
1311
|
+
async def _add_to_graph(self, messages, metadata, filters):
|
|
1312
1312
|
added_entities = []
|
|
1313
1313
|
if self.enable_graph:
|
|
1314
1314
|
if filters.get("user_id") is None:
|
|
1315
1315
|
filters["user_id"] = "user"
|
|
1316
1316
|
|
|
1317
1317
|
data = "\n".join([msg["content"] for msg in messages if "content" in msg and msg["role"] != "system"])
|
|
1318
|
-
added_entities = await asyncio.to_thread(self.graph.add, data, filters)
|
|
1318
|
+
added_entities = await asyncio.to_thread(self.graph.add, data, metadata, filters)
|
|
1319
1319
|
|
|
1320
1320
|
return added_entities
|
|
1321
1321
|
|
|
@@ -197,7 +197,7 @@ def time_perf(func):
|
|
|
197
197
|
result = await func(*args, **kwargs)
|
|
198
198
|
end = time.perf_counter()
|
|
199
199
|
elapsed = end - start
|
|
200
|
-
logger.
|
|
200
|
+
logger.warning(f"[Mem0 time perf][{func.__name__}] executed in {elapsed:.6f} seconds")
|
|
201
201
|
return result
|
|
202
202
|
return async_wrapper
|
|
203
203
|
else:
|
|
@@ -207,6 +207,6 @@ def time_perf(func):
|
|
|
207
207
|
result = func(*args, **kwargs)
|
|
208
208
|
end = time.perf_counter()
|
|
209
209
|
elapsed = end - start
|
|
210
|
-
logger.
|
|
210
|
+
logger.warning(f"[Mem0 time perf][{func.__name__}] executed in {elapsed:.6f} seconds")
|
|
211
211
|
return result
|
|
212
212
|
return sync_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.7"
|
|
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.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/embeddings/__init__.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/embeddings/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/llms/anthropic.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/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.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/baidu.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/chroma.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/faiss.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/milvus.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/mongodb.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/pgvector.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/pinecone.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/qdrant.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/redis.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/configs/vector_stores/supabase.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/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.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/aws_bedrock.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/embeddings/azure_openai.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/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.6 → mem0ai_azure_mysql-0.1.116.7}/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.6 → mem0ai_azure_mysql-0.1.116.7}/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.6 → mem0ai_azure_mysql-0.1.116.7}/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.6 → mem0ai_azure_mysql-0.1.116.7}/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.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/__init__.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/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.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/databricks.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/elasticsearch.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/langchain.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/opensearch.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/pgvector.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/pinecone.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/supabase.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/upstash_vector.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.116.6 → mem0ai_azure_mysql-0.1.116.7}/mem0/vector_stores/weaviate.py
RENAMED
|
File without changes
|