recallrai 0.3.1__py3-none-any.whl → 0.3.2__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 recallrai might be problematic. Click here for more details.
- recallrai/__init__.py +1 -1
- recallrai/models/session.py +1 -0
- recallrai/session.py +4 -1
- recallrai/user.py +5 -0
- recallrai/utils/http_client.py +7 -4
- {recallrai-0.3.1.dist-info → recallrai-0.3.2.dist-info}/METADATA +7 -4
- {recallrai-0.3.1.dist-info → recallrai-0.3.2.dist-info}/RECORD +8 -8
- {recallrai-0.3.1.dist-info → recallrai-0.3.2.dist-info}/WHEEL +0 -0
recallrai/__init__.py
CHANGED
recallrai/models/session.py
CHANGED
recallrai/session.py
CHANGED
|
@@ -103,7 +103,8 @@ class Session:
|
|
|
103
103
|
summaries_threshold: float = 0.5,
|
|
104
104
|
last_n_messages: Optional[int] = None,
|
|
105
105
|
last_n_summaries: Optional[int] = None,
|
|
106
|
-
timezone: Optional[str] = None
|
|
106
|
+
timezone: Optional[str] = None,
|
|
107
|
+
include_system_prompt: bool = True
|
|
107
108
|
) -> Context:
|
|
108
109
|
"""
|
|
109
110
|
Get the current context for this session.
|
|
@@ -117,6 +118,7 @@ class Session:
|
|
|
117
118
|
last_n_messages: Number of last messages to include in context.
|
|
118
119
|
last_n_summaries: Number of last summaries to include in context.
|
|
119
120
|
timezone: Timezone for formatting timestamps (e.g., 'America/New_York'). None for UTC.
|
|
121
|
+
include_system_prompt: Whether to include the default system prompt of Recallr AI. Defaults to True.
|
|
120
122
|
|
|
121
123
|
Returns:
|
|
122
124
|
Context information with the memory text and whether memory was used.
|
|
@@ -136,6 +138,7 @@ class Session:
|
|
|
136
138
|
"max_top_k": max_top_k,
|
|
137
139
|
"memories_threshold": memories_threshold,
|
|
138
140
|
"summaries_threshold": summaries_threshold,
|
|
141
|
+
"include_system_prompt": include_system_prompt,
|
|
139
142
|
}
|
|
140
143
|
if last_n_messages is not None:
|
|
141
144
|
params["last_n_messages"] = last_n_messages
|
recallrai/user.py
CHANGED
|
@@ -8,6 +8,7 @@ from .utils import HTTPClient
|
|
|
8
8
|
from .models import (
|
|
9
9
|
UserModel,
|
|
10
10
|
SessionModel,
|
|
11
|
+
SessionStatus,
|
|
11
12
|
SessionList,
|
|
12
13
|
UserMemoriesList,
|
|
13
14
|
UserMessagesList,
|
|
@@ -244,6 +245,7 @@ class User:
|
|
|
244
245
|
limit: int = 10,
|
|
245
246
|
metadata_filter: Optional[Dict[str, Any]] = None,
|
|
246
247
|
user_metadata_filter: Optional[Dict[str, Any]] = None,
|
|
248
|
+
status_filter: Optional[List[SessionStatus]] = None,
|
|
247
249
|
) -> SessionList:
|
|
248
250
|
"""
|
|
249
251
|
List sessions for this user with pagination.
|
|
@@ -253,6 +255,7 @@ class User:
|
|
|
253
255
|
limit: Maximum number of records to return.
|
|
254
256
|
metadata_filter: Optional metadata filter for sessions.
|
|
255
257
|
user_metadata_filter: Optional metadata filter for the user.
|
|
258
|
+
status_filter: Optional list of session statuses to filter by (e.g., ["pending", "processing", "processed", "insufficient_balance"]).
|
|
256
259
|
|
|
257
260
|
Returns:
|
|
258
261
|
List of sessions with pagination info.
|
|
@@ -270,6 +273,8 @@ class User:
|
|
|
270
273
|
params["metadata_filter"] = json.dumps(metadata_filter)
|
|
271
274
|
if user_metadata_filter is not None:
|
|
272
275
|
params["user_metadata_filter"] = json.dumps(user_metadata_filter)
|
|
276
|
+
if status_filter is not None:
|
|
277
|
+
params["status_filter"] = [status.value for status in status_filter]
|
|
273
278
|
|
|
274
279
|
response = self._http.get(
|
|
275
280
|
f"/api/v1/users/{self.user_id}/sessions",
|
recallrai/utils/http_client.py
CHANGED
|
@@ -44,7 +44,7 @@ class HTTPClient:
|
|
|
44
44
|
"X-Recallr-Project-Id": self.project_id,
|
|
45
45
|
"Content-Type": "application/json",
|
|
46
46
|
"Accept": "application/json",
|
|
47
|
-
"User-Agent": f"RecallrAI-Python-SDK/0.3.
|
|
47
|
+
"User-Agent": f"RecallrAI-Python-SDK/0.3.2",
|
|
48
48
|
},
|
|
49
49
|
)
|
|
50
50
|
|
|
@@ -84,10 +84,10 @@ class HTTPClient:
|
|
|
84
84
|
json=data,
|
|
85
85
|
)
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
if response.status_code == 204:
|
|
88
|
+
return response # No content to parse
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
elif response.status_code == 422:
|
|
91
91
|
detail = response.json().get("detail", "Validation error")
|
|
92
92
|
raise ValidationError(
|
|
93
93
|
message=detail,
|
|
@@ -106,6 +106,9 @@ class HTTPClient:
|
|
|
106
106
|
http_status=response.status_code
|
|
107
107
|
)
|
|
108
108
|
|
|
109
|
+
# Try to parse to JSON to catch JSON errors early
|
|
110
|
+
_ = response.json()
|
|
111
|
+
|
|
109
112
|
return response
|
|
110
113
|
except TimeoutException as e:
|
|
111
114
|
raise TimeoutError(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: recallrai
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Official Python SDK for RecallrAI - Revolutionary contextual memory system that enables AI assistants to form meaningful connections between conversations, just like human memory.
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: ai,memory,context,llm,mem0,getzep,zep
|
|
@@ -226,18 +226,20 @@ except SessionNotFoundError as e:
|
|
|
226
226
|
### List Sessions
|
|
227
227
|
|
|
228
228
|
```python
|
|
229
|
+
from recallrai.models import SessionStatus
|
|
229
230
|
from recallrai.exceptions import UserNotFoundError
|
|
230
231
|
|
|
231
232
|
try:
|
|
232
233
|
# First, get the user
|
|
233
234
|
user = client.get_user("user123")
|
|
234
235
|
|
|
235
|
-
# List sessions for this user with optional
|
|
236
|
+
# List sessions for this user with optional filters
|
|
236
237
|
session_list = user.list_sessions(
|
|
237
238
|
offset=0,
|
|
238
239
|
limit=10,
|
|
239
|
-
metadata_filter={"type": "chat"}, # optional
|
|
240
|
-
user_metadata_filter={"role": "admin"}
|
|
240
|
+
metadata_filter={"type": "chat"}, # optional: filter by session metadata
|
|
241
|
+
user_metadata_filter={"role": "admin"}, # optional: filter by user metadata
|
|
242
|
+
status_filter=[SessionStatus.PENDING, SessionStatus.PROCESSING] # optional: filter by session status
|
|
241
243
|
)
|
|
242
244
|
print(f"Total sessions: {session_list.total}")
|
|
243
245
|
print(f"Has more sessions: {session_list.has_more}")
|
|
@@ -312,6 +314,7 @@ try:
|
|
|
312
314
|
# - last_n_messages: Number of last messages to include in context (optional, range: 1-100)
|
|
313
315
|
# - last_n_summaries: Number of last summaries to include in context (optional, range: 1-20)
|
|
314
316
|
# - timezone: Timezone for formatting timestamps (optional, e.g., 'America/New_York', None for UTC)
|
|
317
|
+
# - include_system_prompt: Whether to include the default system prompt of Recallr AI (default: True)
|
|
315
318
|
except UserNotFoundError as e:
|
|
316
319
|
print(f"Error: {e}")
|
|
317
320
|
except SessionNotFoundError as e:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
recallrai/__init__.py,sha256=
|
|
1
|
+
recallrai/__init__.py,sha256=abFAtjWyJSZf16Z93jfgJcCSctbAEHE8i6PKjhrafe8,273
|
|
2
2
|
recallrai/client.py,sha256=VNQ-AgmgQIdV5pOfvU7KptYC34jA_tGW1Kt3XnJoa-M,5230
|
|
3
3
|
recallrai/exceptions/__init__.py,sha256=d1LiuofGiGOP8rmzpvUKinKaa_o1cn2JThGr__Hwysw,1209
|
|
4
4
|
recallrai/exceptions/auth.py,sha256=mnxps1GLljuERxzqBZXg_LZqOYUbTM47GLaW9noiP3w,554
|
|
@@ -12,12 +12,12 @@ recallrai/exceptions/validation.py,sha256=O54apJf4pUsKXbo3A7I2nXV4J-BEk4txrAUNw8
|
|
|
12
12
|
recallrai/merge_conflict.py,sha256=cEi2-0rOTKQXu61tt1p2LVItyA7l05TyvRw_mfCNIhI,7682
|
|
13
13
|
recallrai/models/__init__.py,sha256=7M9q2BUDVyzCP7UNFmwo5Jzfni8fXibVPUCpiyQwG2w,1010
|
|
14
14
|
recallrai/models/merge_conflict.py,sha256=H0yG-Tja01-vmBrI7mNXrARrgQVxF-LEE1YsB9voXJY,5337
|
|
15
|
-
recallrai/models/session.py,sha256=
|
|
15
|
+
recallrai/models/session.py,sha256=bYh_4wipHENG8QXgkNHXd4XZHnN3EjCXoxFu15BDXZE,4832
|
|
16
16
|
recallrai/models/user.py,sha256=8amkmBFAV0w2dkFBdp8Zx8nbuzQX3CkhEdpNIDBrqIY,6289
|
|
17
|
-
recallrai/session.py,sha256=
|
|
18
|
-
recallrai/user.py,sha256=
|
|
17
|
+
recallrai/session.py,sha256=FqSS9DhuuwDi_XMKFWvQdhXPV2DFtIZZ4Ws2f5gOljY,13639
|
|
18
|
+
recallrai/user.py,sha256=IWLO_QvE9sy3iWeuZ2zOdVX_n0_JojV71rmZjcUmiPE,19405
|
|
19
19
|
recallrai/utils/__init__.py,sha256=NWqn-HBC3Ahv_0E00-aHGDrTPN0RN1cXrvIxwvQLtZQ,108
|
|
20
|
-
recallrai/utils/http_client.py,sha256=
|
|
21
|
-
recallrai-0.3.
|
|
22
|
-
recallrai-0.3.
|
|
23
|
-
recallrai-0.3.
|
|
20
|
+
recallrai/utils/http_client.py,sha256=_kK21uDTXzUcKSQMv1oAo12LGlo_ibLMaevnoi_o0sk,4588
|
|
21
|
+
recallrai-0.3.2.dist-info/METADATA,sha256=6EUvhre9lS3d_Vm_mWdx8B3LMCtC-A5mBWlMYc5Z0HU,30567
|
|
22
|
+
recallrai-0.3.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
23
|
+
recallrai-0.3.2.dist-info/RECORD,,
|
|
File without changes
|