Skip to content

Commit d589286

Browse files
feat(core): add conversation archive fields and filtering
1 parent c4a27c7 commit d589286

6 files changed

Lines changed: 39 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 126
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/letta-ai%2Fletta-sdk-c9d5c27d12c9054a602aa3e7fee4c292582dce393231776e010a76c54b2d5600.yml
3-
openapi_spec_hash: 8b150cdf0e4de6c89848f24f6d15e6c3
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/letta-ai%2Fletta-sdk-2fcabe48fcd0f7ea8bb7af9870483b1369331f0fc345e085d607ff3cbd31b44b.yml
3+
openapi_spec_hash: af474c9c636bde8224321911d2272d09
44
config_hash: f2ff70633d052a11601ad82a5afcfaec

src/letta_client/resources/conversations/conversations.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def update(
167167
self,
168168
conversation_id: str,
169169
*,
170+
archived: Optional[bool] | Omit = omit,
170171
last_message_at: Union[str, datetime, None] | Omit = omit,
171172
model: Optional[str] | Omit = omit,
172173
model_settings: Optional[conversation_update_params.ModelSettings] | Omit = omit,
@@ -184,6 +185,8 @@ def update(
184185
Args:
185186
conversation_id: The ID of the conv in the format 'conv-<uuid4>'
186187
188+
archived: Whether the conversation is archived.
189+
187190
last_message_at: Timestamp of the most recent message request sent to this conversation.
188191
189192
model:
@@ -208,6 +211,7 @@ def update(
208211
path_template("/v1/conversations/{conversation_id}", conversation_id=conversation_id),
209212
body=maybe_transform(
210213
{
214+
"archived": archived,
211215
"last_message_at": last_message_at,
212216
"model": model,
213217
"model_settings": model_settings,
@@ -226,6 +230,7 @@ def list(
226230
*,
227231
after: Optional[str] | Omit = omit,
228232
agent_id: Optional[str] | Omit = omit,
233+
archive_status: Literal["unarchived", "archived", "all"] | Omit = omit,
229234
limit: int | Omit = omit,
230235
order: Literal["asc", "desc"] | Omit = omit,
231236
order_by: Literal["created_at", "last_run_completion", "last_message_at"] | Omit = omit,
@@ -247,6 +252,9 @@ def list(
247252
agent_id: The agent ID to list conversations for (optional - returns all conversations if
248253
not provided)
249254
255+
archive_status: Whether to return unarchived conversations only, archived conversations only, or
256+
all conversations
257+
250258
limit: Maximum number of conversations to return
251259
252260
order: Sort order for conversations. 'asc' for oldest first, 'desc' for newest first
@@ -274,6 +282,7 @@ def list(
274282
{
275283
"after": after,
276284
"agent_id": agent_id,
285+
"archive_status": archive_status,
277286
"limit": limit,
278287
"order": order,
279288
"order_by": order_by,
@@ -621,6 +630,7 @@ async def update(
621630
self,
622631
conversation_id: str,
623632
*,
633+
archived: Optional[bool] | Omit = omit,
624634
last_message_at: Union[str, datetime, None] | Omit = omit,
625635
model: Optional[str] | Omit = omit,
626636
model_settings: Optional[conversation_update_params.ModelSettings] | Omit = omit,
@@ -638,6 +648,8 @@ async def update(
638648
Args:
639649
conversation_id: The ID of the conv in the format 'conv-<uuid4>'
640650
651+
archived: Whether the conversation is archived.
652+
641653
last_message_at: Timestamp of the most recent message request sent to this conversation.
642654
643655
model:
@@ -662,6 +674,7 @@ async def update(
662674
path_template("/v1/conversations/{conversation_id}", conversation_id=conversation_id),
663675
body=await async_maybe_transform(
664676
{
677+
"archived": archived,
665678
"last_message_at": last_message_at,
666679
"model": model,
667680
"model_settings": model_settings,
@@ -680,6 +693,7 @@ async def list(
680693
*,
681694
after: Optional[str] | Omit = omit,
682695
agent_id: Optional[str] | Omit = omit,
696+
archive_status: Literal["unarchived", "archived", "all"] | Omit = omit,
683697
limit: int | Omit = omit,
684698
order: Literal["asc", "desc"] | Omit = omit,
685699
order_by: Literal["created_at", "last_run_completion", "last_message_at"] | Omit = omit,
@@ -701,6 +715,9 @@ async def list(
701715
agent_id: The agent ID to list conversations for (optional - returns all conversations if
702716
not provided)
703717
718+
archive_status: Whether to return unarchived conversations only, archived conversations only, or
719+
all conversations
720+
704721
limit: Maximum number of conversations to return
705722
706723
order: Sort order for conversations. 'asc' for oldest first, 'desc' for newest first
@@ -728,6 +745,7 @@ async def list(
728745
{
729746
"after": after,
730747
"agent_id": agent_id,
748+
"archive_status": archive_status,
731749
"limit": limit,
732750
"order": order,
733751
"order_by": order_by,

src/letta_client/types/conversation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ class Conversation(BaseModel):
222222
agent_id: str
223223
"""The ID of the agent this conversation belongs to."""
224224

225+
archived: Optional[bool] = None
226+
"""Whether the conversation is archived."""
227+
228+
archived_at: Optional[datetime] = None
229+
"""Timestamp of when the conversation was archived."""
230+
225231
created_at: Optional[datetime] = None
226232
"""The timestamp when the object was created."""
227233

src/letta_client/types/conversation_list_params.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ class ConversationListParams(TypedDict, total=False):
1818
not provided)
1919
"""
2020

21+
archive_status: Literal["unarchived", "archived", "all"]
22+
"""
23+
Whether to return unarchived conversations only, archived conversations only, or
24+
all conversations
25+
"""
26+
2127
limit: int
2228
"""Maximum number of conversations to return"""
2329

src/letta_client/types/conversation_update_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939

4040

4141
class ConversationUpdateParams(TypedDict, total=False):
42+
archived: Optional[bool]
43+
"""Whether the conversation is archived."""
44+
4245
last_message_at: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
4346
"""Timestamp of the most recent message request sent to this conversation."""
4447

tests/api_resources/test_conversations.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def test_method_update(self, client: Letta) -> None:
131131
def test_method_update_with_all_params(self, client: Letta) -> None:
132132
conversation = client.conversations.update(
133133
conversation_id="conv-123e4567-e89b-42d3-8456-426614174000",
134+
archived=True,
134135
last_message_at=parse_datetime("2019-12-27T18:11:19.117Z"),
135136
model="model",
136137
model_settings={
@@ -192,6 +193,7 @@ def test_method_list_with_all_params(self, client: Letta) -> None:
192193
conversation = client.conversations.list(
193194
after="after",
194195
agent_id="agent_id",
196+
archive_status="unarchived",
195197
limit=0,
196198
order="asc",
197199
order_by="created_at",
@@ -549,6 +551,7 @@ async def test_method_update(self, async_client: AsyncLetta) -> None:
549551
async def test_method_update_with_all_params(self, async_client: AsyncLetta) -> None:
550552
conversation = await async_client.conversations.update(
551553
conversation_id="conv-123e4567-e89b-42d3-8456-426614174000",
554+
archived=True,
552555
last_message_at=parse_datetime("2019-12-27T18:11:19.117Z"),
553556
model="model",
554557
model_settings={
@@ -610,6 +613,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncLetta) -> No
610613
conversation = await async_client.conversations.list(
611614
after="after",
612615
agent_id="agent_id",
616+
archive_status="unarchived",
613617
limit=0,
614618
order="asc",
615619
order_by="created_at",

0 commit comments

Comments
 (0)