memorisdk 2.0.1__py3-none-any.whl → 2.1.1__py3-none-any.whl
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.
Potentially problematic release.
This version of memorisdk might be problematic. Click here for more details.
- memori/__init__.py +3 -3
- memori/agents/conscious_agent.py +289 -77
- memori/agents/memory_agent.py +19 -9
- memori/agents/retrieval_agent.py +59 -51
- memori/config/manager.py +7 -7
- memori/config/memory_manager.py +25 -25
- memori/config/settings.py +13 -6
- memori/core/conversation.py +15 -15
- memori/core/database.py +14 -13
- memori/core/memory.py +376 -105
- memori/core/providers.py +25 -25
- memori/database/__init__.py +11 -0
- memori/database/adapters/__init__.py +11 -0
- memori/database/adapters/mongodb_adapter.py +739 -0
- memori/database/adapters/mysql_adapter.py +8 -8
- memori/database/adapters/postgresql_adapter.py +6 -6
- memori/database/adapters/sqlite_adapter.py +6 -6
- memori/database/auto_creator.py +8 -9
- memori/database/connection_utils.py +5 -5
- memori/database/connectors/__init__.py +11 -0
- memori/database/connectors/base_connector.py +18 -19
- memori/database/connectors/mongodb_connector.py +654 -0
- memori/database/connectors/mysql_connector.py +13 -15
- memori/database/connectors/postgres_connector.py +12 -12
- memori/database/connectors/sqlite_connector.py +11 -11
- memori/database/models.py +2 -2
- memori/database/mongodb_manager.py +1484 -0
- memori/database/queries/base_queries.py +3 -4
- memori/database/queries/chat_queries.py +3 -5
- memori/database/queries/entity_queries.py +3 -5
- memori/database/queries/memory_queries.py +3 -5
- memori/database/query_translator.py +11 -11
- memori/database/schema_generators/__init__.py +11 -0
- memori/database/schema_generators/mongodb_schema_generator.py +666 -0
- memori/database/schema_generators/mysql_schema_generator.py +2 -4
- memori/database/search/__init__.py +11 -0
- memori/database/search/mongodb_search_adapter.py +653 -0
- memori/database/search/mysql_search_adapter.py +8 -8
- memori/database/search/sqlite_search_adapter.py +6 -6
- memori/database/search_service.py +17 -17
- memori/database/sqlalchemy_manager.py +10 -12
- memori/integrations/__init__.py +1 -1
- memori/integrations/anthropic_integration.py +1 -3
- memori/integrations/litellm_integration.py +23 -6
- memori/integrations/openai_integration.py +31 -3
- memori/tools/memory_tool.py +10 -9
- memori/utils/exceptions.py +58 -58
- memori/utils/helpers.py +11 -12
- memori/utils/input_validator.py +10 -12
- memori/utils/logging.py +4 -4
- memori/utils/pydantic_models.py +57 -57
- memori/utils/query_builder.py +20 -20
- memori/utils/security_audit.py +28 -28
- memori/utils/security_integration.py +9 -9
- memori/utils/transaction_manager.py +20 -19
- memori/utils/validators.py +6 -6
- {memorisdk-2.0.1.dist-info → memorisdk-2.1.1.dist-info}/METADATA +23 -12
- memorisdk-2.1.1.dist-info/RECORD +71 -0
- memorisdk-2.0.1.dist-info/RECORD +0 -66
- {memorisdk-2.0.1.dist-info → memorisdk-2.1.1.dist-info}/WHEEL +0 -0
- {memorisdk-2.0.1.dist-info → memorisdk-2.1.1.dist-info}/licenses/LICENSE +0 -0
- {memorisdk-2.0.1.dist-info → memorisdk-2.1.1.dist-info}/top_level.txt +0 -0
memori/core/providers.py
CHANGED
|
@@ -4,7 +4,7 @@ Provider configuration for different LLM providers (OpenAI, Azure, custom)
|
|
|
4
4
|
|
|
5
5
|
from dataclasses import dataclass
|
|
6
6
|
from enum import Enum
|
|
7
|
-
from typing import Any
|
|
7
|
+
from typing import Any
|
|
8
8
|
|
|
9
9
|
from loguru import logger
|
|
10
10
|
|
|
@@ -28,35 +28,35 @@ class ProviderConfig:
|
|
|
28
28
|
"""
|
|
29
29
|
|
|
30
30
|
# Common parameters
|
|
31
|
-
api_key:
|
|
32
|
-
api_type:
|
|
33
|
-
base_url:
|
|
34
|
-
timeout:
|
|
35
|
-
max_retries:
|
|
31
|
+
api_key: str | None = None
|
|
32
|
+
api_type: str | None = None # "openai", "azure", or custom
|
|
33
|
+
base_url: str | None = None # Custom endpoint URL
|
|
34
|
+
timeout: float | None = None
|
|
35
|
+
max_retries: int | None = None
|
|
36
36
|
|
|
37
37
|
# Azure-specific parameters
|
|
38
|
-
azure_endpoint:
|
|
39
|
-
azure_deployment:
|
|
40
|
-
api_version:
|
|
41
|
-
azure_ad_token:
|
|
38
|
+
azure_endpoint: str | None = None
|
|
39
|
+
azure_deployment: str | None = None
|
|
40
|
+
api_version: str | None = None
|
|
41
|
+
azure_ad_token: str | None = None
|
|
42
42
|
|
|
43
43
|
# OpenAI-specific parameters
|
|
44
|
-
organization:
|
|
45
|
-
project:
|
|
44
|
+
organization: str | None = None
|
|
45
|
+
project: str | None = None
|
|
46
46
|
|
|
47
47
|
# Model configuration
|
|
48
|
-
model:
|
|
48
|
+
model: str | None = None # User can specify model, defaults to gpt-4o if not set
|
|
49
49
|
|
|
50
50
|
# Additional headers for custom providers
|
|
51
|
-
default_headers:
|
|
52
|
-
default_query:
|
|
51
|
+
default_headers: dict[str, str] | None = None
|
|
52
|
+
default_query: dict[str, Any] | None = None
|
|
53
53
|
|
|
54
54
|
# HTTP client configuration
|
|
55
|
-
http_client:
|
|
55
|
+
http_client: Any | None = None
|
|
56
56
|
|
|
57
57
|
@classmethod
|
|
58
58
|
def from_openai(
|
|
59
|
-
cls, api_key:
|
|
59
|
+
cls, api_key: str | None = None, model: str | None = None, **kwargs
|
|
60
60
|
):
|
|
61
61
|
"""Create configuration for standard OpenAI"""
|
|
62
62
|
return cls(api_key=api_key, api_type="openai", model=model, **kwargs)
|
|
@@ -64,11 +64,11 @@ class ProviderConfig:
|
|
|
64
64
|
@classmethod
|
|
65
65
|
def from_azure(
|
|
66
66
|
cls,
|
|
67
|
-
api_key:
|
|
68
|
-
azure_endpoint:
|
|
69
|
-
azure_deployment:
|
|
70
|
-
api_version:
|
|
71
|
-
model:
|
|
67
|
+
api_key: str | None = None,
|
|
68
|
+
azure_endpoint: str | None = None,
|
|
69
|
+
azure_deployment: str | None = None,
|
|
70
|
+
api_version: str | None = None,
|
|
71
|
+
model: str | None = None,
|
|
72
72
|
**kwargs,
|
|
73
73
|
):
|
|
74
74
|
"""Create configuration for Azure OpenAI"""
|
|
@@ -86,8 +86,8 @@ class ProviderConfig:
|
|
|
86
86
|
def from_custom(
|
|
87
87
|
cls,
|
|
88
88
|
base_url: str,
|
|
89
|
-
api_key:
|
|
90
|
-
model:
|
|
89
|
+
api_key: str | None = None,
|
|
90
|
+
model: str | None = None,
|
|
91
91
|
**kwargs,
|
|
92
92
|
):
|
|
93
93
|
"""Create configuration for custom OpenAI-compatible endpoints"""
|
|
@@ -95,7 +95,7 @@ class ProviderConfig:
|
|
|
95
95
|
api_key=api_key, api_type="custom", base_url=base_url, model=model, **kwargs
|
|
96
96
|
)
|
|
97
97
|
|
|
98
|
-
def get_openai_client_kwargs(self) ->
|
|
98
|
+
def get_openai_client_kwargs(self) -> dict[str, Any]:
|
|
99
99
|
"""
|
|
100
100
|
Get kwargs for OpenAI client initialization based on provider type.
|
|
101
101
|
|
memori/database/__init__.py
CHANGED
|
@@ -2,4 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
from .connectors import MySQLConnector, PostgreSQLConnector, SQLiteConnector
|
|
4
4
|
|
|
5
|
+
try:
|
|
6
|
+
from .connectors import MongoDBConnector
|
|
7
|
+
|
|
8
|
+
MONGODB_AVAILABLE = True
|
|
9
|
+
except ImportError:
|
|
10
|
+
MongoDBConnector = None # type: ignore
|
|
11
|
+
MONGODB_AVAILABLE = False
|
|
12
|
+
|
|
5
13
|
__all__ = ["SQLiteConnector", "PostgreSQLConnector", "MySQLConnector"]
|
|
14
|
+
|
|
15
|
+
if MONGODB_AVAILABLE:
|
|
16
|
+
__all__.append("MongoDBConnector")
|
|
@@ -7,4 +7,15 @@ from .mysql_adapter import MySQLSearchAdapter
|
|
|
7
7
|
from .postgresql_adapter import PostgreSQLSearchAdapter
|
|
8
8
|
from .sqlite_adapter import SQLiteSearchAdapter
|
|
9
9
|
|
|
10
|
+
try:
|
|
11
|
+
from .mongodb_adapter import MongoDBAdapter
|
|
12
|
+
|
|
13
|
+
MONGODB_ADAPTER_AVAILABLE = True
|
|
14
|
+
except ImportError:
|
|
15
|
+
MongoDBAdapter = None # type: ignore
|
|
16
|
+
MONGODB_ADAPTER_AVAILABLE = False
|
|
17
|
+
|
|
10
18
|
__all__ = ["SQLiteSearchAdapter", "PostgreSQLSearchAdapter", "MySQLSearchAdapter"]
|
|
19
|
+
|
|
20
|
+
if MONGODB_ADAPTER_AVAILABLE:
|
|
21
|
+
__all__.append("MongoDBAdapter")
|