agenticmem 0.1.0__py3-none-any.whl → 0.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 agenticmem might be problematic. Click here for more details.
- agenticmem/__init__.py +32 -14
- agenticmem/client.py +142 -86
- agenticmem/client_utils.py +12 -0
- agenticmem-0.1.1.dist-info/METADATA +142 -0
- agenticmem-0.1.1.dist-info/RECORD +6 -0
- agenticmem-0.1.0.dist-info/METADATA +0 -102
- agenticmem-0.1.0.dist-info/RECORD +0 -5
- {agenticmem-0.1.0.dist-info → agenticmem-0.1.1.dist-info}/WHEEL +0 -0
agenticmem/__init__.py
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
__app_name__ = "agenticmem"
|
|
2
|
+
__version__ = "0.1.1"
|
|
3
|
+
|
|
4
|
+
|
|
1
5
|
from agenticmem.client import AgenticMemClient
|
|
2
|
-
from
|
|
6
|
+
from agenticmem_commons.api_schema.service_schemas import (
|
|
3
7
|
UserActionType,
|
|
4
8
|
ProfileTimeToLive,
|
|
5
9
|
InteractionRequest,
|
|
@@ -12,18 +16,32 @@ from server.api_schema.service_schemas import (
|
|
|
12
16
|
DeleteUserInteractionRequest,
|
|
13
17
|
DeleteUserInteractionResponse,
|
|
14
18
|
)
|
|
19
|
+
from agenticmem_commons.api_schema.retriever_schema import (
|
|
20
|
+
SearchInteractionRequest,
|
|
21
|
+
SearchUserProfileRequest,
|
|
22
|
+
SearchInteractionResponse,
|
|
23
|
+
SearchUserProfileResponse,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
debug = False
|
|
27
|
+
log = None # Set to either 'debug' or 'info', controls console logging
|
|
28
|
+
|
|
15
29
|
|
|
16
30
|
__all__ = [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
"AgenticMemClient",
|
|
32
|
+
"UserActionType",
|
|
33
|
+
"ProfileTimeToLive",
|
|
34
|
+
"InteractionRequest",
|
|
35
|
+
"Interaction",
|
|
36
|
+
"UserProfile",
|
|
37
|
+
"PublishUserInteractionRequest",
|
|
38
|
+
"PublishUserInteractionResponse",
|
|
39
|
+
"DeleteUserProfileRequest",
|
|
40
|
+
"DeleteUserProfileResponse",
|
|
41
|
+
"DeleteUserInteractionRequest",
|
|
42
|
+
"DeleteUserInteractionResponse",
|
|
43
|
+
"SearchInteractionRequest",
|
|
44
|
+
"SearchUserProfileRequest",
|
|
45
|
+
"SearchInteractionResponse",
|
|
46
|
+
"SearchUserProfileResponse",
|
|
47
|
+
]
|
agenticmem/client.py
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
from typing import List, Optional
|
|
2
|
-
from datetime import datetime
|
|
3
1
|
import requests
|
|
4
2
|
from urllib.parse import urljoin
|
|
3
|
+
import os
|
|
4
|
+
from typing import Optional, Union
|
|
5
|
+
from agenticmem_commons.api_schema.retriever_schema import (
|
|
6
|
+
SearchInteractionRequest,
|
|
7
|
+
SearchInteractionResponse,
|
|
8
|
+
SearchUserProfileRequest,
|
|
9
|
+
SearchUserProfileResponse,
|
|
10
|
+
GetInteractionsRequest,
|
|
11
|
+
GetInteractionsResponse,
|
|
12
|
+
GetUserProfilesRequest,
|
|
13
|
+
GetUserProfilesResponse,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
if os.environ.get("TEST_ENV", "False") == "True":
|
|
17
|
+
BACKEND_URL = "http://127.0.0.1:8000" # Local server for testing
|
|
18
|
+
else:
|
|
19
|
+
BACKEND_URL = "http://agenticmem-test.us-west-2.elasticbeanstalk.com:8081" # Elastic Beanstalk server url
|
|
5
20
|
|
|
6
|
-
from
|
|
7
|
-
Interaction,
|
|
21
|
+
from agenticmem_commons.api_schema.service_schemas import (
|
|
8
22
|
InteractionRequest,
|
|
9
|
-
|
|
23
|
+
ProfileChangeLogResponse,
|
|
10
24
|
PublishUserInteractionRequest,
|
|
11
25
|
PublishUserInteractionResponse,
|
|
12
26
|
DeleteUserProfileRequest,
|
|
@@ -14,38 +28,46 @@ from server.api_schema.service_schemas import (
|
|
|
14
28
|
DeleteUserInteractionRequest,
|
|
15
29
|
DeleteUserInteractionResponse,
|
|
16
30
|
)
|
|
17
|
-
from
|
|
31
|
+
from agenticmem_commons.api_schema.login_schema import Token
|
|
18
32
|
|
|
19
33
|
|
|
20
34
|
class AgenticMemClient:
|
|
21
35
|
"""Client for interacting with the AgenticMem API."""
|
|
22
36
|
|
|
23
|
-
def __init__(self, api_key: str):
|
|
37
|
+
def __init__(self, api_key: str = ""):
|
|
24
38
|
"""Initialize the AgenticMem client.
|
|
25
39
|
|
|
26
40
|
Args:
|
|
27
41
|
api_key (str): Your API key for authentication
|
|
28
42
|
"""
|
|
29
43
|
self.api_key = api_key
|
|
30
|
-
self.base_url =
|
|
44
|
+
self.base_url = BACKEND_URL
|
|
31
45
|
self.session = requests.Session()
|
|
32
|
-
self.session.headers.update({
|
|
33
|
-
"Authorization": f"Bearer {api_key}",
|
|
34
|
-
"Content-Type": "application/json"
|
|
35
|
-
})
|
|
36
46
|
|
|
37
|
-
def _make_request(
|
|
47
|
+
def _make_request(
|
|
48
|
+
self, method: str, endpoint: str, headers: Optional[dict] = None, **kwargs
|
|
49
|
+
):
|
|
38
50
|
"""Make an HTTP request to the API.
|
|
39
51
|
|
|
40
52
|
Args:
|
|
41
53
|
method (str): HTTP method (GET, POST, DELETE)
|
|
42
54
|
endpoint (str): API endpoint
|
|
55
|
+
headers (dict, optional): Additional headers to include in the request
|
|
43
56
|
**kwargs: Additional arguments to pass to requests
|
|
44
57
|
|
|
45
58
|
Returns:
|
|
46
59
|
dict: API response
|
|
47
60
|
"""
|
|
48
61
|
url = urljoin(self.base_url, endpoint)
|
|
62
|
+
if self.api_key:
|
|
63
|
+
self.session.headers.update(
|
|
64
|
+
{
|
|
65
|
+
"Authorization": f"Bearer {self.api_key}",
|
|
66
|
+
"Content-Type": "application/json",
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
if headers:
|
|
70
|
+
self.session.headers.update(headers)
|
|
49
71
|
response = self.session.request(method, url, **kwargs)
|
|
50
72
|
response.raise_for_status()
|
|
51
73
|
return response.json()
|
|
@@ -60,115 +82,102 @@ class AgenticMemClient:
|
|
|
60
82
|
Returns:
|
|
61
83
|
Token: Response containing success status and message
|
|
62
84
|
"""
|
|
63
|
-
response = self._make_request(
|
|
85
|
+
response = self._make_request(
|
|
86
|
+
"POST",
|
|
87
|
+
"/token",
|
|
88
|
+
data={"username": email, "password": password},
|
|
89
|
+
headers={
|
|
90
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
91
|
+
"accept": "application/json",
|
|
92
|
+
},
|
|
93
|
+
)
|
|
64
94
|
return Token(**response)
|
|
65
95
|
|
|
66
96
|
def publish_interaction(
|
|
67
97
|
self,
|
|
68
|
-
user_id: str,
|
|
69
98
|
request_id: str,
|
|
70
|
-
|
|
99
|
+
user_id: str,
|
|
100
|
+
interaction_requests: list[Union[InteractionRequest, dict]],
|
|
71
101
|
) -> PublishUserInteractionResponse:
|
|
72
102
|
"""Publish user interactions.
|
|
73
103
|
|
|
74
104
|
Args:
|
|
75
|
-
user_id (str): The user ID
|
|
76
105
|
request_id (str): The request ID
|
|
106
|
+
user_id (str): The user ID
|
|
77
107
|
interaction_requests (List[InteractionRequest]): List of interaction requests
|
|
78
108
|
|
|
79
109
|
Returns:
|
|
80
110
|
PublishUserInteractionResponse: Response containing success status and message
|
|
81
111
|
"""
|
|
112
|
+
interaction_requests = [
|
|
113
|
+
(
|
|
114
|
+
InteractionRequest(**interaction_request)
|
|
115
|
+
if isinstance(interaction_request, dict)
|
|
116
|
+
else interaction_request
|
|
117
|
+
)
|
|
118
|
+
for interaction_request in interaction_requests
|
|
119
|
+
]
|
|
82
120
|
request = PublishUserInteractionRequest(
|
|
83
|
-
user_id=user_id,
|
|
84
121
|
request_id=request_id,
|
|
85
|
-
|
|
122
|
+
user_id=user_id,
|
|
123
|
+
interaction_requests=interaction_requests,
|
|
124
|
+
)
|
|
125
|
+
response = self._make_request(
|
|
126
|
+
"POST",
|
|
127
|
+
"/api/publish_interaction",
|
|
128
|
+
data=request.model_dump_json(),
|
|
86
129
|
)
|
|
87
|
-
response = self._make_request("POST", "/api/interactions", json=request.model_dump())
|
|
88
130
|
return PublishUserInteractionResponse(**response)
|
|
89
131
|
|
|
90
132
|
def search_interactions(
|
|
91
133
|
self,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
query: Optional[str] = None,
|
|
95
|
-
start_time: Optional[datetime] = None,
|
|
96
|
-
end_time: Optional[datetime] = None,
|
|
97
|
-
most_recent_k: Optional[int] = None
|
|
98
|
-
) -> List[Interaction]:
|
|
134
|
+
request: Union[SearchInteractionRequest, dict],
|
|
135
|
+
) -> SearchInteractionResponse:
|
|
99
136
|
"""Search for user interactions.
|
|
100
137
|
|
|
101
138
|
Args:
|
|
102
|
-
|
|
103
|
-
request_id (Optional[str], optional): Filter by request ID
|
|
104
|
-
query (Optional[str], optional): Search query
|
|
105
|
-
start_time (Optional[datetime], optional): Start time filter
|
|
106
|
-
end_time (Optional[datetime], optional): End time filter
|
|
107
|
-
most_recent_k (Optional[int], optional): Limit to most recent K results
|
|
139
|
+
request (SearchInteractionRequest): The search request
|
|
108
140
|
|
|
109
141
|
Returns:
|
|
110
|
-
|
|
142
|
+
SearchInteractionResponse: Response containing matching interactions
|
|
111
143
|
"""
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
# Remove None values
|
|
121
|
-
params = {k: v for k, v in params.items() if v is not None}
|
|
122
|
-
response = self._make_request("GET", "/api/interactions/search", params=params)
|
|
123
|
-
return [Interaction(**interaction) for interaction in response.get("interactions", [])]
|
|
144
|
+
if isinstance(request, dict):
|
|
145
|
+
request = SearchInteractionRequest(**request)
|
|
146
|
+
response = self._make_request(
|
|
147
|
+
"POST",
|
|
148
|
+
"/api/search_interactions",
|
|
149
|
+
data=request.model_dump_json(),
|
|
150
|
+
)
|
|
151
|
+
return SearchInteractionResponse(**response)
|
|
124
152
|
|
|
125
153
|
def search_profiles(
|
|
126
154
|
self,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
query: Optional[str] = None,
|
|
130
|
-
start_time: Optional[datetime] = None,
|
|
131
|
-
end_time: Optional[datetime] = None,
|
|
132
|
-
top_k: Optional[int] = None
|
|
133
|
-
) -> List[UserProfile]:
|
|
155
|
+
request: Union[SearchUserProfileRequest, dict],
|
|
156
|
+
) -> SearchUserProfileResponse:
|
|
134
157
|
"""Search for user profiles.
|
|
135
158
|
|
|
136
159
|
Args:
|
|
137
|
-
|
|
138
|
-
genered_from_request_id (Optional[str], optional): Filter by request ID that generated the profile
|
|
139
|
-
query (Optional[str], optional): Search query
|
|
140
|
-
start_time (Optional[datetime], optional): Start time filter
|
|
141
|
-
end_time (Optional[datetime], optional): End time filter
|
|
142
|
-
top_k (Optional[int], optional): Limit to top K results
|
|
160
|
+
request (SearchUserProfileRequest): The search request
|
|
143
161
|
|
|
144
162
|
Returns:
|
|
145
|
-
|
|
163
|
+
SearchUserProfileResponse: Response containing matching profiles
|
|
146
164
|
"""
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
"
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
"top_k": top_k
|
|
154
|
-
}
|
|
155
|
-
# Remove None values
|
|
156
|
-
params = {k: v for k, v in params.items() if v is not None}
|
|
157
|
-
response = self._make_request("GET", "/api/profiles/search", params=params)
|
|
158
|
-
return [UserProfile(**profile) for profile in response.get("user_profiles", [])]
|
|
165
|
+
if isinstance(request, dict):
|
|
166
|
+
request = SearchUserProfileRequest(**request)
|
|
167
|
+
response = self._make_request(
|
|
168
|
+
"POST", "/api/search_profiles", data=request.model_dump_json()
|
|
169
|
+
)
|
|
170
|
+
return SearchUserProfileResponse(**response)
|
|
159
171
|
|
|
160
172
|
def delete_profile(
|
|
161
|
-
self,
|
|
162
|
-
user_id: str,
|
|
163
|
-
profile_id: str = "",
|
|
164
|
-
profile_search_query: str = ""
|
|
173
|
+
self, user_id: str, profile_id: str = "", search_query: str = ""
|
|
165
174
|
) -> DeleteUserProfileResponse:
|
|
166
175
|
"""Delete user profiles.
|
|
167
176
|
|
|
168
177
|
Args:
|
|
169
178
|
user_id (str): The user ID
|
|
170
179
|
profile_id (str, optional): Specific profile ID to delete
|
|
171
|
-
|
|
180
|
+
search_query (str, optional): Query to match profiles for deletion
|
|
172
181
|
|
|
173
182
|
Returns:
|
|
174
183
|
DeleteUserProfileResponse: Response containing success status and message
|
|
@@ -176,15 +185,15 @@ class AgenticMemClient:
|
|
|
176
185
|
request = DeleteUserProfileRequest(
|
|
177
186
|
user_id=user_id,
|
|
178
187
|
profile_id=profile_id,
|
|
179
|
-
|
|
188
|
+
search_query=search_query,
|
|
189
|
+
)
|
|
190
|
+
response = self._make_request(
|
|
191
|
+
"DELETE", "/api/delete_profile", data=request.model_dump_json()
|
|
180
192
|
)
|
|
181
|
-
response = self._make_request("DELETE", "/api/profiles", json=request.model_dump())
|
|
182
193
|
return DeleteUserProfileResponse(**response)
|
|
183
194
|
|
|
184
195
|
def delete_interaction(
|
|
185
|
-
self,
|
|
186
|
-
user_id: str,
|
|
187
|
-
interaction_id: str
|
|
196
|
+
self, user_id: str, interaction_id: str
|
|
188
197
|
) -> DeleteUserInteractionResponse:
|
|
189
198
|
"""Delete a user interaction.
|
|
190
199
|
|
|
@@ -196,8 +205,55 @@ class AgenticMemClient:
|
|
|
196
205
|
DeleteUserInteractionResponse: Response containing success status and message
|
|
197
206
|
"""
|
|
198
207
|
request = DeleteUserInteractionRequest(
|
|
199
|
-
user_id=user_id,
|
|
200
|
-
|
|
208
|
+
user_id=user_id, interaction_id=interaction_id
|
|
209
|
+
)
|
|
210
|
+
response = self._make_request(
|
|
211
|
+
"DELETE", "/api/delete_interaction", data=request.model_dump_json()
|
|
212
|
+
)
|
|
213
|
+
return DeleteUserInteractionResponse(**response)
|
|
214
|
+
|
|
215
|
+
def get_profile_change_log(self) -> ProfileChangeLogResponse:
|
|
216
|
+
response = self._make_request("GET", "/api/profile_change_log")
|
|
217
|
+
return ProfileChangeLogResponse(**response)
|
|
218
|
+
|
|
219
|
+
def get_interactions(
|
|
220
|
+
self,
|
|
221
|
+
request: Union[GetInteractionsRequest, dict],
|
|
222
|
+
) -> GetInteractionsResponse:
|
|
223
|
+
"""Get user interactions.
|
|
224
|
+
|
|
225
|
+
Args:
|
|
226
|
+
request (GetInteractionsRequest): The list request
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
GetInteractionsResponse: Response containing list of interactions
|
|
230
|
+
"""
|
|
231
|
+
if isinstance(request, dict):
|
|
232
|
+
request = GetInteractionsRequest(**request)
|
|
233
|
+
response = self._make_request(
|
|
234
|
+
"POST",
|
|
235
|
+
"/api/get_interactions",
|
|
236
|
+
data=request.model_dump_json(),
|
|
237
|
+
)
|
|
238
|
+
return GetInteractionsResponse(**response)
|
|
239
|
+
|
|
240
|
+
def get_profiles(
|
|
241
|
+
self,
|
|
242
|
+
request: Union[GetUserProfilesRequest, dict],
|
|
243
|
+
) -> GetUserProfilesResponse:
|
|
244
|
+
"""Get user profiles.
|
|
245
|
+
|
|
246
|
+
Args:
|
|
247
|
+
request (GetUserProfilesRequest): The list request
|
|
248
|
+
|
|
249
|
+
Returns:
|
|
250
|
+
GetUserProfilesResponse: Response containing list of profiles
|
|
251
|
+
"""
|
|
252
|
+
if isinstance(request, dict):
|
|
253
|
+
request = GetUserProfilesRequest(**request)
|
|
254
|
+
response = self._make_request(
|
|
255
|
+
"POST",
|
|
256
|
+
"/api/get_profiles",
|
|
257
|
+
data=request.model_dump_json(),
|
|
201
258
|
)
|
|
202
|
-
|
|
203
|
-
return DeleteUserInteractionResponse(**response)
|
|
259
|
+
return GetUserProfilesResponse(**response)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from enum import Enum
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CustomJSONEncoder(json.JSONEncoder):
|
|
7
|
+
def default(self, o):
|
|
8
|
+
if isinstance(o, datetime):
|
|
9
|
+
return o.isoformat()
|
|
10
|
+
if isinstance(o, Enum):
|
|
11
|
+
return o.value
|
|
12
|
+
return super().default(o)
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: agenticmem
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: A Python client for the AgenticMem API
|
|
5
|
+
License: MIT
|
|
6
|
+
Author: AgenticMem Team
|
|
7
|
+
Requires-Python: >=3.10,<4.0
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Requires-Dist: agenticmem-commons (==0.1.1)
|
|
13
|
+
Requires-Dist: griffe (==0.48.0)
|
|
14
|
+
Requires-Dist: mkdocstrings[python] (>=0.18.0)
|
|
15
|
+
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
|
|
16
|
+
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
|
|
17
|
+
Requires-Dist: requests (>=2.25.0,<3.0.0)
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# AgenticMem Python Client
|
|
21
|
+
|
|
22
|
+
A Python client library for interacting with the AgenticMem API. This client provides easy-to-use interfaces for managing user interactions and profiles.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install agenticmem
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from agenticmem import AgenticMemClient
|
|
34
|
+
from agenticmem_commons.api_schema.service_schemas import InteractionRequest
|
|
35
|
+
from agenticmem_commons.api_schema.retriever_schema import (
|
|
36
|
+
SearchInteractionRequest,
|
|
37
|
+
SearchUserProfileRequest,
|
|
38
|
+
GetInteractionsRequest,
|
|
39
|
+
GetUserProfilesRequest
|
|
40
|
+
)
|
|
41
|
+
from datetime import datetime
|
|
42
|
+
|
|
43
|
+
# Initialize the client
|
|
44
|
+
client = AgenticMemClient(api_key="your_api_key")
|
|
45
|
+
|
|
46
|
+
# Optional: Login with email/password
|
|
47
|
+
token = client.login(email="user@example.com", password="password123")
|
|
48
|
+
|
|
49
|
+
# Publish a user interaction
|
|
50
|
+
interaction = InteractionRequest(
|
|
51
|
+
timestamp=int(datetime.utcnow().timestamp()),
|
|
52
|
+
text_interaction="User clicked on product X",
|
|
53
|
+
user_action="click",
|
|
54
|
+
user_action_description="Clicked on product details button"
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
response = client.publish_interaction(
|
|
58
|
+
user_id="user123",
|
|
59
|
+
request_id="req456",
|
|
60
|
+
interaction_requests=[interaction]
|
|
61
|
+
)
|
|
62
|
+
print(f"Published interaction: {response.success} - {response.message}")
|
|
63
|
+
|
|
64
|
+
# Search user profiles
|
|
65
|
+
profiles_request = SearchUserProfileRequest(
|
|
66
|
+
user_id="user123",
|
|
67
|
+
search_query="recent interactions",
|
|
68
|
+
top_k=5
|
|
69
|
+
)
|
|
70
|
+
profiles = client.search_profiles(profiles_request)
|
|
71
|
+
for profile in profiles.profiles:
|
|
72
|
+
print(f"Profile {profile.profile_id}: {profile.profile_content}")
|
|
73
|
+
|
|
74
|
+
# Get user profiles directly
|
|
75
|
+
profiles_request = GetUserProfilesRequest(
|
|
76
|
+
user_id="user123"
|
|
77
|
+
)
|
|
78
|
+
profiles = client.get_profiles(profiles_request)
|
|
79
|
+
for profile in profiles.profiles:
|
|
80
|
+
print(f"Profile: {profile}")
|
|
81
|
+
|
|
82
|
+
# Search interactions
|
|
83
|
+
interactions_request = SearchInteractionRequest(
|
|
84
|
+
user_id="user123",
|
|
85
|
+
start_time=int(datetime(2024, 1, 1).timestamp()),
|
|
86
|
+
end_time=int(datetime.utcnow().timestamp())
|
|
87
|
+
)
|
|
88
|
+
interactions = client.search_interactions(interactions_request)
|
|
89
|
+
for interaction in interactions.interactions:
|
|
90
|
+
print(f"Interaction {interaction.interaction_id}: {interaction.text_interaction}")
|
|
91
|
+
|
|
92
|
+
# Get interactions directly
|
|
93
|
+
interactions_request = GetInteractionsRequest(
|
|
94
|
+
user_id="user123"
|
|
95
|
+
)
|
|
96
|
+
interactions = client.get_interactions(interactions_request)
|
|
97
|
+
for interaction in interactions.interactions:
|
|
98
|
+
print(f"Interaction: {interaction}")
|
|
99
|
+
|
|
100
|
+
# Get profile change log
|
|
101
|
+
change_log = client.get_profile_change_log()
|
|
102
|
+
print(f"Profile changes: {change_log}")
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Features
|
|
106
|
+
|
|
107
|
+
- Authentication
|
|
108
|
+
- API key authentication
|
|
109
|
+
- Email/password login
|
|
110
|
+
- User interaction management
|
|
111
|
+
- Publish user interactions
|
|
112
|
+
- Delete specific interactions
|
|
113
|
+
- Search interactions with time range and filters
|
|
114
|
+
- Get direct list of interactions
|
|
115
|
+
- User profile management
|
|
116
|
+
- Search user profiles with customizable queries
|
|
117
|
+
- Get direct list of user profiles
|
|
118
|
+
- Delete specific profiles or profiles matching a search query
|
|
119
|
+
- View profile change log history
|
|
120
|
+
|
|
121
|
+
## API Response Types
|
|
122
|
+
|
|
123
|
+
All API methods return strongly-typed responses:
|
|
124
|
+
|
|
125
|
+
- `login()` returns `Token`
|
|
126
|
+
- `publish_interaction()` returns `PublishUserInteractionResponse`
|
|
127
|
+
- `search_interactions()` returns `SearchInteractionResponse`
|
|
128
|
+
- `get_interactions()` returns `GetInteractionsResponse`
|
|
129
|
+
- `search_profiles()` returns `SearchUserProfileResponse`
|
|
130
|
+
- `get_profiles()` returns `GetUserProfilesResponse`
|
|
131
|
+
- `delete_profile()` returns `DeleteUserProfileResponse`
|
|
132
|
+
- `delete_interaction()` returns `DeleteUserInteractionResponse`
|
|
133
|
+
- `get_profile_change_log()` returns `ProfileChangeLogResponse`
|
|
134
|
+
|
|
135
|
+
## Documentation
|
|
136
|
+
|
|
137
|
+
For detailed documentation, please visit [docs link].
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
MIT License
|
|
142
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
agenticmem/__init__.py,sha256=zjj8VIn65S5NzJZV64IUG8G1p0J-9SYBJJMSof8mDU8,1229
|
|
2
|
+
agenticmem/client.py,sha256=_ZRjGFsxHnFdrCoQJEu8ofioxZYvI1vSlRCsMK8-Z5g,8480
|
|
3
|
+
agenticmem/client_utils.py,sha256=kWTWlyO7s768v38ef41nRDq87Qmb60NX2vmZTVlCB6g,297
|
|
4
|
+
agenticmem-0.1.1.dist-info/METADATA,sha256=ccLBT23K7aLygLLscXgSJxu2VY7FzCgFijAW1V0CdAI,4332
|
|
5
|
+
agenticmem-0.1.1.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
6
|
+
agenticmem-0.1.1.dist-info/RECORD,,
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: agenticmem
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: A Python client for the AgenticMem API
|
|
5
|
-
License: MIT
|
|
6
|
-
Author: AgenticMem Team
|
|
7
|
-
Requires-Python: >=3.7,<4.0
|
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
|
|
16
|
-
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
|
|
17
|
-
Requires-Dist: requests (>=2.25.0,<3.0.0)
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
|
|
20
|
-
# AgenticMem Python Client
|
|
21
|
-
|
|
22
|
-
A Python client library for interacting with the AgenticMem API. This client provides easy-to-use interfaces for managing user interactions and profiles.
|
|
23
|
-
|
|
24
|
-
## Installation
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
pip install agenticmem
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Quick Start
|
|
31
|
-
|
|
32
|
-
```python
|
|
33
|
-
from agenticmem import AgenticMemClient
|
|
34
|
-
from agenticmem import UserActionType, InteractionRequest
|
|
35
|
-
from datetime import datetime
|
|
36
|
-
|
|
37
|
-
# Initialize the client
|
|
38
|
-
client = AgenticMemClient(
|
|
39
|
-
api_key="your_api_key",
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
# Publish a user interaction
|
|
43
|
-
interaction = InteractionRequest(
|
|
44
|
-
timestamp=datetime.now(),
|
|
45
|
-
text_interaction="User clicked on product X",
|
|
46
|
-
user_action=UserActionType.CLICK,
|
|
47
|
-
user_action_description="Clicked on product details button"
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
response = client.publish_interaction(
|
|
51
|
-
user_id="user123",
|
|
52
|
-
request_id="req456",
|
|
53
|
-
interaction_requests=[interaction]
|
|
54
|
-
)
|
|
55
|
-
print(f"Published interaction: {response.success} - {response.message}")
|
|
56
|
-
|
|
57
|
-
# Search user profiles
|
|
58
|
-
profiles = client.search_profiles(
|
|
59
|
-
user_id="user123",
|
|
60
|
-
query="recent interactions",
|
|
61
|
-
top_k=5
|
|
62
|
-
)
|
|
63
|
-
for profile in profiles:
|
|
64
|
-
print(f"Profile {profile.profile_id}: {profile.profile_content}")
|
|
65
|
-
|
|
66
|
-
# Search interactions
|
|
67
|
-
interactions = client.search_interactions(
|
|
68
|
-
user_id="user123",
|
|
69
|
-
start_time=datetime(2024, 1, 1),
|
|
70
|
-
end_time=datetime.now()
|
|
71
|
-
)
|
|
72
|
-
for interaction in interactions:
|
|
73
|
-
print(f"Interaction {interaction.interaction_id}: {interaction.text_interaction}")
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Features
|
|
77
|
-
|
|
78
|
-
- User interaction management
|
|
79
|
-
- Publish user interactions
|
|
80
|
-
- Delete user interactions
|
|
81
|
-
- Search interactions
|
|
82
|
-
- User profile management
|
|
83
|
-
- Search user profiles
|
|
84
|
-
- Delete user profiles
|
|
85
|
-
|
|
86
|
-
## API Response Types
|
|
87
|
-
|
|
88
|
-
All API methods return strongly-typed responses:
|
|
89
|
-
|
|
90
|
-
- `publish_interaction()` returns `PublishUserInteractionResponse`
|
|
91
|
-
- `search_interactions()` returns `List[Interaction]`
|
|
92
|
-
- `search_profiles()` returns `List[UserProfile]`
|
|
93
|
-
- `delete_profile()` returns `DeleteUserProfileResponse`
|
|
94
|
-
- `delete_interaction()` returns `DeleteUserInteractionResponse`
|
|
95
|
-
|
|
96
|
-
## Documentation
|
|
97
|
-
|
|
98
|
-
For detailed documentation, please visit [docs link].
|
|
99
|
-
|
|
100
|
-
## License
|
|
101
|
-
|
|
102
|
-
MIT License
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
agenticmem/__init__.py,sha256=KkimFBXT7q5h1O2Slp4ypugkdbtBvdxX8BM_XRRUW6Q,762
|
|
2
|
-
agenticmem/client.py,sha256=e702FttQmZoKcl_l6emEhVL1uOWzqs715fhNEbme-yA,7121
|
|
3
|
-
agenticmem-0.1.0.dist-info/METADATA,sha256=nhLpyJt2w672ybU3oFRrpj9WJBwNW2219lI1Fqa1FJ8,2785
|
|
4
|
-
agenticmem-0.1.0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
5
|
-
agenticmem-0.1.0.dist-info/RECORD,,
|
|
File without changes
|