mem0ai-azure-mysql 0.1.115.1__tar.gz → 0.1.115.2__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.115.1 → mem0ai_azure_mysql-0.1.115.2}/PKG-INFO +1 -1
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/base.py +19 -5
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/azure_ai_search.py +3 -2
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/azure_openai.py +10 -9
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/azure_openai.py +10 -4
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/azure_ai_search.py +33 -31
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/pyproject.toml +1 -1
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/.gitignore +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/LICENSE +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/README.md +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/client/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/client/main.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/client/project.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/client/utils.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/dbs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/dbs/base.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/dbs/mysql.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/embeddings/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/embeddings/base.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/enums.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/llms/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/llms/base.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/prompts.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/baidu.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/chroma.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/elasticsearch.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/faiss.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/milvus.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/mongodb.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/opensearch.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/pgvector.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/pinecone.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/qdrant.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/redis.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/supabase.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/upstash_vector.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/vertex_ai_vector_search.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/weaviate.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/dbs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/dbs/base.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/dbs/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/dbs/mysql.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/aws_bedrock.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/base.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/gemini.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/huggingface.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/lmstudio.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/mock.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/ollama.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/openai.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/together.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/vertexai.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/graphs/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/graphs/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/graphs/neptune/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/graphs/neptune/base.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/graphs/neptune/main.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/graphs/tools.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/graphs/utils.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/anthropic.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/aws_bedrock.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/azure_openai_structured.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/base.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/deepseek.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/gemini.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/groq.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/litellm.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/lmstudio.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/ollama.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/openai.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/openai_structured.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/sarvam.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/together.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/vllm.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/llms/xai.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/memory/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/memory/base.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/memory/graph_memory.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/memory/main.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/memory/memgraph_memory.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/memory/setup.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/memory/storage.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/memory/telemetry.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/memory/utils.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/proxy/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/proxy/main.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/utils/factory.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/__init__.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/baidu.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/base.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/chroma.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/configs.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/elasticsearch.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/faiss.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/langchain.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/milvus.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/mongodb.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/opensearch.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/pgvector.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/pinecone.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/qdrant.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/redis.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/supabase.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/upstash_vector.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/vertex_ai_vector_search.py +0 -0
- {mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/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.115.
|
|
3
|
+
Version: 0.1.115.2
|
|
4
4
|
Summary: Long-term memory for AI Agents with Azure DefaultAzureCredential authentication and MySQL history database support
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Requires-Python: <4.0,>=3.9
|
|
@@ -78,13 +78,27 @@ class AzureConfig(BaseModel):
|
|
|
78
78
|
default_headers (Dict[str, str]): Headers to include in requests to the Azure API.
|
|
79
79
|
"""
|
|
80
80
|
|
|
81
|
-
api_key: str = Field(
|
|
81
|
+
api_key: str | None = Field(
|
|
82
82
|
description="The API key used for authenticating with the Azure service.",
|
|
83
83
|
default=None,
|
|
84
84
|
)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
azure_ad_token: str | None = Field(
|
|
86
|
+
description="The Azure AD token used for authentication.",
|
|
87
|
+
default=None,
|
|
88
|
+
)
|
|
89
|
+
azure_deployment: str | None = Field(
|
|
90
|
+
description="The name of the Azure deployment.",
|
|
91
|
+
default=None,
|
|
92
|
+
)
|
|
93
|
+
azure_endpoint: str | None = Field(
|
|
94
|
+
description="The endpoint URL for the Azure service.",
|
|
95
|
+
default=None,
|
|
96
|
+
)
|
|
97
|
+
api_version: str | None = Field(
|
|
98
|
+
description="The version of the Azure API being used.",
|
|
99
|
+
default=None
|
|
100
|
+
)
|
|
88
101
|
default_headers: Optional[Dict[str, str]] = Field(
|
|
89
|
-
description="Headers to include in requests to the Azure API.",
|
|
102
|
+
description="Headers to include in requests to the Azure API.",
|
|
103
|
+
default=None
|
|
90
104
|
)
|
|
@@ -5,8 +5,9 @@ from pydantic import BaseModel, Field, model_validator
|
|
|
5
5
|
|
|
6
6
|
class AzureAISearchConfig(BaseModel):
|
|
7
7
|
collection_name: str = Field("mem0", description="Name of the collection")
|
|
8
|
-
service_name: str = Field(None, description="Azure AI Search service name")
|
|
9
|
-
api_key: str = Field(None, description="API key for the Azure AI Search service")
|
|
8
|
+
service_name: str | None = Field(None, description="Azure AI Search service name")
|
|
9
|
+
api_key: str | None = Field(None, description="API key for the Azure AI Search service")
|
|
10
|
+
azure_ad_token: str | None = Field(None, description="Azure AD token for authentication")
|
|
10
11
|
embedding_model_dims: int = Field(1536, description="Dimension of the embedding vector")
|
|
11
12
|
compression_type: Optional[str] = Field(
|
|
12
13
|
None, description="Type of vector compression to use. Options: 'scalar', 'binary', or None"
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/azure_openai.py
RENAMED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import os
|
|
2
|
-
import logging
|
|
3
2
|
from typing import Literal, Optional
|
|
4
3
|
|
|
5
4
|
from openai import AzureOpenAI
|
|
6
5
|
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
|
|
7
6
|
|
|
8
|
-
|
|
9
7
|
from mem0.configs.embeddings.base import BaseEmbedderConfig
|
|
10
8
|
from mem0.embeddings.base import EmbeddingBase
|
|
11
9
|
|
|
12
|
-
logging.basicConfig(level=logging.INFO)
|
|
13
|
-
logger = logging.getLogger(__name__)
|
|
14
|
-
|
|
15
10
|
|
|
16
11
|
class AzureOpenAIEmbedding(EmbeddingBase):
|
|
17
12
|
def __init__(self, config: Optional[BaseEmbedderConfig] = None):
|
|
18
13
|
super().__init__(config)
|
|
19
14
|
|
|
20
15
|
api_key = self.config.azure_kwargs.api_key or os.getenv("EMBEDDING_AZURE_API_KEY")
|
|
16
|
+
azure_ad_token = self.config.azure_kwargs.azure_ad_token or os.getenv("EMBEDDING_AZURE_AD_TOKEN")
|
|
21
17
|
azure_deployment = self.config.azure_kwargs.azure_deployment or os.getenv("EMBEDDING_AZURE_DEPLOYMENT")
|
|
22
18
|
azure_endpoint = self.config.azure_kwargs.azure_endpoint or os.getenv("EMBEDDING_AZURE_ENDPOINT")
|
|
23
19
|
api_version = self.config.azure_kwargs.api_version or os.getenv("EMBEDDING_AZURE_API_VERSION")
|
|
24
20
|
default_headers = self.config.azure_kwargs.default_headers
|
|
25
21
|
|
|
26
|
-
|
|
22
|
+
if azure_endpoint is None:
|
|
23
|
+
raise ValueError("Azure endpoint must be provided either in config or as an environment variable.")
|
|
27
24
|
|
|
25
|
+
auth_kwargs = {}
|
|
28
26
|
if api_key:
|
|
29
|
-
|
|
30
|
-
auth_kwargs["
|
|
27
|
+
print("Using API key for Azure OpenAI Embedding authentication.")
|
|
28
|
+
auth_kwargs["api_key"] = api_key
|
|
29
|
+
elif azure_ad_token:
|
|
30
|
+
print("Using Azure AD token for Azure OpenAI Embedding authentication.")
|
|
31
|
+
auth_kwargs["azure_ad_token"] = azure_ad_token
|
|
31
32
|
else:
|
|
32
|
-
|
|
33
|
+
print("Using DefaultAzureCredential for Azure OpenAI Embedding authentication.")
|
|
33
34
|
credential = DefaultAzureCredential()
|
|
34
35
|
token_provider = get_bearer_token_provider(credential, "https://cognitiveservices.azure.com/.default")
|
|
35
36
|
auth_kwargs["azure_ad_token_provider"] = token_provider
|
|
@@ -19,18 +19,24 @@ class AzureOpenAILLM(LLMBase):
|
|
|
19
19
|
self.config.model = "gpt-4o"
|
|
20
20
|
|
|
21
21
|
api_key = self.config.azure_kwargs.api_key or os.getenv("LLM_AZURE_API_KEY")
|
|
22
|
+
azure_ad_token = self.config.azure_kwargs.azure_ad_token or os.getenv("LLM_AZURE_AD_TOKEN")
|
|
22
23
|
azure_deployment = self.config.azure_kwargs.azure_deployment or os.getenv("LLM_AZURE_DEPLOYMENT")
|
|
23
24
|
azure_endpoint = self.config.azure_kwargs.azure_endpoint or os.getenv("LLM_AZURE_ENDPOINT")
|
|
24
25
|
api_version = self.config.azure_kwargs.api_version or os.getenv("LLM_AZURE_API_VERSION")
|
|
25
26
|
default_headers = self.config.azure_kwargs.default_headers
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
if azure_endpoint is None:
|
|
29
|
+
raise ValueError("Azure endpoint must be provided either in config or as an environment variable.")
|
|
28
30
|
|
|
31
|
+
auth_kwargs = {}
|
|
29
32
|
if api_key:
|
|
30
|
-
|
|
33
|
+
print("Using API key for Azure OpenAI authentication.")
|
|
34
|
+
auth_kwargs["api_key"] = api_key
|
|
35
|
+
elif azure_ad_token:
|
|
36
|
+
print("Using Azure AD token for Azure OpenAI authentication.")
|
|
37
|
+
auth_kwargs["azure_ad_token"] = azure_ad_token
|
|
31
38
|
else:
|
|
32
|
-
|
|
33
|
-
# This is useful for managed identities or when using Azure AD authentication.
|
|
39
|
+
print("Using DefaultAzureCredential for Azure OpenAI authentication.")
|
|
34
40
|
credential = DefaultAzureCredential()
|
|
35
41
|
token_provider = get_bearer_token_provider(credential, "https://cognitiveservices.azure.com/.default")
|
|
36
42
|
auth_kwargs["azure_ad_token_provider"] = token_provider
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/azure_ai_search.py
RENAMED
|
@@ -6,7 +6,7 @@ from datetime import datetime, timedelta, timezone
|
|
|
6
6
|
|
|
7
7
|
from pydantic import BaseModel
|
|
8
8
|
from azure.core.credentials import AccessToken
|
|
9
|
-
from azure.core.credentials import TokenCredential
|
|
9
|
+
from azure.core.credentials import TokenCredential, AzureKeyCredential
|
|
10
10
|
from azure.identity import DefaultAzureCredential
|
|
11
11
|
|
|
12
12
|
from mem0.memory.utils import extract_json
|
|
@@ -65,6 +65,7 @@ class AzureAISearch(VectorStoreBase):
|
|
|
65
65
|
use_float16: bool = False,
|
|
66
66
|
hybrid_search: bool = False,
|
|
67
67
|
vector_filter_mode: Optional[str] = None,
|
|
68
|
+
azure_ad_token: Optional[str] = None
|
|
68
69
|
):
|
|
69
70
|
"""
|
|
70
71
|
Initialize the Azure AI Search vector store.
|
|
@@ -80,6 +81,7 @@ class AzureAISearch(VectorStoreBase):
|
|
|
80
81
|
(Note: This flag is preserved from the initial implementation per feedback.)
|
|
81
82
|
hybrid_search (bool): Whether to use hybrid search. Default is False.
|
|
82
83
|
vector_filter_mode (Optional[str]): Mode for vector filtering. Default is "preFilter".
|
|
84
|
+
azure_ad_token (Optional[str]): Azure AD token for authentication.
|
|
83
85
|
"""
|
|
84
86
|
self.service_name = service_name
|
|
85
87
|
self.api_key = api_key
|
|
@@ -91,29 +93,43 @@ class AzureAISearch(VectorStoreBase):
|
|
|
91
93
|
self.use_float16 = use_float16
|
|
92
94
|
self.hybrid_search = hybrid_search
|
|
93
95
|
self.vector_filter_mode = vector_filter_mode
|
|
96
|
+
self.azure_ad_token = azure_ad_token
|
|
94
97
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
self.search_client, self.index_client = self.create_clients()
|
|
99
|
+
|
|
100
|
+
collections = self.list_cols()
|
|
101
|
+
if collection_name not in collections:
|
|
102
|
+
self.create_col()
|
|
103
|
+
|
|
104
|
+
def create_clients(self):
|
|
105
|
+
"""
|
|
106
|
+
Create the search and index clients.
|
|
107
|
+
This method is called during initialization to set up the clients.
|
|
108
|
+
"""
|
|
109
|
+
if self.api_key:
|
|
110
|
+
print("Using API key for Azure AI Search authentication.")
|
|
111
|
+
credential = AzureKeyCredential(self.api_key)
|
|
112
|
+
elif self.azure_ad_token:
|
|
113
|
+
print("Using Azure AD token for Azure AI Search authentication.")
|
|
114
|
+
credential = StaticTokenCredential(self.azure_ad_token)
|
|
98
115
|
else:
|
|
99
|
-
|
|
100
|
-
credential =
|
|
101
|
-
|
|
102
|
-
|
|
116
|
+
print("Using DefaultAzureCredential for Azure AI Search authentication.")
|
|
117
|
+
credential = DefaultAzureCredential()
|
|
118
|
+
|
|
119
|
+
search_client = SearchClient(
|
|
120
|
+
endpoint=f"https://{self.service_name}.search.windows.net",
|
|
103
121
|
index_name=self.index_name,
|
|
104
122
|
credential=credential,
|
|
105
123
|
)
|
|
106
|
-
|
|
107
|
-
endpoint=f"https://{service_name}.search.windows.net",
|
|
124
|
+
index_client = SearchIndexClient(
|
|
125
|
+
endpoint=f"https://{self.service_name}.search.windows.net",
|
|
108
126
|
credential=credential,
|
|
109
127
|
)
|
|
110
128
|
|
|
111
|
-
|
|
112
|
-
|
|
129
|
+
search_client._client._config.user_agent_policy.add_user_agent("mem0")
|
|
130
|
+
index_client._client._config.user_agent_policy.add_user_agent("mem0")
|
|
113
131
|
|
|
114
|
-
|
|
115
|
-
if collection_name not in collections:
|
|
116
|
-
self.create_col()
|
|
132
|
+
return search_client, index_client
|
|
117
133
|
|
|
118
134
|
def create_col(self):
|
|
119
135
|
"""Create a new index in Azure AI Search."""
|
|
@@ -379,22 +395,8 @@ class AzureAISearch(VectorStoreBase):
|
|
|
379
395
|
# Delete the collection
|
|
380
396
|
self.delete_col()
|
|
381
397
|
|
|
382
|
-
#
|
|
383
|
-
|
|
384
|
-
service_endpoint = f"https://{self.service_name}.search.windows.net"
|
|
385
|
-
self.search_client = SearchClient(
|
|
386
|
-
endpoint=service_endpoint,
|
|
387
|
-
index_name=self.index_name,
|
|
388
|
-
credential=credential,
|
|
389
|
-
)
|
|
390
|
-
self.index_client = SearchIndexClient(
|
|
391
|
-
endpoint=service_endpoint,
|
|
392
|
-
credential=credential,
|
|
393
|
-
)
|
|
394
|
-
|
|
395
|
-
# Add user agent
|
|
396
|
-
self.search_client._client._config.user_agent_policy.add_user_agent("mem0")
|
|
397
|
-
self.index_client._client._config.user_agent_policy.add_user_agent("mem0")
|
|
398
|
+
# Recreate the clients
|
|
399
|
+
self.search_client, self.index_client = self.create_clients()
|
|
398
400
|
|
|
399
401
|
# Create the collection
|
|
400
402
|
self.create_col()
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "mem0ai-azure-mysql"
|
|
7
|
-
version = "0.1.115.
|
|
7
|
+
version = "0.1.115.2"
|
|
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.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/embeddings/__init__.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/embeddings/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/__init__.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/baidu.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/chroma.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/faiss.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/milvus.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/mongodb.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/pgvector.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/pinecone.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/qdrant.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/redis.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/configs/vector_stores/supabase.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/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.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/embeddings/aws_bedrock.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/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.115.1 → mem0ai_azure_mysql-0.1.115.2}/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
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/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.115.1 → mem0ai_azure_mysql-0.1.115.2}/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
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/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
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/elasticsearch.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/langchain.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/opensearch.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/pgvector.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/pinecone.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/supabase.py
RENAMED
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/upstash_vector.py
RENAMED
|
File without changes
|
|
File without changes
|
{mem0ai_azure_mysql-0.1.115.1 → mem0ai_azure_mysql-0.1.115.2}/mem0/vector_stores/weaviate.py
RENAMED
|
File without changes
|