powermem 0.1.0__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.
- powermem/__init__.py +103 -0
- powermem/agent/__init__.py +35 -0
- powermem/agent/abstract/__init__.py +22 -0
- powermem/agent/abstract/collaboration.py +259 -0
- powermem/agent/abstract/context.py +187 -0
- powermem/agent/abstract/manager.py +232 -0
- powermem/agent/abstract/permission.py +217 -0
- powermem/agent/abstract/privacy.py +267 -0
- powermem/agent/abstract/scope.py +199 -0
- powermem/agent/agent.py +791 -0
- powermem/agent/components/__init__.py +18 -0
- powermem/agent/components/collaboration_coordinator.py +645 -0
- powermem/agent/components/permission_controller.py +586 -0
- powermem/agent/components/privacy_protector.py +767 -0
- powermem/agent/components/scope_controller.py +685 -0
- powermem/agent/factories/__init__.py +16 -0
- powermem/agent/factories/agent_factory.py +266 -0
- powermem/agent/factories/config_factory.py +308 -0
- powermem/agent/factories/memory_factory.py +229 -0
- powermem/agent/implementations/__init__.py +16 -0
- powermem/agent/implementations/hybrid.py +728 -0
- powermem/agent/implementations/multi_agent.py +1040 -0
- powermem/agent/implementations/multi_user.py +1020 -0
- powermem/agent/types.py +53 -0
- powermem/agent/wrappers/__init__.py +14 -0
- powermem/agent/wrappers/agent_memory_wrapper.py +427 -0
- powermem/agent/wrappers/compatibility_wrapper.py +520 -0
- powermem/config_loader.py +318 -0
- powermem/configs.py +249 -0
- powermem/core/__init__.py +19 -0
- powermem/core/async_memory.py +1493 -0
- powermem/core/audit.py +258 -0
- powermem/core/base.py +165 -0
- powermem/core/memory.py +1567 -0
- powermem/core/setup.py +162 -0
- powermem/core/telemetry.py +215 -0
- powermem/integrations/__init__.py +17 -0
- powermem/integrations/embeddings/__init__.py +13 -0
- powermem/integrations/embeddings/aws_bedrock.py +100 -0
- powermem/integrations/embeddings/azure_openai.py +55 -0
- powermem/integrations/embeddings/base.py +31 -0
- powermem/integrations/embeddings/config/base.py +132 -0
- powermem/integrations/embeddings/configs.py +31 -0
- powermem/integrations/embeddings/factory.py +48 -0
- powermem/integrations/embeddings/gemini.py +39 -0
- powermem/integrations/embeddings/huggingface.py +41 -0
- powermem/integrations/embeddings/langchain.py +35 -0
- powermem/integrations/embeddings/lmstudio.py +29 -0
- powermem/integrations/embeddings/mock.py +11 -0
- powermem/integrations/embeddings/ollama.py +53 -0
- powermem/integrations/embeddings/openai.py +49 -0
- powermem/integrations/embeddings/qwen.py +102 -0
- powermem/integrations/embeddings/together.py +31 -0
- powermem/integrations/embeddings/vertexai.py +54 -0
- powermem/integrations/llm/__init__.py +18 -0
- powermem/integrations/llm/anthropic.py +87 -0
- powermem/integrations/llm/base.py +132 -0
- powermem/integrations/llm/config/anthropic.py +56 -0
- powermem/integrations/llm/config/azure.py +56 -0
- powermem/integrations/llm/config/base.py +62 -0
- powermem/integrations/llm/config/deepseek.py +56 -0
- powermem/integrations/llm/config/ollama.py +56 -0
- powermem/integrations/llm/config/openai.py +79 -0
- powermem/integrations/llm/config/qwen.py +68 -0
- powermem/integrations/llm/config/qwen_asr.py +46 -0
- powermem/integrations/llm/config/vllm.py +56 -0
- powermem/integrations/llm/configs.py +26 -0
- powermem/integrations/llm/deepseek.py +106 -0
- powermem/integrations/llm/factory.py +118 -0
- powermem/integrations/llm/gemini.py +201 -0
- powermem/integrations/llm/langchain.py +65 -0
- powermem/integrations/llm/ollama.py +106 -0
- powermem/integrations/llm/openai.py +166 -0
- powermem/integrations/llm/openai_structured.py +80 -0
- powermem/integrations/llm/qwen.py +207 -0
- powermem/integrations/llm/qwen_asr.py +171 -0
- powermem/integrations/llm/vllm.py +106 -0
- powermem/integrations/rerank/__init__.py +20 -0
- powermem/integrations/rerank/base.py +43 -0
- powermem/integrations/rerank/config/__init__.py +7 -0
- powermem/integrations/rerank/config/base.py +27 -0
- powermem/integrations/rerank/configs.py +23 -0
- powermem/integrations/rerank/factory.py +68 -0
- powermem/integrations/rerank/qwen.py +159 -0
- powermem/intelligence/__init__.py +17 -0
- powermem/intelligence/ebbinghaus_algorithm.py +354 -0
- powermem/intelligence/importance_evaluator.py +361 -0
- powermem/intelligence/intelligent_memory_manager.py +284 -0
- powermem/intelligence/manager.py +148 -0
- powermem/intelligence/plugin.py +229 -0
- powermem/prompts/__init__.py +29 -0
- powermem/prompts/graph/graph_prompts.py +217 -0
- powermem/prompts/graph/graph_tools_prompts.py +469 -0
- powermem/prompts/importance_evaluation.py +246 -0
- powermem/prompts/intelligent_memory_prompts.py +163 -0
- powermem/prompts/templates.py +193 -0
- powermem/storage/__init__.py +14 -0
- powermem/storage/adapter.py +896 -0
- powermem/storage/base.py +109 -0
- powermem/storage/config/base.py +13 -0
- powermem/storage/config/oceanbase.py +58 -0
- powermem/storage/config/pgvector.py +52 -0
- powermem/storage/config/sqlite.py +27 -0
- powermem/storage/configs.py +159 -0
- powermem/storage/factory.py +59 -0
- powermem/storage/migration_manager.py +438 -0
- powermem/storage/oceanbase/__init__.py +8 -0
- powermem/storage/oceanbase/constants.py +162 -0
- powermem/storage/oceanbase/oceanbase.py +1384 -0
- powermem/storage/oceanbase/oceanbase_graph.py +1441 -0
- powermem/storage/pgvector/__init__.py +7 -0
- powermem/storage/pgvector/pgvector.py +420 -0
- powermem/storage/sqlite/__init__.py +0 -0
- powermem/storage/sqlite/sqlite.py +218 -0
- powermem/storage/sqlite/sqlite_vector_store.py +311 -0
- powermem/utils/__init__.py +35 -0
- powermem/utils/utils.py +605 -0
- powermem/version.py +23 -0
- powermem-0.1.0.dist-info/METADATA +187 -0
- powermem-0.1.0.dist-info/RECORD +123 -0
- powermem-0.1.0.dist-info/WHEEL +5 -0
- powermem-0.1.0.dist-info/licenses/LICENSE +206 -0
- powermem-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Abstract base class for agent scope managers.
|
|
3
|
+
|
|
4
|
+
This module defines the interface for managing memory scopes and access control
|
|
5
|
+
in the agent memory system.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from abc import ABC, abstractmethod
|
|
9
|
+
from typing import Any, Dict, List, Optional
|
|
10
|
+
|
|
11
|
+
from powermem.agent.types import MemoryScope
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class AgentScopeManagerBase(ABC):
|
|
15
|
+
"""
|
|
16
|
+
Abstract base class for agent scope managers.
|
|
17
|
+
|
|
18
|
+
This class defines the interface for managing memory scopes and access control
|
|
19
|
+
in the agent memory system.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
def __init__(self, config: Dict[str, Any]):
|
|
23
|
+
"""
|
|
24
|
+
Initialize the scope manager.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
config: Configuration dictionary
|
|
28
|
+
"""
|
|
29
|
+
self.config = config
|
|
30
|
+
self.initialized = False
|
|
31
|
+
|
|
32
|
+
@abstractmethod
|
|
33
|
+
def initialize(self) -> None:
|
|
34
|
+
"""
|
|
35
|
+
Initialize the scope manager.
|
|
36
|
+
"""
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
@abstractmethod
|
|
40
|
+
def determine_scope(
|
|
41
|
+
self,
|
|
42
|
+
agent_id: str,
|
|
43
|
+
context: Optional[Dict[str, Any]] = None,
|
|
44
|
+
metadata: Optional[Dict[str, Any]] = None
|
|
45
|
+
) -> MemoryScope:
|
|
46
|
+
"""
|
|
47
|
+
Determine the appropriate scope for a memory.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
agent_id: ID of the agent/user creating the memory
|
|
51
|
+
context: Optional context information
|
|
52
|
+
metadata: Optional metadata information
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
MemoryScope enum value
|
|
56
|
+
"""
|
|
57
|
+
pass
|
|
58
|
+
|
|
59
|
+
@abstractmethod
|
|
60
|
+
def get_accessible_memories(
|
|
61
|
+
self,
|
|
62
|
+
agent_id: str,
|
|
63
|
+
scope: Optional[MemoryScope] = None
|
|
64
|
+
) -> List[str]:
|
|
65
|
+
"""
|
|
66
|
+
Get list of memory IDs accessible to an agent/user.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
agent_id: ID of the agent/user
|
|
70
|
+
scope: Optional scope filter
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
List of accessible memory IDs
|
|
74
|
+
"""
|
|
75
|
+
pass
|
|
76
|
+
|
|
77
|
+
@abstractmethod
|
|
78
|
+
def check_scope_access(
|
|
79
|
+
self,
|
|
80
|
+
agent_id: str,
|
|
81
|
+
memory_id: str
|
|
82
|
+
) -> bool:
|
|
83
|
+
"""
|
|
84
|
+
Check if an agent/user has access to a memory based on scope.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
agent_id: ID of the agent/user
|
|
88
|
+
memory_id: ID of the memory
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
True if access is allowed, False otherwise
|
|
92
|
+
"""
|
|
93
|
+
pass
|
|
94
|
+
|
|
95
|
+
@abstractmethod
|
|
96
|
+
def update_memory_scope(
|
|
97
|
+
self,
|
|
98
|
+
memory_id: str,
|
|
99
|
+
new_scope: MemoryScope,
|
|
100
|
+
agent_id: str
|
|
101
|
+
) -> Dict[str, Any]:
|
|
102
|
+
"""
|
|
103
|
+
Update the scope of a memory.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
memory_id: ID of the memory
|
|
107
|
+
new_scope: New scope for the memory
|
|
108
|
+
agent_id: ID of the agent/user making the change
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
Dictionary containing the update result
|
|
112
|
+
"""
|
|
113
|
+
pass
|
|
114
|
+
|
|
115
|
+
@abstractmethod
|
|
116
|
+
def get_scope_members(
|
|
117
|
+
self,
|
|
118
|
+
scope: MemoryScope,
|
|
119
|
+
memory_id: Optional[str] = None
|
|
120
|
+
) -> List[str]:
|
|
121
|
+
"""
|
|
122
|
+
Get list of agents/users with access to a scope.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
scope: Memory scope
|
|
126
|
+
memory_id: Optional specific memory ID
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
List of agent/user IDs with access
|
|
130
|
+
"""
|
|
131
|
+
pass
|
|
132
|
+
|
|
133
|
+
@abstractmethod
|
|
134
|
+
def add_scope_member(
|
|
135
|
+
self,
|
|
136
|
+
scope: MemoryScope,
|
|
137
|
+
agent_id: str,
|
|
138
|
+
memory_id: Optional[str] = None
|
|
139
|
+
) -> Dict[str, Any]:
|
|
140
|
+
"""
|
|
141
|
+
Add an agent/user to a scope.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
scope: Memory scope
|
|
145
|
+
agent_id: ID of the agent/user to add
|
|
146
|
+
memory_id: Optional specific memory ID
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
Dictionary containing the add result
|
|
150
|
+
"""
|
|
151
|
+
pass
|
|
152
|
+
|
|
153
|
+
@abstractmethod
|
|
154
|
+
def remove_scope_member(
|
|
155
|
+
self,
|
|
156
|
+
scope: MemoryScope,
|
|
157
|
+
agent_id: str,
|
|
158
|
+
memory_id: Optional[str] = None
|
|
159
|
+
) -> Dict[str, Any]:
|
|
160
|
+
"""
|
|
161
|
+
Remove an agent/user from a scope.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
scope: Memory scope
|
|
165
|
+
agent_id: ID of the agent/user to remove
|
|
166
|
+
memory_id: Optional specific memory ID
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
Dictionary containing the removal result
|
|
170
|
+
"""
|
|
171
|
+
pass
|
|
172
|
+
|
|
173
|
+
@abstractmethod
|
|
174
|
+
def get_scope_statistics(self) -> Dict[str, Any]:
|
|
175
|
+
"""
|
|
176
|
+
Get statistics about scope usage.
|
|
177
|
+
|
|
178
|
+
Returns:
|
|
179
|
+
Dictionary containing scope statistics
|
|
180
|
+
"""
|
|
181
|
+
pass
|
|
182
|
+
|
|
183
|
+
def is_initialized(self) -> bool:
|
|
184
|
+
"""
|
|
185
|
+
Check if the scope manager is initialized.
|
|
186
|
+
|
|
187
|
+
Returns:
|
|
188
|
+
True if initialized, False otherwise
|
|
189
|
+
"""
|
|
190
|
+
return self.initialized
|
|
191
|
+
|
|
192
|
+
def get_config(self) -> Dict[str, Any]:
|
|
193
|
+
"""
|
|
194
|
+
Get the configuration object.
|
|
195
|
+
|
|
196
|
+
Returns:
|
|
197
|
+
Configuration dictionary
|
|
198
|
+
"""
|
|
199
|
+
return self.config
|