letta-client 0.1.4__py3-none-any.whl → 0.1.6__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 letta-client might be problematic. Click here for more details.
- letta/__init__.py +34 -12
- letta/agents/__init__.py +49 -13
- letta/agents/client.py +40 -0
- letta/agents/messages/__init__.py +36 -2
- letta/agents/messages/client.py +46 -0
- letta/agents/messages/types/__init__.py +37 -3
- letta/agents/messages/types/letta_streaming_response.py +132 -14
- letta/agents/messages/types/messages_list_response_item.py +114 -7
- letta/agents/types/__init__.py +26 -18
- letta/agents/types/agents_search_deployed_agents_request_search_item.py +59 -8
- letta/agents/types/{agents_search_deployed_agents_request_search_item_operator.py → agents_search_deployed_agents_request_search_item_name.py} +5 -6
- letta/agents/types/{agents_search_deployed_agents_request_search_item_operator_operator.py → agents_search_deployed_agents_request_search_item_name_operator.py} +1 -1
- letta/agents/types/agents_search_deployed_agents_request_search_item_order_by.py +26 -0
- letta/agents/types/agents_search_deployed_agents_request_search_item_order_by_direction.py +5 -0
- letta/agents/types/{agents_search_deployed_agents_request_search_item_direction_value.py → agents_search_deployed_agents_request_search_item_order_by_value.py} +1 -1
- letta/agents/types/{agents_search_deployed_agents_request_search_item_zero.py → agents_search_deployed_agents_request_search_item_version.py} +2 -3
- letta/client.py +4 -4
- letta/core/client_wrapper.py +7 -18
- letta/types/__init__.py +18 -0
- letta/types/agent_environment_variable.py +68 -0
- letta/types/agent_state.py +15 -9
- letta/types/assistant_message_output.py +1 -2
- letta/types/block.py +9 -9
- letta/types/context_window_overview.py +5 -0
- letta/types/embedding_config.py +8 -8
- letta/types/job.py +5 -5
- letta/types/letta_response.py +4 -3
- letta/types/letta_response_messages_item.py +120 -0
- letta/types/letta_schemas_message_message.py +10 -10
- letta/types/letta_schemas_tool_tool.py +5 -5
- letta/types/letta_usage_statistics.py +4 -5
- letta/types/llm_config.py +7 -7
- letta/types/passage.py +8 -8
- letta/types/reasoning_message.py +4 -5
- letta/types/sandbox_environment_variable.py +4 -4
- letta/types/sandbox_environment_variable_update.py +0 -4
- letta/types/source.py +6 -6
- letta/types/system_message_output.py +4 -5
- letta/types/tool_call_message.py +4 -5
- letta/types/tool_return_message.py +8 -9
- letta/types/user.py +3 -3
- letta/types/user_message_output.py +4 -5
- {letta_client-0.1.4.dist-info → letta_client-0.1.6.dist-info}/METADATA +1 -1
- {letta_client-0.1.4.dist-info → letta_client-0.1.6.dist-info}/RECORD +45 -43
- letta/agents/types/agents_search_deployed_agents_request_search_item_direction.py +0 -27
- letta/agents/types/agents_search_deployed_agents_request_search_item_direction_direction.py +0 -5
- {letta_client-0.1.4.dist-info → letta_client-0.1.6.dist-info}/WHEEL +0 -0
letta/__init__.py
CHANGED
|
@@ -4,6 +4,7 @@ from .types import (
|
|
|
4
4
|
ActionModel,
|
|
5
5
|
ActionParametersModel,
|
|
6
6
|
ActionResponseModel,
|
|
7
|
+
AgentEnvironmentVariable,
|
|
7
8
|
AgentState,
|
|
8
9
|
AgentStateToolRulesItem,
|
|
9
10
|
AgentType,
|
|
@@ -50,6 +51,13 @@ from .types import (
|
|
|
50
51
|
JobStatus,
|
|
51
52
|
LettaRequest,
|
|
52
53
|
LettaResponse,
|
|
54
|
+
LettaResponseMessagesItem,
|
|
55
|
+
LettaResponseMessagesItem_AssistantMessage,
|
|
56
|
+
LettaResponseMessagesItem_ReasoningMessage,
|
|
57
|
+
LettaResponseMessagesItem_SystemMessage,
|
|
58
|
+
LettaResponseMessagesItem_ToolCallMessage,
|
|
59
|
+
LettaResponseMessagesItem_ToolReturnMessage,
|
|
60
|
+
LettaResponseMessagesItem_UserMessage,
|
|
53
61
|
LettaSchemasLettaMessageToolCall,
|
|
54
62
|
LettaSchemasMessageMessage,
|
|
55
63
|
LettaSchemasOpenaiChatCompletionRequestTool,
|
|
@@ -121,12 +129,15 @@ from .agents import (
|
|
|
121
129
|
AgentsMigrateResponse,
|
|
122
130
|
AgentsSearchDeployedAgentsRequestCombinator,
|
|
123
131
|
AgentsSearchDeployedAgentsRequestSearchItem,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
AgentsSearchDeployedAgentsRequestSearchItemName,
|
|
133
|
+
AgentsSearchDeployedAgentsRequestSearchItemNameOperator,
|
|
134
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderBy,
|
|
135
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection,
|
|
136
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderByValue,
|
|
137
|
+
AgentsSearchDeployedAgentsRequestSearchItemVersion,
|
|
138
|
+
AgentsSearchDeployedAgentsRequestSearchItem_Name,
|
|
139
|
+
AgentsSearchDeployedAgentsRequestSearchItem_OrderBy,
|
|
140
|
+
AgentsSearchDeployedAgentsRequestSearchItem_Version,
|
|
130
141
|
CreateAgentRequestToolRulesItem,
|
|
131
142
|
UpdateAgentToolRulesItem,
|
|
132
143
|
)
|
|
@@ -138,6 +149,7 @@ __all__ = [
|
|
|
138
149
|
"ActionModel",
|
|
139
150
|
"ActionParametersModel",
|
|
140
151
|
"ActionResponseModel",
|
|
152
|
+
"AgentEnvironmentVariable",
|
|
141
153
|
"AgentState",
|
|
142
154
|
"AgentStateToolRulesItem",
|
|
143
155
|
"AgentType",
|
|
@@ -145,12 +157,15 @@ __all__ = [
|
|
|
145
157
|
"AgentsMigrateResponse",
|
|
146
158
|
"AgentsSearchDeployedAgentsRequestCombinator",
|
|
147
159
|
"AgentsSearchDeployedAgentsRequestSearchItem",
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
160
|
+
"AgentsSearchDeployedAgentsRequestSearchItemName",
|
|
161
|
+
"AgentsSearchDeployedAgentsRequestSearchItemNameOperator",
|
|
162
|
+
"AgentsSearchDeployedAgentsRequestSearchItemOrderBy",
|
|
163
|
+
"AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection",
|
|
164
|
+
"AgentsSearchDeployedAgentsRequestSearchItemOrderByValue",
|
|
165
|
+
"AgentsSearchDeployedAgentsRequestSearchItemVersion",
|
|
166
|
+
"AgentsSearchDeployedAgentsRequestSearchItem_Name",
|
|
167
|
+
"AgentsSearchDeployedAgentsRequestSearchItem_OrderBy",
|
|
168
|
+
"AgentsSearchDeployedAgentsRequestSearchItem_Version",
|
|
154
169
|
"AppAuthScheme",
|
|
155
170
|
"AppAuthSchemeAuthMode",
|
|
156
171
|
"AppModel",
|
|
@@ -200,6 +215,13 @@ __all__ = [
|
|
|
200
215
|
"LettaEnvironment",
|
|
201
216
|
"LettaRequest",
|
|
202
217
|
"LettaResponse",
|
|
218
|
+
"LettaResponseMessagesItem",
|
|
219
|
+
"LettaResponseMessagesItem_AssistantMessage",
|
|
220
|
+
"LettaResponseMessagesItem_ReasoningMessage",
|
|
221
|
+
"LettaResponseMessagesItem_SystemMessage",
|
|
222
|
+
"LettaResponseMessagesItem_ToolCallMessage",
|
|
223
|
+
"LettaResponseMessagesItem_ToolReturnMessage",
|
|
224
|
+
"LettaResponseMessagesItem_UserMessage",
|
|
203
225
|
"LettaSchemasLettaMessageToolCall",
|
|
204
226
|
"LettaSchemasMessageMessage",
|
|
205
227
|
"LettaSchemasOpenaiChatCompletionRequestTool",
|
letta/agents/__init__.py
CHANGED
|
@@ -5,33 +5,69 @@ from .types import (
|
|
|
5
5
|
AgentsMigrateResponse,
|
|
6
6
|
AgentsSearchDeployedAgentsRequestCombinator,
|
|
7
7
|
AgentsSearchDeployedAgentsRequestSearchItem,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
AgentsSearchDeployedAgentsRequestSearchItemName,
|
|
9
|
+
AgentsSearchDeployedAgentsRequestSearchItemNameOperator,
|
|
10
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderBy,
|
|
11
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection,
|
|
12
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderByValue,
|
|
13
|
+
AgentsSearchDeployedAgentsRequestSearchItemVersion,
|
|
14
|
+
AgentsSearchDeployedAgentsRequestSearchItem_Name,
|
|
15
|
+
AgentsSearchDeployedAgentsRequestSearchItem_OrderBy,
|
|
16
|
+
AgentsSearchDeployedAgentsRequestSearchItem_Version,
|
|
14
17
|
CreateAgentRequestToolRulesItem,
|
|
15
18
|
UpdateAgentToolRulesItem,
|
|
16
19
|
)
|
|
17
20
|
from . import archival_memory, context, memory, memory_blocks, messages, recall_memory, sources, tools
|
|
18
|
-
from .messages import
|
|
21
|
+
from .messages import (
|
|
22
|
+
LettaStreamingResponse,
|
|
23
|
+
LettaStreamingResponse_AssistantMessage,
|
|
24
|
+
LettaStreamingResponse_ReasoningMessage,
|
|
25
|
+
LettaStreamingResponse_SystemMessage,
|
|
26
|
+
LettaStreamingResponse_ToolCallMessage,
|
|
27
|
+
LettaStreamingResponse_ToolReturnMessage,
|
|
28
|
+
LettaStreamingResponse_UsageStatistics,
|
|
29
|
+
LettaStreamingResponse_UserMessage,
|
|
30
|
+
MessagesListResponse,
|
|
31
|
+
MessagesListResponseItem,
|
|
32
|
+
MessagesListResponseItem_AssistantMessage,
|
|
33
|
+
MessagesListResponseItem_ReasoningMessage,
|
|
34
|
+
MessagesListResponseItem_SystemMessage,
|
|
35
|
+
MessagesListResponseItem_ToolCallMessage,
|
|
36
|
+
MessagesListResponseItem_ToolReturnMessage,
|
|
37
|
+
MessagesListResponseItem_UserMessage,
|
|
38
|
+
)
|
|
19
39
|
|
|
20
40
|
__all__ = [
|
|
21
41
|
"AgentsGetAgentVariablesResponse",
|
|
22
42
|
"AgentsMigrateResponse",
|
|
23
43
|
"AgentsSearchDeployedAgentsRequestCombinator",
|
|
24
44
|
"AgentsSearchDeployedAgentsRequestSearchItem",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
45
|
+
"AgentsSearchDeployedAgentsRequestSearchItemName",
|
|
46
|
+
"AgentsSearchDeployedAgentsRequestSearchItemNameOperator",
|
|
47
|
+
"AgentsSearchDeployedAgentsRequestSearchItemOrderBy",
|
|
48
|
+
"AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection",
|
|
49
|
+
"AgentsSearchDeployedAgentsRequestSearchItemOrderByValue",
|
|
50
|
+
"AgentsSearchDeployedAgentsRequestSearchItemVersion",
|
|
51
|
+
"AgentsSearchDeployedAgentsRequestSearchItem_Name",
|
|
52
|
+
"AgentsSearchDeployedAgentsRequestSearchItem_OrderBy",
|
|
53
|
+
"AgentsSearchDeployedAgentsRequestSearchItem_Version",
|
|
31
54
|
"CreateAgentRequestToolRulesItem",
|
|
32
55
|
"LettaStreamingResponse",
|
|
56
|
+
"LettaStreamingResponse_AssistantMessage",
|
|
57
|
+
"LettaStreamingResponse_ReasoningMessage",
|
|
58
|
+
"LettaStreamingResponse_SystemMessage",
|
|
59
|
+
"LettaStreamingResponse_ToolCallMessage",
|
|
60
|
+
"LettaStreamingResponse_ToolReturnMessage",
|
|
61
|
+
"LettaStreamingResponse_UsageStatistics",
|
|
62
|
+
"LettaStreamingResponse_UserMessage",
|
|
33
63
|
"MessagesListResponse",
|
|
34
64
|
"MessagesListResponseItem",
|
|
65
|
+
"MessagesListResponseItem_AssistantMessage",
|
|
66
|
+
"MessagesListResponseItem_ReasoningMessage",
|
|
67
|
+
"MessagesListResponseItem_SystemMessage",
|
|
68
|
+
"MessagesListResponseItem_ToolCallMessage",
|
|
69
|
+
"MessagesListResponseItem_ToolReturnMessage",
|
|
70
|
+
"MessagesListResponseItem_UserMessage",
|
|
35
71
|
"UpdateAgentToolRulesItem",
|
|
36
72
|
"archival_memory",
|
|
37
73
|
"context",
|
letta/agents/client.py
CHANGED
|
@@ -68,6 +68,8 @@ class AgentsClient:
|
|
|
68
68
|
name: typing.Optional[str] = None,
|
|
69
69
|
tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
70
70
|
match_all_tags: typing.Optional[bool] = None,
|
|
71
|
+
cursor: typing.Optional[int] = None,
|
|
72
|
+
limit: typing.Optional[int] = None,
|
|
71
73
|
request_options: typing.Optional[RequestOptions] = None,
|
|
72
74
|
) -> typing.List[AgentState]:
|
|
73
75
|
"""
|
|
@@ -85,6 +87,12 @@ class AgentsClient:
|
|
|
85
87
|
match_all_tags : typing.Optional[bool]
|
|
86
88
|
If True, only returns agents that match ALL given tags. Otherwise, return agents that have ANY of the passed in tags.
|
|
87
89
|
|
|
90
|
+
cursor : typing.Optional[int]
|
|
91
|
+
Cursor for pagination
|
|
92
|
+
|
|
93
|
+
limit : typing.Optional[int]
|
|
94
|
+
Limit for pagination
|
|
95
|
+
|
|
88
96
|
request_options : typing.Optional[RequestOptions]
|
|
89
97
|
Request-specific configuration.
|
|
90
98
|
|
|
@@ -109,6 +117,8 @@ class AgentsClient:
|
|
|
109
117
|
"name": name,
|
|
110
118
|
"tags": tags,
|
|
111
119
|
"match_all_tags": match_all_tags,
|
|
120
|
+
"cursor": cursor,
|
|
121
|
+
"limit": limit,
|
|
112
122
|
},
|
|
113
123
|
request_options=request_options,
|
|
114
124
|
)
|
|
@@ -161,6 +171,7 @@ class AgentsClient:
|
|
|
161
171
|
embedding_chunk_size: typing.Optional[int] = OMIT,
|
|
162
172
|
from_template: typing.Optional[str] = OMIT,
|
|
163
173
|
project_id: typing.Optional[str] = OMIT,
|
|
174
|
+
tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
|
|
164
175
|
user_id: typing.Optional[str] = OMIT,
|
|
165
176
|
request_options: typing.Optional[RequestOptions] = None,
|
|
166
177
|
) -> AgentState:
|
|
@@ -235,6 +246,9 @@ class AgentsClient:
|
|
|
235
246
|
project_id : typing.Optional[str]
|
|
236
247
|
The project id that the agent will be associated with.
|
|
237
248
|
|
|
249
|
+
tool_exec_environment_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
|
|
250
|
+
The environment variables for tool execution specific to this agent.
|
|
251
|
+
|
|
238
252
|
user_id : typing.Optional[str]
|
|
239
253
|
|
|
240
254
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -297,6 +311,7 @@ class AgentsClient:
|
|
|
297
311
|
"embedding_chunk_size": embedding_chunk_size,
|
|
298
312
|
"from_template": from_template,
|
|
299
313
|
"project_id": project_id,
|
|
314
|
+
"tool_exec_environment_variables": tool_exec_environment_variables,
|
|
300
315
|
"user_id": user_id,
|
|
301
316
|
},
|
|
302
317
|
headers={
|
|
@@ -459,6 +474,7 @@ class AgentsClient:
|
|
|
459
474
|
message_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
460
475
|
description: typing.Optional[str] = OMIT,
|
|
461
476
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
477
|
+
tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
|
|
462
478
|
request_options: typing.Optional[RequestOptions] = None,
|
|
463
479
|
) -> AgentState:
|
|
464
480
|
"""
|
|
@@ -504,6 +520,9 @@ class AgentsClient:
|
|
|
504
520
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
505
521
|
The metadata of the agent.
|
|
506
522
|
|
|
523
|
+
tool_exec_environment_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
|
|
524
|
+
The environment variables for tool execution specific to this agent.
|
|
525
|
+
|
|
507
526
|
request_options : typing.Optional[RequestOptions]
|
|
508
527
|
Request-specific configuration.
|
|
509
528
|
|
|
@@ -545,6 +564,7 @@ class AgentsClient:
|
|
|
545
564
|
"message_ids": message_ids,
|
|
546
565
|
"description": description,
|
|
547
566
|
"metadata_": metadata,
|
|
567
|
+
"tool_exec_environment_variables": tool_exec_environment_variables,
|
|
548
568
|
},
|
|
549
569
|
headers={
|
|
550
570
|
"content-type": "application/json",
|
|
@@ -1289,6 +1309,8 @@ class AsyncAgentsClient:
|
|
|
1289
1309
|
name: typing.Optional[str] = None,
|
|
1290
1310
|
tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
1291
1311
|
match_all_tags: typing.Optional[bool] = None,
|
|
1312
|
+
cursor: typing.Optional[int] = None,
|
|
1313
|
+
limit: typing.Optional[int] = None,
|
|
1292
1314
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1293
1315
|
) -> typing.List[AgentState]:
|
|
1294
1316
|
"""
|
|
@@ -1306,6 +1328,12 @@ class AsyncAgentsClient:
|
|
|
1306
1328
|
match_all_tags : typing.Optional[bool]
|
|
1307
1329
|
If True, only returns agents that match ALL given tags. Otherwise, return agents that have ANY of the passed in tags.
|
|
1308
1330
|
|
|
1331
|
+
cursor : typing.Optional[int]
|
|
1332
|
+
Cursor for pagination
|
|
1333
|
+
|
|
1334
|
+
limit : typing.Optional[int]
|
|
1335
|
+
Limit for pagination
|
|
1336
|
+
|
|
1309
1337
|
request_options : typing.Optional[RequestOptions]
|
|
1310
1338
|
Request-specific configuration.
|
|
1311
1339
|
|
|
@@ -1338,6 +1366,8 @@ class AsyncAgentsClient:
|
|
|
1338
1366
|
"name": name,
|
|
1339
1367
|
"tags": tags,
|
|
1340
1368
|
"match_all_tags": match_all_tags,
|
|
1369
|
+
"cursor": cursor,
|
|
1370
|
+
"limit": limit,
|
|
1341
1371
|
},
|
|
1342
1372
|
request_options=request_options,
|
|
1343
1373
|
)
|
|
@@ -1390,6 +1420,7 @@ class AsyncAgentsClient:
|
|
|
1390
1420
|
embedding_chunk_size: typing.Optional[int] = OMIT,
|
|
1391
1421
|
from_template: typing.Optional[str] = OMIT,
|
|
1392
1422
|
project_id: typing.Optional[str] = OMIT,
|
|
1423
|
+
tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
|
|
1393
1424
|
user_id: typing.Optional[str] = OMIT,
|
|
1394
1425
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1395
1426
|
) -> AgentState:
|
|
@@ -1464,6 +1495,9 @@ class AsyncAgentsClient:
|
|
|
1464
1495
|
project_id : typing.Optional[str]
|
|
1465
1496
|
The project id that the agent will be associated with.
|
|
1466
1497
|
|
|
1498
|
+
tool_exec_environment_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
|
|
1499
|
+
The environment variables for tool execution specific to this agent.
|
|
1500
|
+
|
|
1467
1501
|
user_id : typing.Optional[str]
|
|
1468
1502
|
|
|
1469
1503
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -1534,6 +1568,7 @@ class AsyncAgentsClient:
|
|
|
1534
1568
|
"embedding_chunk_size": embedding_chunk_size,
|
|
1535
1569
|
"from_template": from_template,
|
|
1536
1570
|
"project_id": project_id,
|
|
1571
|
+
"tool_exec_environment_variables": tool_exec_environment_variables,
|
|
1537
1572
|
"user_id": user_id,
|
|
1538
1573
|
},
|
|
1539
1574
|
headers={
|
|
@@ -1712,6 +1747,7 @@ class AsyncAgentsClient:
|
|
|
1712
1747
|
message_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1713
1748
|
description: typing.Optional[str] = OMIT,
|
|
1714
1749
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
1750
|
+
tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
|
|
1715
1751
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1716
1752
|
) -> AgentState:
|
|
1717
1753
|
"""
|
|
@@ -1757,6 +1793,9 @@ class AsyncAgentsClient:
|
|
|
1757
1793
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1758
1794
|
The metadata of the agent.
|
|
1759
1795
|
|
|
1796
|
+
tool_exec_environment_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
|
|
1797
|
+
The environment variables for tool execution specific to this agent.
|
|
1798
|
+
|
|
1760
1799
|
request_options : typing.Optional[RequestOptions]
|
|
1761
1800
|
Request-specific configuration.
|
|
1762
1801
|
|
|
@@ -1806,6 +1845,7 @@ class AsyncAgentsClient:
|
|
|
1806
1845
|
"message_ids": message_ids,
|
|
1807
1846
|
"description": description,
|
|
1808
1847
|
"metadata_": metadata,
|
|
1848
|
+
"tool_exec_environment_variables": tool_exec_environment_variables,
|
|
1809
1849
|
},
|
|
1810
1850
|
headers={
|
|
1811
1851
|
"content-type": "application/json",
|
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from .types import
|
|
3
|
+
from .types import (
|
|
4
|
+
LettaStreamingResponse,
|
|
5
|
+
LettaStreamingResponse_AssistantMessage,
|
|
6
|
+
LettaStreamingResponse_ReasoningMessage,
|
|
7
|
+
LettaStreamingResponse_SystemMessage,
|
|
8
|
+
LettaStreamingResponse_ToolCallMessage,
|
|
9
|
+
LettaStreamingResponse_ToolReturnMessage,
|
|
10
|
+
LettaStreamingResponse_UsageStatistics,
|
|
11
|
+
LettaStreamingResponse_UserMessage,
|
|
12
|
+
MessagesListResponse,
|
|
13
|
+
MessagesListResponseItem,
|
|
14
|
+
MessagesListResponseItem_AssistantMessage,
|
|
15
|
+
MessagesListResponseItem_ReasoningMessage,
|
|
16
|
+
MessagesListResponseItem_SystemMessage,
|
|
17
|
+
MessagesListResponseItem_ToolCallMessage,
|
|
18
|
+
MessagesListResponseItem_ToolReturnMessage,
|
|
19
|
+
MessagesListResponseItem_UserMessage,
|
|
20
|
+
)
|
|
4
21
|
|
|
5
|
-
__all__ = [
|
|
22
|
+
__all__ = [
|
|
23
|
+
"LettaStreamingResponse",
|
|
24
|
+
"LettaStreamingResponse_AssistantMessage",
|
|
25
|
+
"LettaStreamingResponse_ReasoningMessage",
|
|
26
|
+
"LettaStreamingResponse_SystemMessage",
|
|
27
|
+
"LettaStreamingResponse_ToolCallMessage",
|
|
28
|
+
"LettaStreamingResponse_ToolReturnMessage",
|
|
29
|
+
"LettaStreamingResponse_UsageStatistics",
|
|
30
|
+
"LettaStreamingResponse_UserMessage",
|
|
31
|
+
"MessagesListResponse",
|
|
32
|
+
"MessagesListResponseItem",
|
|
33
|
+
"MessagesListResponseItem_AssistantMessage",
|
|
34
|
+
"MessagesListResponseItem_ReasoningMessage",
|
|
35
|
+
"MessagesListResponseItem_SystemMessage",
|
|
36
|
+
"MessagesListResponseItem_ToolCallMessage",
|
|
37
|
+
"MessagesListResponseItem_ToolReturnMessage",
|
|
38
|
+
"MessagesListResponseItem_UserMessage",
|
|
39
|
+
]
|
letta/agents/messages/client.py
CHANGED
|
@@ -345,6 +345,25 @@ class MessagesClient:
|
|
|
345
345
|
------
|
|
346
346
|
typing.Iterator[LettaStreamingResponse]
|
|
347
347
|
Successful response
|
|
348
|
+
|
|
349
|
+
Examples
|
|
350
|
+
--------
|
|
351
|
+
from letta import Letta, MessageCreate
|
|
352
|
+
|
|
353
|
+
client = Letta(
|
|
354
|
+
token="YOUR_TOKEN",
|
|
355
|
+
)
|
|
356
|
+
response = client.agents.messages.stream(
|
|
357
|
+
agent_id="agent_id",
|
|
358
|
+
messages=[
|
|
359
|
+
MessageCreate(
|
|
360
|
+
role="user",
|
|
361
|
+
text="text",
|
|
362
|
+
)
|
|
363
|
+
],
|
|
364
|
+
)
|
|
365
|
+
for chunk in response:
|
|
366
|
+
yield chunk
|
|
348
367
|
"""
|
|
349
368
|
with self._client_wrapper.httpx_client.stream(
|
|
350
369
|
f"v1/agents/{jsonable_encoder(agent_id)}/messages/stream",
|
|
@@ -737,6 +756,33 @@ class AsyncMessagesClient:
|
|
|
737
756
|
------
|
|
738
757
|
typing.AsyncIterator[LettaStreamingResponse]
|
|
739
758
|
Successful response
|
|
759
|
+
|
|
760
|
+
Examples
|
|
761
|
+
--------
|
|
762
|
+
import asyncio
|
|
763
|
+
|
|
764
|
+
from letta import AsyncLetta, MessageCreate
|
|
765
|
+
|
|
766
|
+
client = AsyncLetta(
|
|
767
|
+
token="YOUR_TOKEN",
|
|
768
|
+
)
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
async def main() -> None:
|
|
772
|
+
response = await client.agents.messages.stream(
|
|
773
|
+
agent_id="agent_id",
|
|
774
|
+
messages=[
|
|
775
|
+
MessageCreate(
|
|
776
|
+
role="user",
|
|
777
|
+
text="text",
|
|
778
|
+
)
|
|
779
|
+
],
|
|
780
|
+
)
|
|
781
|
+
async for chunk in response:
|
|
782
|
+
yield chunk
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
asyncio.run(main())
|
|
740
786
|
"""
|
|
741
787
|
async with self._client_wrapper.httpx_client.stream(
|
|
742
788
|
f"v1/agents/{jsonable_encoder(agent_id)}/messages/stream",
|
|
@@ -1,7 +1,41 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from .letta_streaming_response import
|
|
3
|
+
from .letta_streaming_response import (
|
|
4
|
+
LettaStreamingResponse,
|
|
5
|
+
LettaStreamingResponse_AssistantMessage,
|
|
6
|
+
LettaStreamingResponse_ReasoningMessage,
|
|
7
|
+
LettaStreamingResponse_SystemMessage,
|
|
8
|
+
LettaStreamingResponse_ToolCallMessage,
|
|
9
|
+
LettaStreamingResponse_ToolReturnMessage,
|
|
10
|
+
LettaStreamingResponse_UsageStatistics,
|
|
11
|
+
LettaStreamingResponse_UserMessage,
|
|
12
|
+
)
|
|
4
13
|
from .messages_list_response import MessagesListResponse
|
|
5
|
-
from .messages_list_response_item import
|
|
14
|
+
from .messages_list_response_item import (
|
|
15
|
+
MessagesListResponseItem,
|
|
16
|
+
MessagesListResponseItem_AssistantMessage,
|
|
17
|
+
MessagesListResponseItem_ReasoningMessage,
|
|
18
|
+
MessagesListResponseItem_SystemMessage,
|
|
19
|
+
MessagesListResponseItem_ToolCallMessage,
|
|
20
|
+
MessagesListResponseItem_ToolReturnMessage,
|
|
21
|
+
MessagesListResponseItem_UserMessage,
|
|
22
|
+
)
|
|
6
23
|
|
|
7
|
-
__all__ = [
|
|
24
|
+
__all__ = [
|
|
25
|
+
"LettaStreamingResponse",
|
|
26
|
+
"LettaStreamingResponse_AssistantMessage",
|
|
27
|
+
"LettaStreamingResponse_ReasoningMessage",
|
|
28
|
+
"LettaStreamingResponse_SystemMessage",
|
|
29
|
+
"LettaStreamingResponse_ToolCallMessage",
|
|
30
|
+
"LettaStreamingResponse_ToolReturnMessage",
|
|
31
|
+
"LettaStreamingResponse_UsageStatistics",
|
|
32
|
+
"LettaStreamingResponse_UserMessage",
|
|
33
|
+
"MessagesListResponse",
|
|
34
|
+
"MessagesListResponseItem",
|
|
35
|
+
"MessagesListResponseItem_AssistantMessage",
|
|
36
|
+
"MessagesListResponseItem_ReasoningMessage",
|
|
37
|
+
"MessagesListResponseItem_SystemMessage",
|
|
38
|
+
"MessagesListResponseItem_ToolCallMessage",
|
|
39
|
+
"MessagesListResponseItem_ToolReturnMessage",
|
|
40
|
+
"MessagesListResponseItem_UserMessage",
|
|
41
|
+
]
|
|
@@ -1,20 +1,138 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from ....core.pydantic_utilities import UniversalBaseModel
|
|
3
5
|
import typing
|
|
4
|
-
|
|
5
|
-
from ....
|
|
6
|
-
|
|
7
|
-
from ....types.
|
|
8
|
-
from ....types.
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
import datetime as dt
|
|
7
|
+
from ....core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
import pydantic
|
|
9
|
+
from ....types.tool_call_message_tool_call import ToolCallMessageToolCall
|
|
10
|
+
from ....types.tool_return_message_status import ToolReturnMessageStatus
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class LettaStreamingResponse_SystemMessage(UniversalBaseModel):
|
|
14
|
+
message_type: typing.Literal["system_message"] = "system_message"
|
|
15
|
+
id: str
|
|
16
|
+
date: dt.datetime
|
|
17
|
+
message: str
|
|
18
|
+
|
|
19
|
+
if IS_PYDANTIC_V2:
|
|
20
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
21
|
+
else:
|
|
22
|
+
|
|
23
|
+
class Config:
|
|
24
|
+
frozen = True
|
|
25
|
+
smart_union = True
|
|
26
|
+
extra = pydantic.Extra.allow
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class LettaStreamingResponse_UserMessage(UniversalBaseModel):
|
|
30
|
+
message_type: typing.Literal["user_message"] = "user_message"
|
|
31
|
+
id: str
|
|
32
|
+
date: dt.datetime
|
|
33
|
+
message: str
|
|
34
|
+
|
|
35
|
+
if IS_PYDANTIC_V2:
|
|
36
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
37
|
+
else:
|
|
38
|
+
|
|
39
|
+
class Config:
|
|
40
|
+
frozen = True
|
|
41
|
+
smart_union = True
|
|
42
|
+
extra = pydantic.Extra.allow
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class LettaStreamingResponse_ReasoningMessage(UniversalBaseModel):
|
|
46
|
+
message_type: typing.Literal["reasoning_message"] = "reasoning_message"
|
|
47
|
+
id: str
|
|
48
|
+
date: dt.datetime
|
|
49
|
+
reasoning: str
|
|
50
|
+
|
|
51
|
+
if IS_PYDANTIC_V2:
|
|
52
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
53
|
+
else:
|
|
54
|
+
|
|
55
|
+
class Config:
|
|
56
|
+
frozen = True
|
|
57
|
+
smart_union = True
|
|
58
|
+
extra = pydantic.Extra.allow
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class LettaStreamingResponse_ToolCallMessage(UniversalBaseModel):
|
|
62
|
+
message_type: typing.Literal["tool_call_message"] = "tool_call_message"
|
|
63
|
+
id: str
|
|
64
|
+
date: dt.datetime
|
|
65
|
+
tool_call: ToolCallMessageToolCall
|
|
66
|
+
|
|
67
|
+
if IS_PYDANTIC_V2:
|
|
68
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
69
|
+
else:
|
|
70
|
+
|
|
71
|
+
class Config:
|
|
72
|
+
frozen = True
|
|
73
|
+
smart_union = True
|
|
74
|
+
extra = pydantic.Extra.allow
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class LettaStreamingResponse_ToolReturnMessage(UniversalBaseModel):
|
|
78
|
+
message_type: typing.Literal["tool_return_message"] = "tool_return_message"
|
|
79
|
+
id: str
|
|
80
|
+
date: dt.datetime
|
|
81
|
+
tool_return: str
|
|
82
|
+
status: ToolReturnMessageStatus
|
|
83
|
+
tool_call_id: str
|
|
84
|
+
stdout: typing.Optional[typing.List[str]] = None
|
|
85
|
+
stderr: typing.Optional[typing.List[str]] = None
|
|
86
|
+
|
|
87
|
+
if IS_PYDANTIC_V2:
|
|
88
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
89
|
+
else:
|
|
90
|
+
|
|
91
|
+
class Config:
|
|
92
|
+
frozen = True
|
|
93
|
+
smart_union = True
|
|
94
|
+
extra = pydantic.Extra.allow
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class LettaStreamingResponse_AssistantMessage(UniversalBaseModel):
|
|
98
|
+
message_type: typing.Literal["assistant_message"] = "assistant_message"
|
|
99
|
+
id: str
|
|
100
|
+
date: dt.datetime
|
|
101
|
+
assistant_message: str
|
|
102
|
+
|
|
103
|
+
if IS_PYDANTIC_V2:
|
|
104
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
105
|
+
else:
|
|
106
|
+
|
|
107
|
+
class Config:
|
|
108
|
+
frozen = True
|
|
109
|
+
smart_union = True
|
|
110
|
+
extra = pydantic.Extra.allow
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class LettaStreamingResponse_UsageStatistics(UniversalBaseModel):
|
|
114
|
+
message_type: typing.Literal["usage_statistics"] = "usage_statistics"
|
|
115
|
+
completion_tokens: typing.Optional[int] = None
|
|
116
|
+
prompt_tokens: typing.Optional[int] = None
|
|
117
|
+
total_tokens: typing.Optional[int] = None
|
|
118
|
+
step_count: typing.Optional[int] = None
|
|
119
|
+
|
|
120
|
+
if IS_PYDANTIC_V2:
|
|
121
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
122
|
+
else:
|
|
123
|
+
|
|
124
|
+
class Config:
|
|
125
|
+
frozen = True
|
|
126
|
+
smart_union = True
|
|
127
|
+
extra = pydantic.Extra.allow
|
|
128
|
+
|
|
11
129
|
|
|
12
130
|
LettaStreamingResponse = typing.Union[
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
131
|
+
LettaStreamingResponse_SystemMessage,
|
|
132
|
+
LettaStreamingResponse_UserMessage,
|
|
133
|
+
LettaStreamingResponse_ReasoningMessage,
|
|
134
|
+
LettaStreamingResponse_ToolCallMessage,
|
|
135
|
+
LettaStreamingResponse_ToolReturnMessage,
|
|
136
|
+
LettaStreamingResponse_AssistantMessage,
|
|
137
|
+
LettaStreamingResponse_UsageStatistics,
|
|
20
138
|
]
|