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.
Files changed (123) hide show
  1. powermem/__init__.py +103 -0
  2. powermem/agent/__init__.py +35 -0
  3. powermem/agent/abstract/__init__.py +22 -0
  4. powermem/agent/abstract/collaboration.py +259 -0
  5. powermem/agent/abstract/context.py +187 -0
  6. powermem/agent/abstract/manager.py +232 -0
  7. powermem/agent/abstract/permission.py +217 -0
  8. powermem/agent/abstract/privacy.py +267 -0
  9. powermem/agent/abstract/scope.py +199 -0
  10. powermem/agent/agent.py +791 -0
  11. powermem/agent/components/__init__.py +18 -0
  12. powermem/agent/components/collaboration_coordinator.py +645 -0
  13. powermem/agent/components/permission_controller.py +586 -0
  14. powermem/agent/components/privacy_protector.py +767 -0
  15. powermem/agent/components/scope_controller.py +685 -0
  16. powermem/agent/factories/__init__.py +16 -0
  17. powermem/agent/factories/agent_factory.py +266 -0
  18. powermem/agent/factories/config_factory.py +308 -0
  19. powermem/agent/factories/memory_factory.py +229 -0
  20. powermem/agent/implementations/__init__.py +16 -0
  21. powermem/agent/implementations/hybrid.py +728 -0
  22. powermem/agent/implementations/multi_agent.py +1040 -0
  23. powermem/agent/implementations/multi_user.py +1020 -0
  24. powermem/agent/types.py +53 -0
  25. powermem/agent/wrappers/__init__.py +14 -0
  26. powermem/agent/wrappers/agent_memory_wrapper.py +427 -0
  27. powermem/agent/wrappers/compatibility_wrapper.py +520 -0
  28. powermem/config_loader.py +318 -0
  29. powermem/configs.py +249 -0
  30. powermem/core/__init__.py +19 -0
  31. powermem/core/async_memory.py +1493 -0
  32. powermem/core/audit.py +258 -0
  33. powermem/core/base.py +165 -0
  34. powermem/core/memory.py +1567 -0
  35. powermem/core/setup.py +162 -0
  36. powermem/core/telemetry.py +215 -0
  37. powermem/integrations/__init__.py +17 -0
  38. powermem/integrations/embeddings/__init__.py +13 -0
  39. powermem/integrations/embeddings/aws_bedrock.py +100 -0
  40. powermem/integrations/embeddings/azure_openai.py +55 -0
  41. powermem/integrations/embeddings/base.py +31 -0
  42. powermem/integrations/embeddings/config/base.py +132 -0
  43. powermem/integrations/embeddings/configs.py +31 -0
  44. powermem/integrations/embeddings/factory.py +48 -0
  45. powermem/integrations/embeddings/gemini.py +39 -0
  46. powermem/integrations/embeddings/huggingface.py +41 -0
  47. powermem/integrations/embeddings/langchain.py +35 -0
  48. powermem/integrations/embeddings/lmstudio.py +29 -0
  49. powermem/integrations/embeddings/mock.py +11 -0
  50. powermem/integrations/embeddings/ollama.py +53 -0
  51. powermem/integrations/embeddings/openai.py +49 -0
  52. powermem/integrations/embeddings/qwen.py +102 -0
  53. powermem/integrations/embeddings/together.py +31 -0
  54. powermem/integrations/embeddings/vertexai.py +54 -0
  55. powermem/integrations/llm/__init__.py +18 -0
  56. powermem/integrations/llm/anthropic.py +87 -0
  57. powermem/integrations/llm/base.py +132 -0
  58. powermem/integrations/llm/config/anthropic.py +56 -0
  59. powermem/integrations/llm/config/azure.py +56 -0
  60. powermem/integrations/llm/config/base.py +62 -0
  61. powermem/integrations/llm/config/deepseek.py +56 -0
  62. powermem/integrations/llm/config/ollama.py +56 -0
  63. powermem/integrations/llm/config/openai.py +79 -0
  64. powermem/integrations/llm/config/qwen.py +68 -0
  65. powermem/integrations/llm/config/qwen_asr.py +46 -0
  66. powermem/integrations/llm/config/vllm.py +56 -0
  67. powermem/integrations/llm/configs.py +26 -0
  68. powermem/integrations/llm/deepseek.py +106 -0
  69. powermem/integrations/llm/factory.py +118 -0
  70. powermem/integrations/llm/gemini.py +201 -0
  71. powermem/integrations/llm/langchain.py +65 -0
  72. powermem/integrations/llm/ollama.py +106 -0
  73. powermem/integrations/llm/openai.py +166 -0
  74. powermem/integrations/llm/openai_structured.py +80 -0
  75. powermem/integrations/llm/qwen.py +207 -0
  76. powermem/integrations/llm/qwen_asr.py +171 -0
  77. powermem/integrations/llm/vllm.py +106 -0
  78. powermem/integrations/rerank/__init__.py +20 -0
  79. powermem/integrations/rerank/base.py +43 -0
  80. powermem/integrations/rerank/config/__init__.py +7 -0
  81. powermem/integrations/rerank/config/base.py +27 -0
  82. powermem/integrations/rerank/configs.py +23 -0
  83. powermem/integrations/rerank/factory.py +68 -0
  84. powermem/integrations/rerank/qwen.py +159 -0
  85. powermem/intelligence/__init__.py +17 -0
  86. powermem/intelligence/ebbinghaus_algorithm.py +354 -0
  87. powermem/intelligence/importance_evaluator.py +361 -0
  88. powermem/intelligence/intelligent_memory_manager.py +284 -0
  89. powermem/intelligence/manager.py +148 -0
  90. powermem/intelligence/plugin.py +229 -0
  91. powermem/prompts/__init__.py +29 -0
  92. powermem/prompts/graph/graph_prompts.py +217 -0
  93. powermem/prompts/graph/graph_tools_prompts.py +469 -0
  94. powermem/prompts/importance_evaluation.py +246 -0
  95. powermem/prompts/intelligent_memory_prompts.py +163 -0
  96. powermem/prompts/templates.py +193 -0
  97. powermem/storage/__init__.py +14 -0
  98. powermem/storage/adapter.py +896 -0
  99. powermem/storage/base.py +109 -0
  100. powermem/storage/config/base.py +13 -0
  101. powermem/storage/config/oceanbase.py +58 -0
  102. powermem/storage/config/pgvector.py +52 -0
  103. powermem/storage/config/sqlite.py +27 -0
  104. powermem/storage/configs.py +159 -0
  105. powermem/storage/factory.py +59 -0
  106. powermem/storage/migration_manager.py +438 -0
  107. powermem/storage/oceanbase/__init__.py +8 -0
  108. powermem/storage/oceanbase/constants.py +162 -0
  109. powermem/storage/oceanbase/oceanbase.py +1384 -0
  110. powermem/storage/oceanbase/oceanbase_graph.py +1441 -0
  111. powermem/storage/pgvector/__init__.py +7 -0
  112. powermem/storage/pgvector/pgvector.py +420 -0
  113. powermem/storage/sqlite/__init__.py +0 -0
  114. powermem/storage/sqlite/sqlite.py +218 -0
  115. powermem/storage/sqlite/sqlite_vector_store.py +311 -0
  116. powermem/utils/__init__.py +35 -0
  117. powermem/utils/utils.py +605 -0
  118. powermem/version.py +23 -0
  119. powermem-0.1.0.dist-info/METADATA +187 -0
  120. powermem-0.1.0.dist-info/RECORD +123 -0
  121. powermem-0.1.0.dist-info/WHEEL +5 -0
  122. powermem-0.1.0.dist-info/licenses/LICENSE +206 -0
  123. 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