mem0ai-azure-mysql 0.1.116.12__tar.gz → 0.2.1__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.
Files changed (131) hide show
  1. mem0ai_azure_mysql-0.2.1/PKG-INFO +202 -0
  2. mem0ai_azure_mysql-0.2.1/README.md +181 -0
  3. mem0ai_azure_mysql-0.2.1/mem0/__init__.py +5 -0
  4. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/configs/llms/base.py +1 -1
  5. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/embeddings/configs.py +3 -14
  6. mem0ai_azure_mysql-0.2.1/mem0/graphs/configs.py +64 -0
  7. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/llms/azure_openai.py +1 -1
  8. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/llms/configs.py +2 -20
  9. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/memory/main.py +0 -861
  10. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/utils/factory.py +3 -55
  11. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/vector_stores/configs.py +2 -23
  12. mem0ai_azure_mysql-0.2.1/pyproject.toml +62 -0
  13. mem0ai_azure_mysql-0.1.116.12/PKG-INFO +0 -89
  14. mem0ai_azure_mysql-0.1.116.12/README.md +0 -24
  15. mem0ai_azure_mysql-0.1.116.12/mem0/__init__.py +0 -6
  16. mem0ai_azure_mysql-0.1.116.12/mem0/client/main.py +0 -1538
  17. mem0ai_azure_mysql-0.1.116.12/mem0/client/project.py +0 -860
  18. mem0ai_azure_mysql-0.1.116.12/mem0/client/utils.py +0 -29
  19. mem0ai_azure_mysql-0.1.116.12/mem0/configs/llms/anthropic.py +0 -56
  20. mem0ai_azure_mysql-0.1.116.12/mem0/configs/llms/aws_bedrock.py +0 -191
  21. mem0ai_azure_mysql-0.1.116.12/mem0/configs/llms/deepseek.py +0 -56
  22. mem0ai_azure_mysql-0.1.116.12/mem0/configs/llms/lmstudio.py +0 -59
  23. mem0ai_azure_mysql-0.1.116.12/mem0/configs/llms/ollama.py +0 -56
  24. mem0ai_azure_mysql-0.1.116.12/mem0/configs/llms/openai.py +0 -76
  25. mem0ai_azure_mysql-0.1.116.12/mem0/configs/llms/vllm.py +0 -56
  26. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/baidu.py +0 -29
  27. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/chroma.py +0 -40
  28. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/databricks.py +0 -63
  29. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/elasticsearch.py +0 -65
  30. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/faiss.py +0 -39
  31. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/langchain.py +0 -32
  32. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/milvus.py +0 -44
  33. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/mongodb.py +0 -25
  34. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/opensearch.py +0 -41
  35. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/pgvector.py +0 -50
  36. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/pinecone.py +0 -57
  37. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/qdrant.py +0 -49
  38. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/redis.py +0 -26
  39. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/supabase.py +0 -44
  40. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/upstash_vector.py +0 -36
  41. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/vertex_ai_vector_search.py +0 -27
  42. mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores/weaviate.py +0 -43
  43. mem0ai_azure_mysql-0.1.116.12/mem0/embeddings/aws_bedrock.py +0 -100
  44. mem0ai_azure_mysql-0.1.116.12/mem0/embeddings/gemini.py +0 -39
  45. mem0ai_azure_mysql-0.1.116.12/mem0/embeddings/huggingface.py +0 -41
  46. mem0ai_azure_mysql-0.1.116.12/mem0/embeddings/langchain.py +0 -35
  47. mem0ai_azure_mysql-0.1.116.12/mem0/embeddings/lmstudio.py +0 -29
  48. mem0ai_azure_mysql-0.1.116.12/mem0/embeddings/mock.py +0 -11
  49. mem0ai_azure_mysql-0.1.116.12/mem0/embeddings/ollama.py +0 -53
  50. mem0ai_azure_mysql-0.1.116.12/mem0/embeddings/openai.py +0 -49
  51. mem0ai_azure_mysql-0.1.116.12/mem0/embeddings/together.py +0 -31
  52. mem0ai_azure_mysql-0.1.116.12/mem0/embeddings/vertexai.py +0 -54
  53. mem0ai_azure_mysql-0.1.116.12/mem0/graphs/configs.py +0 -120
  54. mem0ai_azure_mysql-0.1.116.12/mem0/graphs/neptune/base.py +0 -410
  55. mem0ai_azure_mysql-0.1.116.12/mem0/graphs/neptune/main.py +0 -373
  56. mem0ai_azure_mysql-0.1.116.12/mem0/llms/anthropic.py +0 -87
  57. mem0ai_azure_mysql-0.1.116.12/mem0/llms/aws_bedrock.py +0 -600
  58. mem0ai_azure_mysql-0.1.116.12/mem0/llms/azure_openai_structured.py +0 -91
  59. mem0ai_azure_mysql-0.1.116.12/mem0/llms/deepseek.py +0 -107
  60. mem0ai_azure_mysql-0.1.116.12/mem0/llms/gemini.py +0 -201
  61. mem0ai_azure_mysql-0.1.116.12/mem0/llms/groq.py +0 -88
  62. mem0ai_azure_mysql-0.1.116.12/mem0/llms/langchain.py +0 -65
  63. mem0ai_azure_mysql-0.1.116.12/mem0/llms/litellm.py +0 -87
  64. mem0ai_azure_mysql-0.1.116.12/mem0/llms/lmstudio.py +0 -114
  65. mem0ai_azure_mysql-0.1.116.12/mem0/llms/ollama.py +0 -106
  66. mem0ai_azure_mysql-0.1.116.12/mem0/llms/openai.py +0 -141
  67. mem0ai_azure_mysql-0.1.116.12/mem0/llms/openai_structured.py +0 -52
  68. mem0ai_azure_mysql-0.1.116.12/mem0/llms/sarvam.py +0 -89
  69. mem0ai_azure_mysql-0.1.116.12/mem0/llms/together.py +0 -88
  70. mem0ai_azure_mysql-0.1.116.12/mem0/llms/vllm.py +0 -107
  71. mem0ai_azure_mysql-0.1.116.12/mem0/llms/xai.py +0 -52
  72. mem0ai_azure_mysql-0.1.116.12/mem0/memory/__init__.py +0 -0
  73. mem0ai_azure_mysql-0.1.116.12/mem0/memory/kuzu_memory.py +0 -710
  74. mem0ai_azure_mysql-0.1.116.12/mem0/memory/memgraph_memory.py +0 -638
  75. mem0ai_azure_mysql-0.1.116.12/mem0/proxy/__init__.py +0 -0
  76. mem0ai_azure_mysql-0.1.116.12/mem0/proxy/main.py +0 -189
  77. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/__init__.py +0 -0
  78. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/baidu.py +0 -368
  79. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/chroma.py +0 -254
  80. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/databricks.py +0 -759
  81. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/elasticsearch.py +0 -237
  82. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/faiss.py +0 -473
  83. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/langchain.py +0 -180
  84. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/milvus.py +0 -247
  85. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/mongodb.py +0 -312
  86. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/opensearch.py +0 -281
  87. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/pgvector.py +0 -368
  88. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/pinecone.py +0 -382
  89. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/qdrant.py +0 -270
  90. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/redis.py +0 -295
  91. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/supabase.py +0 -237
  92. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/upstash_vector.py +0 -293
  93. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/vertex_ai_vector_search.py +0 -629
  94. mem0ai_azure_mysql-0.1.116.12/mem0/vector_stores/weaviate.py +0 -316
  95. mem0ai_azure_mysql-0.1.116.12/pyproject.toml +0 -158
  96. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/.gitignore +0 -0
  97. {mem0ai_azure_mysql-0.1.116.12/mem0/client → mem0ai_azure_mysql-0.2.1/mem0/configs}/__init__.py +0 -0
  98. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/configs/base.py +0 -0
  99. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/configs/dbs/__init__.py +0 -0
  100. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/configs/dbs/base.py +0 -0
  101. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/configs/dbs/mysql.py +0 -0
  102. {mem0ai_azure_mysql-0.1.116.12/mem0/configs → mem0ai_azure_mysql-0.2.1/mem0/configs/embeddings}/__init__.py +0 -0
  103. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/configs/embeddings/base.py +0 -0
  104. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/configs/enums.py +0 -0
  105. {mem0ai_azure_mysql-0.1.116.12/mem0/configs/embeddings → mem0ai_azure_mysql-0.2.1/mem0/configs/llms}/__init__.py +0 -0
  106. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/configs/llms/azure.py +0 -0
  107. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/configs/prompts.py +0 -0
  108. {mem0ai_azure_mysql-0.1.116.12/mem0/configs/llms → mem0ai_azure_mysql-0.2.1/mem0/configs/vector_stores}/__init__.py +0 -0
  109. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/configs/vector_stores/azure_ai_search.py +0 -0
  110. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/dbs/__init__.py +0 -0
  111. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/dbs/base.py +0 -0
  112. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/dbs/configs.py +0 -0
  113. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/dbs/mysql.py +0 -0
  114. {mem0ai_azure_mysql-0.1.116.12/mem0/configs/vector_stores → mem0ai_azure_mysql-0.2.1/mem0/embeddings}/__init__.py +0 -0
  115. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/embeddings/azure_openai.py +0 -0
  116. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/embeddings/base.py +0 -0
  117. {mem0ai_azure_mysql-0.1.116.12/mem0/embeddings → mem0ai_azure_mysql-0.2.1/mem0/graphs}/__init__.py +0 -0
  118. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/graphs/tools.py +0 -0
  119. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/graphs/utils.py +0 -0
  120. {mem0ai_azure_mysql-0.1.116.12/mem0/graphs → mem0ai_azure_mysql-0.2.1/mem0/llms}/__init__.py +0 -0
  121. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/llms/base.py +0 -0
  122. {mem0ai_azure_mysql-0.1.116.12/mem0/graphs/neptune → mem0ai_azure_mysql-0.2.1/mem0/memory}/__init__.py +0 -0
  123. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/memory/base.py +0 -0
  124. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/memory/graph_memory.py +0 -0
  125. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/memory/setup.py +0 -0
  126. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/memory/storage.py +0 -0
  127. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/memory/telemetry.py +0 -0
  128. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/memory/utils.py +0 -0
  129. {mem0ai_azure_mysql-0.1.116.12/mem0/llms → mem0ai_azure_mysql-0.2.1/mem0/vector_stores}/__init__.py +0 -0
  130. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/vector_stores/azure_ai_search.py +0 -0
  131. {mem0ai_azure_mysql-0.1.116.12 → mem0ai_azure_mysql-0.2.1}/mem0/vector_stores/base.py +0 -0
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.4
2
+ Name: mem0ai-azure-mysql
3
+ Version: 0.2.1
4
+ Summary: Long-term memory for AI Agents with Azure DefaultAzureCredential authentication and MySQL history database support. Async-only API.
5
+ Requires-Python: <4.0,>=3.10
6
+ Requires-Dist: azure-identity>=1.24.0
7
+ Requires-Dist: azure-search-documents>=11.5.3
8
+ Requires-Dist: boto3>=1.34.0
9
+ Requires-Dist: cohere>=5.17.0
10
+ Requires-Dist: langchain-neo4j==0.6.0
11
+ Requires-Dist: neo4j>=5.23.1
12
+ Requires-Dist: openai<1.100.0,>=1.90.0
13
+ Requires-Dist: posthog>=3.5.0
14
+ Requires-Dist: protobuf>=5.29.0
15
+ Requires-Dist: pydantic>=2.7.3
16
+ Requires-Dist: pymysql
17
+ Requires-Dist: pytz>=2024.1
18
+ Requires-Dist: rank-bm25>=0.2.2
19
+ Requires-Dist: sqlalchemy>=2.0.31
20
+ Description-Content-Type: text/markdown
21
+
22
+ # Mem0 - Azure Enhanced Fork
23
+
24
+ This repository is an enhanced fork of [mem0ai/mem0](https://github.com/mem0ai/mem0.git) that provides enterprise-grade improvements for Azure environments and production deployments.
25
+
26
+ ## Key Enhancements
27
+
28
+ ### 1. Async-Only API
29
+ - **AsyncMemory**: This fork provides only the async `AsyncMemory` class for better performance and scalability
30
+ - **Simplified Codebase**: Removed synchronous `Memory` class to reduce code complexity and maintenance burden
31
+ - **Modern Python**: Built for async/await patterns with full asyncio support
32
+
33
+ ### 2. Azure Entra ID Authentication
34
+ - **Azure AI Search**: Support for Azure Entra ID (Azure AD) authentication using `DefaultAzureCredential`
35
+ - **Azure OpenAI**: Seamless Entra ID integration for both LLM and embedding services
36
+ - **Simplified Authentication**: No need to manage API keys when using managed identities or service principals
37
+
38
+ ### 3. MySQL Database Support
39
+ - **Production-Ready**: Replace SQLite3 with enterprise-grade MySQL for scalable memory history storage
40
+ - **Connection Pooling**: Built-in connection pooling and SSL support for secure connections
41
+ - **Thread-Safe**: Thread-safe operations with proper connection management
42
+
43
+ ## Installation
44
+
45
+ Install the enhanced package with Azure and MySQL dependencies:
46
+
47
+ ```bash
48
+ pip install mem0ai-azure-mysql
49
+ ```
50
+
51
+ Or with uv:
52
+
53
+ ```bash
54
+ uv add mem0ai-azure-mysql
55
+ ```
56
+
57
+ ## Quick Start
58
+
59
+ ```python
60
+ import asyncio
61
+ from mem0 import AsyncMemory
62
+
63
+ config = {
64
+ "vector_store": {
65
+ "provider": "azure_ai_search",
66
+ "config": {
67
+ "collection_name": "mem0",
68
+ "service_name": "your-search-service",
69
+ "embedding_model_dims": 1536,
70
+ "azure_ad_token": "<your-token>" # Or use DefaultAzureCredential
71
+ },
72
+ },
73
+ "llm": {
74
+ "provider": "azure_openai",
75
+ "config": {
76
+ "model": "gpt-4",
77
+ "azure_kwargs": {
78
+ "api_version": "2024-12-01-preview",
79
+ "azure_deployment": "gpt-4",
80
+ "azure_endpoint": "https://your-endpoint.openai.azure.com/",
81
+ "azure_ad_token": "<your-token>",
82
+ },
83
+ },
84
+ },
85
+ "embedder": {
86
+ "provider": "azure_openai",
87
+ "config": {
88
+ "model": "text-embedding-3-small",
89
+ "embedding_dims": 1536,
90
+ "azure_kwargs": {
91
+ "api_version": "2024-12-01-preview",
92
+ "azure_deployment": "text-embedding-3-small",
93
+ "azure_endpoint": "https://your-endpoint.openai.azure.com/",
94
+ "azure_ad_token": "<your-token>",
95
+ },
96
+ },
97
+ },
98
+ "db": {
99
+ "provider": "mysql",
100
+ "config": {
101
+ "host": "your-mysql-server.mysql.database.azure.com",
102
+ "port": 3306,
103
+ "user": "mem0",
104
+ "password": "<your-password>",
105
+ "database": "mem0",
106
+ "ssl_enabled": True,
107
+ },
108
+ },
109
+ }
110
+
111
+ async def main():
112
+ memory = await AsyncMemory.from_config(config)
113
+
114
+ # Add memories
115
+ result = await memory.add(
116
+ "I love playing tennis on weekends",
117
+ user_id="user123"
118
+ )
119
+ print(result)
120
+
121
+ # Search memories
122
+ results = await memory.search("What sports do I like?", user_id="user123")
123
+ print(results)
124
+
125
+ asyncio.run(main())
126
+ ```
127
+
128
+ ## Development
129
+
130
+ ### Setup with uv (Recommended)
131
+
132
+ ```bash
133
+ # Install dependencies with dev extras
134
+ uv sync --extra dev
135
+
136
+ # Run example
137
+ uv run python example.py
138
+
139
+ # Run tests
140
+ uv run pytest tests/
141
+ ```
142
+
143
+ ### Setup with hatch
144
+
145
+ ```bash
146
+ # Create environment
147
+ make install
148
+
149
+ # Run tests
150
+ make test
151
+ ```
152
+
153
+ ### Available Commands
154
+
155
+ ```bash
156
+ make format # Format code with ruff
157
+ make lint # Lint code with ruff
158
+ make test # Run tests
159
+ make build # Build package
160
+ make clean # Clean build artifacts
161
+ ```
162
+
163
+ ## API Reference
164
+
165
+ ### AsyncMemory
166
+
167
+ The main class for interacting with the memory system.
168
+
169
+ ```python
170
+ from mem0 import AsyncMemory
171
+
172
+ # Create from config
173
+ memory = await AsyncMemory.from_config(config)
174
+
175
+ # Add memories
176
+ await memory.add(messages, user_id="user123")
177
+
178
+ # Search memories
179
+ await memory.search(query, user_id="user123")
180
+
181
+ # Get all memories
182
+ await memory.get_all(user_id="user123")
183
+
184
+ # Delete memories
185
+ await memory.delete_all(user_id="user123")
186
+
187
+ # Get memory by ID
188
+ await memory.get(memory_id)
189
+
190
+ # Update memory
191
+ await memory.update(memory_id, new_data)
192
+
193
+ # Get history
194
+ await memory.history(memory_id)
195
+
196
+ # Reset all
197
+ await memory.reset()
198
+ ```
199
+
200
+ ## License
201
+
202
+ This project is licensed under the Apache License 2.0 - see the original [mem0](https://github.com/mem0ai/mem0) repository for details.
@@ -0,0 +1,181 @@
1
+ # Mem0 - Azure Enhanced Fork
2
+
3
+ This repository is an enhanced fork of [mem0ai/mem0](https://github.com/mem0ai/mem0.git) that provides enterprise-grade improvements for Azure environments and production deployments.
4
+
5
+ ## Key Enhancements
6
+
7
+ ### 1. Async-Only API
8
+ - **AsyncMemory**: This fork provides only the async `AsyncMemory` class for better performance and scalability
9
+ - **Simplified Codebase**: Removed synchronous `Memory` class to reduce code complexity and maintenance burden
10
+ - **Modern Python**: Built for async/await patterns with full asyncio support
11
+
12
+ ### 2. Azure Entra ID Authentication
13
+ - **Azure AI Search**: Support for Azure Entra ID (Azure AD) authentication using `DefaultAzureCredential`
14
+ - **Azure OpenAI**: Seamless Entra ID integration for both LLM and embedding services
15
+ - **Simplified Authentication**: No need to manage API keys when using managed identities or service principals
16
+
17
+ ### 3. MySQL Database Support
18
+ - **Production-Ready**: Replace SQLite3 with enterprise-grade MySQL for scalable memory history storage
19
+ - **Connection Pooling**: Built-in connection pooling and SSL support for secure connections
20
+ - **Thread-Safe**: Thread-safe operations with proper connection management
21
+
22
+ ## Installation
23
+
24
+ Install the enhanced package with Azure and MySQL dependencies:
25
+
26
+ ```bash
27
+ pip install mem0ai-azure-mysql
28
+ ```
29
+
30
+ Or with uv:
31
+
32
+ ```bash
33
+ uv add mem0ai-azure-mysql
34
+ ```
35
+
36
+ ## Quick Start
37
+
38
+ ```python
39
+ import asyncio
40
+ from mem0 import AsyncMemory
41
+
42
+ config = {
43
+ "vector_store": {
44
+ "provider": "azure_ai_search",
45
+ "config": {
46
+ "collection_name": "mem0",
47
+ "service_name": "your-search-service",
48
+ "embedding_model_dims": 1536,
49
+ "azure_ad_token": "<your-token>" # Or use DefaultAzureCredential
50
+ },
51
+ },
52
+ "llm": {
53
+ "provider": "azure_openai",
54
+ "config": {
55
+ "model": "gpt-4",
56
+ "azure_kwargs": {
57
+ "api_version": "2024-12-01-preview",
58
+ "azure_deployment": "gpt-4",
59
+ "azure_endpoint": "https://your-endpoint.openai.azure.com/",
60
+ "azure_ad_token": "<your-token>",
61
+ },
62
+ },
63
+ },
64
+ "embedder": {
65
+ "provider": "azure_openai",
66
+ "config": {
67
+ "model": "text-embedding-3-small",
68
+ "embedding_dims": 1536,
69
+ "azure_kwargs": {
70
+ "api_version": "2024-12-01-preview",
71
+ "azure_deployment": "text-embedding-3-small",
72
+ "azure_endpoint": "https://your-endpoint.openai.azure.com/",
73
+ "azure_ad_token": "<your-token>",
74
+ },
75
+ },
76
+ },
77
+ "db": {
78
+ "provider": "mysql",
79
+ "config": {
80
+ "host": "your-mysql-server.mysql.database.azure.com",
81
+ "port": 3306,
82
+ "user": "mem0",
83
+ "password": "<your-password>",
84
+ "database": "mem0",
85
+ "ssl_enabled": True,
86
+ },
87
+ },
88
+ }
89
+
90
+ async def main():
91
+ memory = await AsyncMemory.from_config(config)
92
+
93
+ # Add memories
94
+ result = await memory.add(
95
+ "I love playing tennis on weekends",
96
+ user_id="user123"
97
+ )
98
+ print(result)
99
+
100
+ # Search memories
101
+ results = await memory.search("What sports do I like?", user_id="user123")
102
+ print(results)
103
+
104
+ asyncio.run(main())
105
+ ```
106
+
107
+ ## Development
108
+
109
+ ### Setup with uv (Recommended)
110
+
111
+ ```bash
112
+ # Install dependencies with dev extras
113
+ uv sync --extra dev
114
+
115
+ # Run example
116
+ uv run python example.py
117
+
118
+ # Run tests
119
+ uv run pytest tests/
120
+ ```
121
+
122
+ ### Setup with hatch
123
+
124
+ ```bash
125
+ # Create environment
126
+ make install
127
+
128
+ # Run tests
129
+ make test
130
+ ```
131
+
132
+ ### Available Commands
133
+
134
+ ```bash
135
+ make format # Format code with ruff
136
+ make lint # Lint code with ruff
137
+ make test # Run tests
138
+ make build # Build package
139
+ make clean # Clean build artifacts
140
+ ```
141
+
142
+ ## API Reference
143
+
144
+ ### AsyncMemory
145
+
146
+ The main class for interacting with the memory system.
147
+
148
+ ```python
149
+ from mem0 import AsyncMemory
150
+
151
+ # Create from config
152
+ memory = await AsyncMemory.from_config(config)
153
+
154
+ # Add memories
155
+ await memory.add(messages, user_id="user123")
156
+
157
+ # Search memories
158
+ await memory.search(query, user_id="user123")
159
+
160
+ # Get all memories
161
+ await memory.get_all(user_id="user123")
162
+
163
+ # Delete memories
164
+ await memory.delete_all(user_id="user123")
165
+
166
+ # Get memory by ID
167
+ await memory.get(memory_id)
168
+
169
+ # Update memory
170
+ await memory.update(memory_id, new_data)
171
+
172
+ # Get history
173
+ await memory.history(memory_id)
174
+
175
+ # Reset all
176
+ await memory.reset()
177
+ ```
178
+
179
+ ## License
180
+
181
+ This project is licensed under the Apache License 2.0 - see the original [mem0](https://github.com/mem0ai/mem0) repository for details.
@@ -0,0 +1,5 @@
1
+ import importlib.metadata
2
+
3
+ __version__ = importlib.metadata.version("mem0ai-azure-mysql")
4
+
5
+ from mem0.memory.main import AsyncMemory # noqa
@@ -29,7 +29,7 @@ class BaseLlmConfig(ABC):
29
29
  Initialize a base configuration class instance for the LLM.
30
30
 
31
31
  Args:
32
- model: The model identifier to use (e.g., "gpt-4o-mini", "claude-3-5-sonnet-20240620")
32
+ model: The model identifier to use (e.g., "gpt-5.1", "claude-3-5-sonnet-20240620")
33
33
  Defaults to None (will be set by provider-specific configs)
34
34
  temperature: Controls the randomness of the model's output.
35
35
  Higher values (closer to 1) make output more random, lower values make it more deterministic.
@@ -5,26 +5,15 @@ from pydantic import BaseModel, Field, field_validator
5
5
 
6
6
  class EmbedderConfig(BaseModel):
7
7
  provider: str = Field(
8
- description="Provider of the embedding model (e.g., 'ollama', 'openai')",
9
- default="openai",
8
+ description="Provider of the embedding model (e.g., 'azure_openai')",
9
+ default="azure_openai",
10
10
  )
11
11
  config: Optional[dict] = Field(description="Configuration for the specific embedding model", default={})
12
12
 
13
13
  @field_validator("config")
14
14
  def validate_config(cls, v, values):
15
15
  provider = values.data.get("provider")
16
- if provider in [
17
- "openai",
18
- "ollama",
19
- "huggingface",
20
- "azure_openai",
21
- "gemini",
22
- "vertexai",
23
- "together",
24
- "lmstudio",
25
- "langchain",
26
- "aws_bedrock",
27
- ]:
16
+ if provider in ["azure_openai"]:
28
17
  return v
29
18
  else:
30
19
  raise ValueError(f"Unsupported embedding provider: {provider}")
@@ -0,0 +1,64 @@
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel, Field, field_validator, model_validator
4
+
5
+ from mem0.llms.configs import LlmConfig
6
+
7
+
8
+ class RerankConfig(BaseModel):
9
+ provider: str = Field(
10
+ description="Provider of the rerank model (e.g., 'openai', 'azure', 'cohere')",
11
+ default="cohere",
12
+ )
13
+ config: Optional[dict] = Field(
14
+ description="Configuration for the specific rerank model", default={}
15
+ )
16
+
17
+ class Neo4jConfig(BaseModel):
18
+ url: Optional[str] = Field(None, description="Host address for the graph database")
19
+ username: Optional[str] = Field(None, description="Username for the graph database")
20
+ password: Optional[str] = Field(None, description="Password for the graph database")
21
+ database: Optional[str] = Field(None, description="Database for the graph database")
22
+ base_label: Optional[bool] = Field(None, description="Whether to use base node label __Entity__ for all entities")
23
+ similarity_threshold: float = Field(0.7, description="Threshold for the similarity of nodes")
24
+ top_k: int = Field(5, description="Number of top scored results to return")
25
+ rerank: Optional[RerankConfig] = Field(None, description="Rerank configuration")
26
+
27
+ @model_validator(mode="before")
28
+ def check_host_port_or_path(cls, values):
29
+ url, username, password = (
30
+ values.get("url"),
31
+ values.get("username"),
32
+ values.get("password"),
33
+ )
34
+ if not url or not username or not password:
35
+ raise ValueError("Please provide 'url', 'username' and 'password'.")
36
+
37
+ if values.get("rerank") is not None:
38
+ values["rerank"] = RerankConfig(**values.get("rerank"))
39
+ if values["rerank"].provider not in ("cohere"):
40
+ raise ValueError("Invalid rerank provider. Supported providers are: cohere")
41
+
42
+ return values
43
+
44
+
45
+ class GraphStoreConfig(BaseModel):
46
+ provider: str = Field(
47
+ description="Provider of the data store (e.g., 'neo4j')",
48
+ default="neo4j",
49
+ )
50
+ config: Optional[Neo4jConfig] = Field(
51
+ description="Configuration for the specific data store", default=None
52
+ )
53
+ llm: Optional[LlmConfig] = Field(description="LLM configuration for querying the graph store", default=None)
54
+ custom_prompt: Optional[str] = Field(
55
+ description="Custom prompt to fetch entities from the given text", default=None
56
+ )
57
+
58
+ @field_validator("config")
59
+ def validate_config(cls, v, values):
60
+ provider = values.data.get("provider")
61
+ if provider in ("neo4j", "default"):
62
+ return Neo4jConfig(**v.model_dump())
63
+ else:
64
+ raise ValueError(f"Unsupported graph store provider: {provider}")
@@ -36,7 +36,7 @@ class AzureOpenAILLM(LLMBase):
36
36
 
37
37
  # Model name should match the custom deployment name chosen for it.
38
38
  if not self.config.model:
39
- self.config.model = "gpt-4o"
39
+ self.config.model = "gpt-5.1"
40
40
 
41
41
  api_key = self.config.azure_kwargs.api_key or os.getenv("LLM_AZURE_API_KEY")
42
42
  azure_ad_token = self.config.azure_kwargs.azure_ad_token or os.getenv("LLM_AZURE_AD_TOKEN")
@@ -4,31 +4,13 @@ from pydantic import BaseModel, Field, field_validator
4
4
 
5
5
 
6
6
  class LlmConfig(BaseModel):
7
- provider: str = Field(description="Provider of the LLM (e.g., 'ollama', 'openai')", default="openai")
7
+ provider: str = Field(description="Provider of the LLM (e.g., 'azure_openai')", default="azure_openai")
8
8
  config: Optional[dict] = Field(description="Configuration for the specific LLM", default={})
9
9
 
10
10
  @field_validator("config")
11
11
  def validate_config(cls, v, values):
12
12
  provider = values.data.get("provider")
13
- if provider in (
14
- "openai",
15
- "ollama",
16
- "anthropic",
17
- "groq",
18
- "together",
19
- "aws_bedrock",
20
- "litellm",
21
- "azure_openai",
22
- "openai_structured",
23
- "azure_openai_structured",
24
- "gemini",
25
- "deepseek",
26
- "xai",
27
- "sarvam",
28
- "lmstudio",
29
- "vllm",
30
- "langchain",
31
- ):
13
+ if provider in ("azure_openai",):
32
14
  return v
33
15
  else:
34
16
  raise ValueError(f"Unsupported LLM provider: {provider}")