letta-client 1.0.0a1__py3-none-any.whl → 1.0.0a2__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_client/__init__.py +149 -23
- letta_client/agents/__init__.py +15 -17
- letta_client/agents/blocks/__init__.py +3 -0
- letta_client/agents/blocks/client.py +77 -4
- letta_client/agents/blocks/raw_client.py +63 -2
- letta_client/agents/blocks/types/__init__.py +7 -0
- letta_client/agents/blocks/types/blocks_list_request_order.py +5 -0
- letta_client/agents/client.py +46 -13
- letta_client/agents/files/__init__.py +3 -0
- letta_client/agents/files/client.py +71 -10
- letta_client/agents/files/raw_client.py +51 -10
- letta_client/agents/files/types/__init__.py +7 -0
- letta_client/{types/tool_return_status.py → agents/files/types/files_list_request_order.py} +1 -1
- letta_client/agents/folders/__init__.py +3 -0
- letta_client/agents/folders/client.py +77 -4
- letta_client/agents/folders/raw_client.py +63 -2
- letta_client/agents/folders/types/__init__.py +7 -0
- letta_client/agents/folders/types/folders_list_request_order.py +5 -0
- letta_client/agents/groups/__init__.py +3 -0
- letta_client/agents/groups/client.py +71 -2
- letta_client/agents/groups/raw_client.py +51 -0
- letta_client/agents/groups/types/__init__.py +7 -0
- letta_client/agents/groups/types/groups_list_request_order.py +5 -0
- letta_client/agents/messages/__init__.py +2 -0
- letta_client/agents/messages/client.py +55 -14
- letta_client/agents/messages/raw_client.py +35 -14
- letta_client/agents/messages/types/__init__.py +2 -0
- letta_client/agents/messages/types/messages_list_request_order.py +5 -0
- letta_client/agents/passages/client.py +29 -0
- letta_client/agents/raw_client.py +4 -4
- letta_client/agents/sources/__init__.py +3 -0
- letta_client/agents/sources/client.py +77 -4
- letta_client/agents/sources/raw_client.py +63 -2
- letta_client/agents/sources/types/__init__.py +7 -0
- letta_client/agents/sources/types/sources_list_request_order.py +5 -0
- letta_client/agents/tools/__init__.py +3 -0
- letta_client/agents/tools/client.py +77 -4
- letta_client/agents/tools/raw_client.py +63 -2
- letta_client/agents/tools/types/__init__.py +7 -0
- letta_client/agents/tools/types/tools_list_request_order.py +5 -0
- letta_client/archives/client.py +16 -2
- letta_client/base_client.py +3 -0
- letta_client/batches/client.py +12 -2
- letta_client/batches/messages/client.py +10 -0
- letta_client/blocks/agents/client.py +8 -0
- letta_client/blocks/client.py +32 -2
- letta_client/chat/__init__.py +7 -0
- letta_client/chat/client.py +255 -0
- letta_client/chat/raw_client.py +269 -0
- letta_client/chat/types/__init__.py +8 -0
- letta_client/chat/types/chat_completion_request_messages_item.py +19 -0
- letta_client/chat/types/chat_completion_request_stop.py +5 -0
- letta_client/client_side_access_tokens/client.py +10 -2
- letta_client/core/client_wrapper.py +2 -2
- letta_client/errors/__init__.py +2 -0
- letta_client/errors/gone_error.py +10 -0
- letta_client/folders/agents/client.py +8 -0
- letta_client/folders/client.py +20 -4
- letta_client/folders/files/client.py +14 -0
- letta_client/folders/passages/client.py +8 -0
- letta_client/groups/client.py +16 -2
- letta_client/groups/messages/client.py +14 -0
- letta_client/identities/agents/client.py +8 -0
- letta_client/identities/blocks/client.py +8 -0
- letta_client/identities/client.py +20 -2
- letta_client/jobs/__init__.py +3 -0
- letta_client/jobs/client.py +61 -12
- letta_client/jobs/raw_client.py +29 -8
- letta_client/jobs/types/__init__.py +7 -0
- letta_client/jobs/types/jobs_list_request_order.py +5 -0
- letta_client/models/client.py +8 -2
- letta_client/projects/client.py +10 -2
- letta_client/providers/client.py +90 -2
- letta_client/providers/raw_client.py +102 -0
- letta_client/runs/__init__.py +11 -2
- letta_client/runs/client.py +150 -18
- letta_client/runs/messages/client.py +30 -2
- letta_client/runs/messages/raw_client.py +10 -0
- letta_client/runs/raw_client.py +144 -14
- letta_client/runs/steps/__init__.py +3 -0
- letta_client/runs/steps/client.py +39 -30
- letta_client/runs/steps/raw_client.py +19 -28
- letta_client/runs/steps/types/__init__.py +7 -0
- letta_client/runs/steps/types/steps_list_request_order.py +5 -0
- letta_client/runs/types/__init__.py +2 -1
- letta_client/runs/types/runs_list_request_order.py +5 -0
- letta_client/sources/client.py +8 -2
- letta_client/sources/files/client.py +12 -0
- letta_client/sources/passages/client.py +6 -0
- letta_client/steps/client.py +26 -2
- letta_client/steps/messages/client.py +8 -0
- letta_client/tags/client.py +16 -2
- letta_client/templates/__init__.py +12 -0
- letta_client/templates/client.py +30 -4
- letta_client/templates/raw_client.py +2 -2
- letta_client/templates/types/__init__.py +24 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_llm_config.py +4 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_llm_config_display_name.py +14 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_llm_config_display_name_item.py +5 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_secrets_item.py +4 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_secrets_item_value_enc.py +14 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_secrets_item_value_enc_item.py +5 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_exec_environment_variables_item.py +6 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_exec_environment_variables_item_value_enc.py +16 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tool_exec_environment_variables_item_value_enc_item.py +7 -0
- letta_client/templates/types/templates_create_agents_from_template_response_agents_item_tools_item_tool_type.py +1 -1
- letta_client/tools/client.py +30 -220
- letta_client/tools/raw_client.py +0 -292
- letta_client/types/__init__.py +130 -22
- letta_client/types/agent_environment_variable.py +5 -0
- letta_client/types/{action_parameters_model.py → annotation.py} +4 -10
- letta_client/types/{action_response_model.py → annotation_url_citation.py} +4 -9
- letta_client/types/approval_create.py +8 -2
- letta_client/types/approval_create_approvals_item.py +8 -0
- letta_client/types/approval_response_message.py +8 -2
- letta_client/types/approval_response_message_approvals_item.py +8 -0
- letta_client/types/approval_return.py +34 -0
- letta_client/{agents/templates/types/templates_migrate_response.py → types/audio.py} +4 -4
- letta_client/types/chat_completion.py +30 -0
- letta_client/types/chat_completion_assistant_message_param.py +30 -0
- letta_client/types/chat_completion_assistant_message_param_content.py +9 -0
- letta_client/types/chat_completion_assistant_message_param_content_item.py +10 -0
- letta_client/types/chat_completion_assistant_message_param_tool_calls_item.py +10 -0
- letta_client/types/chat_completion_audio.py +23 -0
- letta_client/types/chat_completion_content_part_image_param.py +22 -0
- letta_client/types/chat_completion_content_part_input_audio_param.py +22 -0
- letta_client/types/chat_completion_content_part_refusal_param.py +21 -0
- letta_client/types/chat_completion_content_part_text_param.py +21 -0
- letta_client/types/chat_completion_developer_message_param.py +23 -0
- letta_client/types/chat_completion_developer_message_param_content.py +7 -0
- letta_client/types/chat_completion_function_message_param.py +22 -0
- letta_client/types/chat_completion_message.py +30 -0
- letta_client/types/chat_completion_message_custom_tool_call.py +23 -0
- letta_client/types/chat_completion_message_custom_tool_call_param.py +23 -0
- letta_client/types/chat_completion_message_function_tool_call_input.py +25 -0
- letta_client/types/{chat_completion_message_function_tool_call.py → chat_completion_message_function_tool_call_output.py} +3 -3
- letta_client/types/chat_completion_message_function_tool_call_param.py +25 -0
- letta_client/types/chat_completion_message_tool_calls_item.py +10 -0
- letta_client/types/chat_completion_service_tier.py +5 -0
- letta_client/types/chat_completion_system_message_param.py +23 -0
- letta_client/types/chat_completion_system_message_param_content.py +7 -0
- letta_client/types/chat_completion_token_logprob.py +24 -0
- letta_client/types/chat_completion_tool_message_param.py +23 -0
- letta_client/types/chat_completion_tool_message_param_content.py +7 -0
- letta_client/types/chat_completion_user_message_param.py +23 -0
- letta_client/types/chat_completion_user_message_param_content.py +7 -0
- letta_client/types/chat_completion_user_message_param_content_item.py +15 -0
- letta_client/types/choice.py +26 -0
- letta_client/types/choice_finish_reason.py +7 -0
- letta_client/types/choice_logprobs.py +22 -0
- letta_client/types/completion_tokens_details.py +23 -0
- letta_client/types/{auth_scheme_field.py → completion_usage.py} +8 -13
- letta_client/types/custom_input.py +21 -0
- letta_client/types/custom_output.py +21 -0
- letta_client/types/file.py +22 -0
- letta_client/types/file_file.py +22 -0
- letta_client/types/function_call_input.py +21 -0
- letta_client/types/function_call_output.py +21 -0
- letta_client/types/{function.py → function_output.py} +1 -1
- letta_client/types/image_url.py +22 -0
- letta_client/types/image_url_detail.py +5 -0
- letta_client/types/input_audio.py +22 -0
- letta_client/types/input_audio_format.py +5 -0
- letta_client/types/internal_template_agent_create.py +2 -2
- letta_client/types/letta_schemas_agent_file_agent_schema.py +2 -2
- letta_client/types/letta_schemas_agent_file_message_schema.py +27 -4
- letta_client/types/letta_schemas_agent_file_message_schema_approvals_item.py +8 -0
- letta_client/types/letta_schemas_letta_message_tool_return.py +26 -0
- letta_client/types/letta_schemas_letta_message_tool_return_status.py +5 -0
- letta_client/types/{tool_return.py → letta_schemas_message_tool_return.py} +9 -3
- letta_client/types/letta_schemas_message_tool_return_status.py +5 -0
- letta_client/types/llm_config.py +5 -0
- letta_client/types/message.py +10 -4
- letta_client/types/message_approvals_item.py +8 -0
- letta_client/types/omitted_reasoning_content.py +4 -0
- letta_client/types/openai_types_chat_chat_completion_message_function_tool_call_function.py +21 -0
- letta_client/types/openai_types_chat_chat_completion_message_function_tool_call_param_function.py +21 -0
- letta_client/types/prompt_tokens_details.py +21 -0
- letta_client/types/provider.py +10 -0
- letta_client/types/run_metrics.py +58 -0
- letta_client/types/sandbox_environment_variable.py +5 -0
- letta_client/types/text_content.py +5 -0
- letta_client/types/tool_call_content.py +5 -0
- letta_client/types/tool_call_message.py +2 -0
- letta_client/types/tool_call_message_tool_calls.py +8 -0
- letta_client/types/tool_return_message.py +8 -5
- letta_client/types/tool_type.py +1 -1
- letta_client/types/top_logprob.py +22 -0
- letta_client/voice/client.py +14 -0
- letta_client/voice/raw_client.py +37 -0
- letta_client-1.0.0a2.dist-info/METADATA +422 -0
- {letta_client-1.0.0a1.dist-info → letta_client-1.0.0a2.dist-info}/RECORD +193 -115
- letta_client/agents/templates/__init__.py +0 -7
- letta_client/agents/templates/client.py +0 -307
- letta_client/agents/templates/raw_client.py +0 -275
- letta_client/agents/templates/types/__init__.py +0 -7
- letta_client/types/action_model.py +0 -39
- letta_client/types/app_auth_scheme.py +0 -35
- letta_client/types/app_auth_scheme_auth_mode.py +0 -19
- letta_client/types/app_model.py +0 -45
- letta_client-1.0.0a1.dist-info/METADATA +0 -211
- {letta_client-1.0.0a1.dist-info → letta_client-1.0.0a2.dist-info}/WHEEL +0 -0
letta_client/runs/client.py
CHANGED
|
@@ -5,11 +5,13 @@ import typing
|
|
|
5
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
7
|
from ..types.run import Run
|
|
8
|
+
from ..types.run_metrics import RunMetrics
|
|
8
9
|
from ..types.stop_reason_type import StopReasonType
|
|
9
10
|
from .messages.client import AsyncMessagesClient, MessagesClient
|
|
10
11
|
from .raw_client import AsyncRawRunsClient, RawRunsClient
|
|
11
12
|
from .steps.client import AsyncStepsClient, StepsClient
|
|
12
13
|
from .types.letta_streaming_response import LettaStreamingResponse
|
|
14
|
+
from .types.runs_list_request_order import RunsListRequestOrder
|
|
13
15
|
from .usage.client import AsyncUsageClient, UsageClient
|
|
14
16
|
|
|
15
17
|
# this is used as the default value for optional parameters
|
|
@@ -41,11 +43,14 @@ class RunsClient:
|
|
|
41
43
|
*,
|
|
42
44
|
agent_id: typing.Optional[str] = None,
|
|
43
45
|
agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
46
|
+
statuses: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
44
47
|
background: typing.Optional[bool] = None,
|
|
45
48
|
stop_reason: typing.Optional[StopReasonType] = None,
|
|
46
|
-
after: typing.Optional[str] = None,
|
|
47
49
|
before: typing.Optional[str] = None,
|
|
50
|
+
after: typing.Optional[str] = None,
|
|
48
51
|
limit: typing.Optional[int] = None,
|
|
52
|
+
order: typing.Optional[RunsListRequestOrder] = None,
|
|
53
|
+
order_by: typing.Optional[typing.Literal["created_at"]] = None,
|
|
49
54
|
active: typing.Optional[bool] = None,
|
|
50
55
|
ascending: typing.Optional[bool] = None,
|
|
51
56
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -61,26 +66,35 @@ class RunsClient:
|
|
|
61
66
|
agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
62
67
|
The unique identifiers of the agents associated with the run. Deprecated in favor of agent_id field.
|
|
63
68
|
|
|
69
|
+
statuses : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
70
|
+
Filter runs by status. Can specify multiple statuses.
|
|
71
|
+
|
|
64
72
|
background : typing.Optional[bool]
|
|
65
73
|
If True, filters for runs that were created in background mode.
|
|
66
74
|
|
|
67
75
|
stop_reason : typing.Optional[StopReasonType]
|
|
68
76
|
Filter runs by stop reason.
|
|
69
77
|
|
|
70
|
-
after : typing.Optional[str]
|
|
71
|
-
Cursor for pagination
|
|
72
|
-
|
|
73
78
|
before : typing.Optional[str]
|
|
74
|
-
|
|
79
|
+
Run ID cursor for pagination. Returns runs that come before this run ID in the specified sort order
|
|
80
|
+
|
|
81
|
+
after : typing.Optional[str]
|
|
82
|
+
Run ID cursor for pagination. Returns runs that come after this run ID in the specified sort order
|
|
75
83
|
|
|
76
84
|
limit : typing.Optional[int]
|
|
77
85
|
Maximum number of runs to return
|
|
78
86
|
|
|
87
|
+
order : typing.Optional[RunsListRequestOrder]
|
|
88
|
+
Sort order for runs by creation time. 'asc' for oldest first, 'desc' for newest first
|
|
89
|
+
|
|
90
|
+
order_by : typing.Optional[typing.Literal["created_at"]]
|
|
91
|
+
Field to sort by
|
|
92
|
+
|
|
79
93
|
active : typing.Optional[bool]
|
|
80
94
|
Filter for active runs.
|
|
81
95
|
|
|
82
96
|
ascending : typing.Optional[bool]
|
|
83
|
-
Whether to sort agents oldest to newest (True) or newest to oldest (False, default)
|
|
97
|
+
Whether to sort agents oldest to newest (True) or newest to oldest (False, default). Deprecated in favor of order field.
|
|
84
98
|
|
|
85
99
|
request_options : typing.Optional[RequestOptions]
|
|
86
100
|
Request-specific configuration.
|
|
@@ -98,16 +112,29 @@ class RunsClient:
|
|
|
98
112
|
project="YOUR_PROJECT",
|
|
99
113
|
token="YOUR_TOKEN",
|
|
100
114
|
)
|
|
101
|
-
client.runs.list(
|
|
115
|
+
client.runs.list(
|
|
116
|
+
agent_id="agent_id",
|
|
117
|
+
background=True,
|
|
118
|
+
stop_reason="end_turn",
|
|
119
|
+
before="before",
|
|
120
|
+
after="after",
|
|
121
|
+
limit=1,
|
|
122
|
+
order="asc",
|
|
123
|
+
active=True,
|
|
124
|
+
ascending=True,
|
|
125
|
+
)
|
|
102
126
|
"""
|
|
103
127
|
_response = self._raw_client.list(
|
|
104
128
|
agent_id=agent_id,
|
|
105
129
|
agent_ids=agent_ids,
|
|
130
|
+
statuses=statuses,
|
|
106
131
|
background=background,
|
|
107
132
|
stop_reason=stop_reason,
|
|
108
|
-
after=after,
|
|
109
133
|
before=before,
|
|
134
|
+
after=after,
|
|
110
135
|
limit=limit,
|
|
136
|
+
order=order,
|
|
137
|
+
order_by=order_by,
|
|
111
138
|
active=active,
|
|
112
139
|
ascending=ascending,
|
|
113
140
|
request_options=request_options,
|
|
@@ -148,7 +175,10 @@ class RunsClient:
|
|
|
148
175
|
project="YOUR_PROJECT",
|
|
149
176
|
token="YOUR_TOKEN",
|
|
150
177
|
)
|
|
151
|
-
client.runs.list_active(
|
|
178
|
+
client.runs.list_active(
|
|
179
|
+
agent_id="agent_id",
|
|
180
|
+
background=True,
|
|
181
|
+
)
|
|
152
182
|
"""
|
|
153
183
|
_response = self._raw_client.list_active(
|
|
154
184
|
agent_id=agent_id, background=background, request_options=request_options
|
|
@@ -217,6 +247,39 @@ class RunsClient:
|
|
|
217
247
|
_response = self._raw_client.delete(run_id, request_options=request_options)
|
|
218
248
|
return _response.data
|
|
219
249
|
|
|
250
|
+
def retrieve_metrics_for_run(
|
|
251
|
+
self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
252
|
+
) -> RunMetrics:
|
|
253
|
+
"""
|
|
254
|
+
Get run metrics by run ID.
|
|
255
|
+
|
|
256
|
+
Parameters
|
|
257
|
+
----------
|
|
258
|
+
run_id : str
|
|
259
|
+
|
|
260
|
+
request_options : typing.Optional[RequestOptions]
|
|
261
|
+
Request-specific configuration.
|
|
262
|
+
|
|
263
|
+
Returns
|
|
264
|
+
-------
|
|
265
|
+
RunMetrics
|
|
266
|
+
Successful Response
|
|
267
|
+
|
|
268
|
+
Examples
|
|
269
|
+
--------
|
|
270
|
+
from letta_client import Letta
|
|
271
|
+
|
|
272
|
+
client = Letta(
|
|
273
|
+
project="YOUR_PROJECT",
|
|
274
|
+
token="YOUR_TOKEN",
|
|
275
|
+
)
|
|
276
|
+
client.runs.retrieve_metrics_for_run(
|
|
277
|
+
run_id="run_id",
|
|
278
|
+
)
|
|
279
|
+
"""
|
|
280
|
+
_response = self._raw_client.retrieve_metrics_for_run(run_id, request_options=request_options)
|
|
281
|
+
return _response.data
|
|
282
|
+
|
|
220
283
|
def stream(
|
|
221
284
|
self,
|
|
222
285
|
run_id: str,
|
|
@@ -302,11 +365,14 @@ class AsyncRunsClient:
|
|
|
302
365
|
*,
|
|
303
366
|
agent_id: typing.Optional[str] = None,
|
|
304
367
|
agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
368
|
+
statuses: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
305
369
|
background: typing.Optional[bool] = None,
|
|
306
370
|
stop_reason: typing.Optional[StopReasonType] = None,
|
|
307
|
-
after: typing.Optional[str] = None,
|
|
308
371
|
before: typing.Optional[str] = None,
|
|
372
|
+
after: typing.Optional[str] = None,
|
|
309
373
|
limit: typing.Optional[int] = None,
|
|
374
|
+
order: typing.Optional[RunsListRequestOrder] = None,
|
|
375
|
+
order_by: typing.Optional[typing.Literal["created_at"]] = None,
|
|
310
376
|
active: typing.Optional[bool] = None,
|
|
311
377
|
ascending: typing.Optional[bool] = None,
|
|
312
378
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -322,26 +388,35 @@ class AsyncRunsClient:
|
|
|
322
388
|
agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
323
389
|
The unique identifiers of the agents associated with the run. Deprecated in favor of agent_id field.
|
|
324
390
|
|
|
391
|
+
statuses : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
392
|
+
Filter runs by status. Can specify multiple statuses.
|
|
393
|
+
|
|
325
394
|
background : typing.Optional[bool]
|
|
326
395
|
If True, filters for runs that were created in background mode.
|
|
327
396
|
|
|
328
397
|
stop_reason : typing.Optional[StopReasonType]
|
|
329
398
|
Filter runs by stop reason.
|
|
330
399
|
|
|
331
|
-
after : typing.Optional[str]
|
|
332
|
-
Cursor for pagination
|
|
333
|
-
|
|
334
400
|
before : typing.Optional[str]
|
|
335
|
-
|
|
401
|
+
Run ID cursor for pagination. Returns runs that come before this run ID in the specified sort order
|
|
402
|
+
|
|
403
|
+
after : typing.Optional[str]
|
|
404
|
+
Run ID cursor for pagination. Returns runs that come after this run ID in the specified sort order
|
|
336
405
|
|
|
337
406
|
limit : typing.Optional[int]
|
|
338
407
|
Maximum number of runs to return
|
|
339
408
|
|
|
409
|
+
order : typing.Optional[RunsListRequestOrder]
|
|
410
|
+
Sort order for runs by creation time. 'asc' for oldest first, 'desc' for newest first
|
|
411
|
+
|
|
412
|
+
order_by : typing.Optional[typing.Literal["created_at"]]
|
|
413
|
+
Field to sort by
|
|
414
|
+
|
|
340
415
|
active : typing.Optional[bool]
|
|
341
416
|
Filter for active runs.
|
|
342
417
|
|
|
343
418
|
ascending : typing.Optional[bool]
|
|
344
|
-
Whether to sort agents oldest to newest (True) or newest to oldest (False, default)
|
|
419
|
+
Whether to sort agents oldest to newest (True) or newest to oldest (False, default). Deprecated in favor of order field.
|
|
345
420
|
|
|
346
421
|
request_options : typing.Optional[RequestOptions]
|
|
347
422
|
Request-specific configuration.
|
|
@@ -364,7 +439,17 @@ class AsyncRunsClient:
|
|
|
364
439
|
|
|
365
440
|
|
|
366
441
|
async def main() -> None:
|
|
367
|
-
await client.runs.list(
|
|
442
|
+
await client.runs.list(
|
|
443
|
+
agent_id="agent_id",
|
|
444
|
+
background=True,
|
|
445
|
+
stop_reason="end_turn",
|
|
446
|
+
before="before",
|
|
447
|
+
after="after",
|
|
448
|
+
limit=1,
|
|
449
|
+
order="asc",
|
|
450
|
+
active=True,
|
|
451
|
+
ascending=True,
|
|
452
|
+
)
|
|
368
453
|
|
|
369
454
|
|
|
370
455
|
asyncio.run(main())
|
|
@@ -372,11 +457,14 @@ class AsyncRunsClient:
|
|
|
372
457
|
_response = await self._raw_client.list(
|
|
373
458
|
agent_id=agent_id,
|
|
374
459
|
agent_ids=agent_ids,
|
|
460
|
+
statuses=statuses,
|
|
375
461
|
background=background,
|
|
376
462
|
stop_reason=stop_reason,
|
|
377
|
-
after=after,
|
|
378
463
|
before=before,
|
|
464
|
+
after=after,
|
|
379
465
|
limit=limit,
|
|
466
|
+
order=order,
|
|
467
|
+
order_by=order_by,
|
|
380
468
|
active=active,
|
|
381
469
|
ascending=ascending,
|
|
382
470
|
request_options=request_options,
|
|
@@ -422,7 +510,10 @@ class AsyncRunsClient:
|
|
|
422
510
|
|
|
423
511
|
|
|
424
512
|
async def main() -> None:
|
|
425
|
-
await client.runs.list_active(
|
|
513
|
+
await client.runs.list_active(
|
|
514
|
+
agent_id="agent_id",
|
|
515
|
+
background=True,
|
|
516
|
+
)
|
|
426
517
|
|
|
427
518
|
|
|
428
519
|
asyncio.run(main())
|
|
@@ -510,6 +601,47 @@ class AsyncRunsClient:
|
|
|
510
601
|
_response = await self._raw_client.delete(run_id, request_options=request_options)
|
|
511
602
|
return _response.data
|
|
512
603
|
|
|
604
|
+
async def retrieve_metrics_for_run(
|
|
605
|
+
self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
606
|
+
) -> RunMetrics:
|
|
607
|
+
"""
|
|
608
|
+
Get run metrics by run ID.
|
|
609
|
+
|
|
610
|
+
Parameters
|
|
611
|
+
----------
|
|
612
|
+
run_id : str
|
|
613
|
+
|
|
614
|
+
request_options : typing.Optional[RequestOptions]
|
|
615
|
+
Request-specific configuration.
|
|
616
|
+
|
|
617
|
+
Returns
|
|
618
|
+
-------
|
|
619
|
+
RunMetrics
|
|
620
|
+
Successful Response
|
|
621
|
+
|
|
622
|
+
Examples
|
|
623
|
+
--------
|
|
624
|
+
import asyncio
|
|
625
|
+
|
|
626
|
+
from letta_client import AsyncLetta
|
|
627
|
+
|
|
628
|
+
client = AsyncLetta(
|
|
629
|
+
project="YOUR_PROJECT",
|
|
630
|
+
token="YOUR_TOKEN",
|
|
631
|
+
)
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
async def main() -> None:
|
|
635
|
+
await client.runs.retrieve_metrics_for_run(
|
|
636
|
+
run_id="run_id",
|
|
637
|
+
)
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
asyncio.run(main())
|
|
641
|
+
"""
|
|
642
|
+
_response = await self._raw_client.retrieve_metrics_for_run(run_id, request_options=request_options)
|
|
643
|
+
return _response.data
|
|
644
|
+
|
|
513
645
|
async def stream(
|
|
514
646
|
self,
|
|
515
647
|
run_id: str,
|
|
@@ -32,6 +32,7 @@ class MessagesClient:
|
|
|
32
32
|
after: typing.Optional[str] = None,
|
|
33
33
|
limit: typing.Optional[int] = None,
|
|
34
34
|
order: typing.Optional[MessagesListRequestOrder] = None,
|
|
35
|
+
order_by: typing.Optional[typing.Literal["created_at"]] = None,
|
|
35
36
|
request_options: typing.Optional[RequestOptions] = None,
|
|
36
37
|
) -> typing.List[LettaMessageUnion]:
|
|
37
38
|
"""
|
|
@@ -53,6 +54,9 @@ class MessagesClient:
|
|
|
53
54
|
order : typing.Optional[MessagesListRequestOrder]
|
|
54
55
|
Sort order for messages by creation time. 'asc' for oldest first, 'desc' for newest first
|
|
55
56
|
|
|
57
|
+
order_by : typing.Optional[typing.Literal["created_at"]]
|
|
58
|
+
Field to sort by
|
|
59
|
+
|
|
56
60
|
request_options : typing.Optional[RequestOptions]
|
|
57
61
|
Request-specific configuration.
|
|
58
62
|
|
|
@@ -71,10 +75,20 @@ class MessagesClient:
|
|
|
71
75
|
)
|
|
72
76
|
client.runs.messages.list(
|
|
73
77
|
run_id="run_id",
|
|
78
|
+
before="before",
|
|
79
|
+
after="after",
|
|
80
|
+
limit=1,
|
|
81
|
+
order="asc",
|
|
74
82
|
)
|
|
75
83
|
"""
|
|
76
84
|
_response = self._raw_client.list(
|
|
77
|
-
run_id,
|
|
85
|
+
run_id,
|
|
86
|
+
before=before,
|
|
87
|
+
after=after,
|
|
88
|
+
limit=limit,
|
|
89
|
+
order=order,
|
|
90
|
+
order_by=order_by,
|
|
91
|
+
request_options=request_options,
|
|
78
92
|
)
|
|
79
93
|
return _response.data
|
|
80
94
|
|
|
@@ -102,6 +116,7 @@ class AsyncMessagesClient:
|
|
|
102
116
|
after: typing.Optional[str] = None,
|
|
103
117
|
limit: typing.Optional[int] = None,
|
|
104
118
|
order: typing.Optional[MessagesListRequestOrder] = None,
|
|
119
|
+
order_by: typing.Optional[typing.Literal["created_at"]] = None,
|
|
105
120
|
request_options: typing.Optional[RequestOptions] = None,
|
|
106
121
|
) -> typing.List[LettaMessageUnion]:
|
|
107
122
|
"""
|
|
@@ -123,6 +138,9 @@ class AsyncMessagesClient:
|
|
|
123
138
|
order : typing.Optional[MessagesListRequestOrder]
|
|
124
139
|
Sort order for messages by creation time. 'asc' for oldest first, 'desc' for newest first
|
|
125
140
|
|
|
141
|
+
order_by : typing.Optional[typing.Literal["created_at"]]
|
|
142
|
+
Field to sort by
|
|
143
|
+
|
|
126
144
|
request_options : typing.Optional[RequestOptions]
|
|
127
145
|
Request-specific configuration.
|
|
128
146
|
|
|
@@ -146,12 +164,22 @@ class AsyncMessagesClient:
|
|
|
146
164
|
async def main() -> None:
|
|
147
165
|
await client.runs.messages.list(
|
|
148
166
|
run_id="run_id",
|
|
167
|
+
before="before",
|
|
168
|
+
after="after",
|
|
169
|
+
limit=1,
|
|
170
|
+
order="asc",
|
|
149
171
|
)
|
|
150
172
|
|
|
151
173
|
|
|
152
174
|
asyncio.run(main())
|
|
153
175
|
"""
|
|
154
176
|
_response = await self._raw_client.list(
|
|
155
|
-
run_id,
|
|
177
|
+
run_id,
|
|
178
|
+
before=before,
|
|
179
|
+
after=after,
|
|
180
|
+
limit=limit,
|
|
181
|
+
order=order,
|
|
182
|
+
order_by=order_by,
|
|
183
|
+
request_options=request_options,
|
|
156
184
|
)
|
|
157
185
|
return _response.data
|
|
@@ -27,6 +27,7 @@ class RawMessagesClient:
|
|
|
27
27
|
after: typing.Optional[str] = None,
|
|
28
28
|
limit: typing.Optional[int] = None,
|
|
29
29
|
order: typing.Optional[MessagesListRequestOrder] = None,
|
|
30
|
+
order_by: typing.Optional[typing.Literal["created_at"]] = None,
|
|
30
31
|
request_options: typing.Optional[RequestOptions] = None,
|
|
31
32
|
) -> HttpResponse[typing.List[LettaMessageUnion]]:
|
|
32
33
|
"""
|
|
@@ -48,6 +49,9 @@ class RawMessagesClient:
|
|
|
48
49
|
order : typing.Optional[MessagesListRequestOrder]
|
|
49
50
|
Sort order for messages by creation time. 'asc' for oldest first, 'desc' for newest first
|
|
50
51
|
|
|
52
|
+
order_by : typing.Optional[typing.Literal["created_at"]]
|
|
53
|
+
Field to sort by
|
|
54
|
+
|
|
51
55
|
request_options : typing.Optional[RequestOptions]
|
|
52
56
|
Request-specific configuration.
|
|
53
57
|
|
|
@@ -64,6 +68,7 @@ class RawMessagesClient:
|
|
|
64
68
|
"after": after,
|
|
65
69
|
"limit": limit,
|
|
66
70
|
"order": order,
|
|
71
|
+
"order_by": order_by,
|
|
67
72
|
},
|
|
68
73
|
request_options=request_options,
|
|
69
74
|
)
|
|
@@ -106,6 +111,7 @@ class AsyncRawMessagesClient:
|
|
|
106
111
|
after: typing.Optional[str] = None,
|
|
107
112
|
limit: typing.Optional[int] = None,
|
|
108
113
|
order: typing.Optional[MessagesListRequestOrder] = None,
|
|
114
|
+
order_by: typing.Optional[typing.Literal["created_at"]] = None,
|
|
109
115
|
request_options: typing.Optional[RequestOptions] = None,
|
|
110
116
|
) -> AsyncHttpResponse[typing.List[LettaMessageUnion]]:
|
|
111
117
|
"""
|
|
@@ -127,6 +133,9 @@ class AsyncRawMessagesClient:
|
|
|
127
133
|
order : typing.Optional[MessagesListRequestOrder]
|
|
128
134
|
Sort order for messages by creation time. 'asc' for oldest first, 'desc' for newest first
|
|
129
135
|
|
|
136
|
+
order_by : typing.Optional[typing.Literal["created_at"]]
|
|
137
|
+
Field to sort by
|
|
138
|
+
|
|
130
139
|
request_options : typing.Optional[RequestOptions]
|
|
131
140
|
Request-specific configuration.
|
|
132
141
|
|
|
@@ -143,6 +152,7 @@ class AsyncRawMessagesClient:
|
|
|
143
152
|
"after": after,
|
|
144
153
|
"limit": limit,
|
|
145
154
|
"order": order,
|
|
155
|
+
"order_by": order_by,
|
|
146
156
|
},
|
|
147
157
|
request_options=request_options,
|
|
148
158
|
)
|