letta-client 1.0.0a1__py3-none-any.whl → 1.0.0a3__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.0a3.dist-info/METADATA +422 -0
- {letta_client-1.0.0a1.dist-info → letta_client-1.0.0a3.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.0a3.dist-info}/WHEEL +0 -0
letta_client/runs/raw_client.py
CHANGED
|
@@ -15,8 +15,10 @@ from ..core.unchecked_base_model import construct_type
|
|
|
15
15
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
16
16
|
from ..types.http_validation_error import HttpValidationError
|
|
17
17
|
from ..types.run import Run
|
|
18
|
+
from ..types.run_metrics import RunMetrics
|
|
18
19
|
from ..types.stop_reason_type import StopReasonType
|
|
19
20
|
from .types.letta_streaming_response import LettaStreamingResponse
|
|
21
|
+
from .types.runs_list_request_order import RunsListRequestOrder
|
|
20
22
|
|
|
21
23
|
# this is used as the default value for optional parameters
|
|
22
24
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -31,11 +33,14 @@ class RawRunsClient:
|
|
|
31
33
|
*,
|
|
32
34
|
agent_id: typing.Optional[str] = None,
|
|
33
35
|
agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
36
|
+
statuses: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
34
37
|
background: typing.Optional[bool] = None,
|
|
35
38
|
stop_reason: typing.Optional[StopReasonType] = None,
|
|
36
|
-
after: typing.Optional[str] = None,
|
|
37
39
|
before: typing.Optional[str] = None,
|
|
40
|
+
after: typing.Optional[str] = None,
|
|
38
41
|
limit: typing.Optional[int] = None,
|
|
42
|
+
order: typing.Optional[RunsListRequestOrder] = None,
|
|
43
|
+
order_by: typing.Optional[typing.Literal["created_at"]] = None,
|
|
39
44
|
active: typing.Optional[bool] = None,
|
|
40
45
|
ascending: typing.Optional[bool] = None,
|
|
41
46
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -51,26 +56,35 @@ class RawRunsClient:
|
|
|
51
56
|
agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
52
57
|
The unique identifiers of the agents associated with the run. Deprecated in favor of agent_id field.
|
|
53
58
|
|
|
59
|
+
statuses : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
60
|
+
Filter runs by status. Can specify multiple statuses.
|
|
61
|
+
|
|
54
62
|
background : typing.Optional[bool]
|
|
55
63
|
If True, filters for runs that were created in background mode.
|
|
56
64
|
|
|
57
65
|
stop_reason : typing.Optional[StopReasonType]
|
|
58
66
|
Filter runs by stop reason.
|
|
59
67
|
|
|
60
|
-
after : typing.Optional[str]
|
|
61
|
-
Cursor for pagination
|
|
62
|
-
|
|
63
68
|
before : typing.Optional[str]
|
|
64
|
-
|
|
69
|
+
Run ID cursor for pagination. Returns runs that come before this run ID in the specified sort order
|
|
70
|
+
|
|
71
|
+
after : typing.Optional[str]
|
|
72
|
+
Run ID cursor for pagination. Returns runs that come after this run ID in the specified sort order
|
|
65
73
|
|
|
66
74
|
limit : typing.Optional[int]
|
|
67
75
|
Maximum number of runs to return
|
|
68
76
|
|
|
77
|
+
order : typing.Optional[RunsListRequestOrder]
|
|
78
|
+
Sort order for runs by creation time. 'asc' for oldest first, 'desc' for newest first
|
|
79
|
+
|
|
80
|
+
order_by : typing.Optional[typing.Literal["created_at"]]
|
|
81
|
+
Field to sort by
|
|
82
|
+
|
|
69
83
|
active : typing.Optional[bool]
|
|
70
84
|
Filter for active runs.
|
|
71
85
|
|
|
72
86
|
ascending : typing.Optional[bool]
|
|
73
|
-
Whether to sort agents oldest to newest (True) or newest to oldest (False, default)
|
|
87
|
+
Whether to sort agents oldest to newest (True) or newest to oldest (False, default). Deprecated in favor of order field.
|
|
74
88
|
|
|
75
89
|
request_options : typing.Optional[RequestOptions]
|
|
76
90
|
Request-specific configuration.
|
|
@@ -86,11 +100,14 @@ class RawRunsClient:
|
|
|
86
100
|
params={
|
|
87
101
|
"agent_id": agent_id,
|
|
88
102
|
"agent_ids": agent_ids,
|
|
103
|
+
"statuses": statuses,
|
|
89
104
|
"background": background,
|
|
90
105
|
"stop_reason": stop_reason,
|
|
91
|
-
"after": after,
|
|
92
106
|
"before": before,
|
|
107
|
+
"after": after,
|
|
93
108
|
"limit": limit,
|
|
109
|
+
"order": order,
|
|
110
|
+
"order_by": order_by,
|
|
94
111
|
"active": active,
|
|
95
112
|
"ascending": ascending,
|
|
96
113
|
},
|
|
@@ -277,6 +294,55 @@ class RawRunsClient:
|
|
|
277
294
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
278
295
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
279
296
|
|
|
297
|
+
def retrieve_metrics_for_run(
|
|
298
|
+
self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
299
|
+
) -> HttpResponse[RunMetrics]:
|
|
300
|
+
"""
|
|
301
|
+
Get run metrics by run ID.
|
|
302
|
+
|
|
303
|
+
Parameters
|
|
304
|
+
----------
|
|
305
|
+
run_id : str
|
|
306
|
+
|
|
307
|
+
request_options : typing.Optional[RequestOptions]
|
|
308
|
+
Request-specific configuration.
|
|
309
|
+
|
|
310
|
+
Returns
|
|
311
|
+
-------
|
|
312
|
+
HttpResponse[RunMetrics]
|
|
313
|
+
Successful Response
|
|
314
|
+
"""
|
|
315
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
316
|
+
f"v1/runs/{jsonable_encoder(run_id)}/metrics",
|
|
317
|
+
method="GET",
|
|
318
|
+
request_options=request_options,
|
|
319
|
+
)
|
|
320
|
+
try:
|
|
321
|
+
if 200 <= _response.status_code < 300:
|
|
322
|
+
_data = typing.cast(
|
|
323
|
+
RunMetrics,
|
|
324
|
+
construct_type(
|
|
325
|
+
type_=RunMetrics, # type: ignore
|
|
326
|
+
object_=_response.json(),
|
|
327
|
+
),
|
|
328
|
+
)
|
|
329
|
+
return HttpResponse(response=_response, data=_data)
|
|
330
|
+
if _response.status_code == 422:
|
|
331
|
+
raise UnprocessableEntityError(
|
|
332
|
+
headers=dict(_response.headers),
|
|
333
|
+
body=typing.cast(
|
|
334
|
+
HttpValidationError,
|
|
335
|
+
construct_type(
|
|
336
|
+
type_=HttpValidationError, # type: ignore
|
|
337
|
+
object_=_response.json(),
|
|
338
|
+
),
|
|
339
|
+
),
|
|
340
|
+
)
|
|
341
|
+
_response_json = _response.json()
|
|
342
|
+
except JSONDecodeError:
|
|
343
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
344
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
345
|
+
|
|
280
346
|
@contextlib.contextmanager
|
|
281
347
|
def stream(
|
|
282
348
|
self,
|
|
@@ -382,11 +448,14 @@ class AsyncRawRunsClient:
|
|
|
382
448
|
*,
|
|
383
449
|
agent_id: typing.Optional[str] = None,
|
|
384
450
|
agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
451
|
+
statuses: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
385
452
|
background: typing.Optional[bool] = None,
|
|
386
453
|
stop_reason: typing.Optional[StopReasonType] = None,
|
|
387
|
-
after: typing.Optional[str] = None,
|
|
388
454
|
before: typing.Optional[str] = None,
|
|
455
|
+
after: typing.Optional[str] = None,
|
|
389
456
|
limit: typing.Optional[int] = None,
|
|
457
|
+
order: typing.Optional[RunsListRequestOrder] = None,
|
|
458
|
+
order_by: typing.Optional[typing.Literal["created_at"]] = None,
|
|
390
459
|
active: typing.Optional[bool] = None,
|
|
391
460
|
ascending: typing.Optional[bool] = None,
|
|
392
461
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -402,26 +471,35 @@ class AsyncRawRunsClient:
|
|
|
402
471
|
agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
403
472
|
The unique identifiers of the agents associated with the run. Deprecated in favor of agent_id field.
|
|
404
473
|
|
|
474
|
+
statuses : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
475
|
+
Filter runs by status. Can specify multiple statuses.
|
|
476
|
+
|
|
405
477
|
background : typing.Optional[bool]
|
|
406
478
|
If True, filters for runs that were created in background mode.
|
|
407
479
|
|
|
408
480
|
stop_reason : typing.Optional[StopReasonType]
|
|
409
481
|
Filter runs by stop reason.
|
|
410
482
|
|
|
411
|
-
after : typing.Optional[str]
|
|
412
|
-
Cursor for pagination
|
|
413
|
-
|
|
414
483
|
before : typing.Optional[str]
|
|
415
|
-
|
|
484
|
+
Run ID cursor for pagination. Returns runs that come before this run ID in the specified sort order
|
|
485
|
+
|
|
486
|
+
after : typing.Optional[str]
|
|
487
|
+
Run ID cursor for pagination. Returns runs that come after this run ID in the specified sort order
|
|
416
488
|
|
|
417
489
|
limit : typing.Optional[int]
|
|
418
490
|
Maximum number of runs to return
|
|
419
491
|
|
|
492
|
+
order : typing.Optional[RunsListRequestOrder]
|
|
493
|
+
Sort order for runs by creation time. 'asc' for oldest first, 'desc' for newest first
|
|
494
|
+
|
|
495
|
+
order_by : typing.Optional[typing.Literal["created_at"]]
|
|
496
|
+
Field to sort by
|
|
497
|
+
|
|
420
498
|
active : typing.Optional[bool]
|
|
421
499
|
Filter for active runs.
|
|
422
500
|
|
|
423
501
|
ascending : typing.Optional[bool]
|
|
424
|
-
Whether to sort agents oldest to newest (True) or newest to oldest (False, default)
|
|
502
|
+
Whether to sort agents oldest to newest (True) or newest to oldest (False, default). Deprecated in favor of order field.
|
|
425
503
|
|
|
426
504
|
request_options : typing.Optional[RequestOptions]
|
|
427
505
|
Request-specific configuration.
|
|
@@ -437,11 +515,14 @@ class AsyncRawRunsClient:
|
|
|
437
515
|
params={
|
|
438
516
|
"agent_id": agent_id,
|
|
439
517
|
"agent_ids": agent_ids,
|
|
518
|
+
"statuses": statuses,
|
|
440
519
|
"background": background,
|
|
441
520
|
"stop_reason": stop_reason,
|
|
442
|
-
"after": after,
|
|
443
521
|
"before": before,
|
|
522
|
+
"after": after,
|
|
444
523
|
"limit": limit,
|
|
524
|
+
"order": order,
|
|
525
|
+
"order_by": order_by,
|
|
445
526
|
"active": active,
|
|
446
527
|
"ascending": ascending,
|
|
447
528
|
},
|
|
@@ -632,6 +713,55 @@ class AsyncRawRunsClient:
|
|
|
632
713
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
633
714
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
634
715
|
|
|
716
|
+
async def retrieve_metrics_for_run(
|
|
717
|
+
self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
718
|
+
) -> AsyncHttpResponse[RunMetrics]:
|
|
719
|
+
"""
|
|
720
|
+
Get run metrics by run ID.
|
|
721
|
+
|
|
722
|
+
Parameters
|
|
723
|
+
----------
|
|
724
|
+
run_id : str
|
|
725
|
+
|
|
726
|
+
request_options : typing.Optional[RequestOptions]
|
|
727
|
+
Request-specific configuration.
|
|
728
|
+
|
|
729
|
+
Returns
|
|
730
|
+
-------
|
|
731
|
+
AsyncHttpResponse[RunMetrics]
|
|
732
|
+
Successful Response
|
|
733
|
+
"""
|
|
734
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
735
|
+
f"v1/runs/{jsonable_encoder(run_id)}/metrics",
|
|
736
|
+
method="GET",
|
|
737
|
+
request_options=request_options,
|
|
738
|
+
)
|
|
739
|
+
try:
|
|
740
|
+
if 200 <= _response.status_code < 300:
|
|
741
|
+
_data = typing.cast(
|
|
742
|
+
RunMetrics,
|
|
743
|
+
construct_type(
|
|
744
|
+
type_=RunMetrics, # type: ignore
|
|
745
|
+
object_=_response.json(),
|
|
746
|
+
),
|
|
747
|
+
)
|
|
748
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
749
|
+
if _response.status_code == 422:
|
|
750
|
+
raise UnprocessableEntityError(
|
|
751
|
+
headers=dict(_response.headers),
|
|
752
|
+
body=typing.cast(
|
|
753
|
+
HttpValidationError,
|
|
754
|
+
construct_type(
|
|
755
|
+
type_=HttpValidationError, # type: ignore
|
|
756
|
+
object_=_response.json(),
|
|
757
|
+
),
|
|
758
|
+
),
|
|
759
|
+
)
|
|
760
|
+
_response_json = _response.json()
|
|
761
|
+
except JSONDecodeError:
|
|
762
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
763
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
764
|
+
|
|
635
765
|
@contextlib.asynccontextmanager
|
|
636
766
|
async def stream(
|
|
637
767
|
self,
|
|
@@ -6,6 +6,7 @@ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
|
6
6
|
from ...core.request_options import RequestOptions
|
|
7
7
|
from ...types.step import Step
|
|
8
8
|
from .raw_client import AsyncRawStepsClient, RawStepsClient
|
|
9
|
+
from .types.steps_list_request_order import StepsListRequestOrder
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class StepsClient:
|
|
@@ -30,21 +31,12 @@ class StepsClient:
|
|
|
30
31
|
before: typing.Optional[str] = None,
|
|
31
32
|
after: typing.Optional[str] = None,
|
|
32
33
|
limit: typing.Optional[int] = None,
|
|
33
|
-
order: typing.Optional[
|
|
34
|
+
order: typing.Optional[StepsListRequestOrder] = None,
|
|
35
|
+
order_by: typing.Optional[typing.Literal["created_at"]] = None,
|
|
34
36
|
request_options: typing.Optional[RequestOptions] = None,
|
|
35
37
|
) -> typing.List[Step]:
|
|
36
38
|
"""
|
|
37
|
-
Get
|
|
38
|
-
|
|
39
|
-
Args:
|
|
40
|
-
run_id: ID of the run
|
|
41
|
-
before: A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
|
|
42
|
-
after: A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
|
|
43
|
-
limit: Maximum number of steps to return
|
|
44
|
-
order: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
|
|
45
|
-
|
|
46
|
-
Returns:
|
|
47
|
-
A list of steps associated with the run.
|
|
39
|
+
Get steps associated with a run with filtering options.
|
|
48
40
|
|
|
49
41
|
Parameters
|
|
50
42
|
----------
|
|
@@ -59,8 +51,11 @@ class StepsClient:
|
|
|
59
51
|
limit : typing.Optional[int]
|
|
60
52
|
Maximum number of messages to return
|
|
61
53
|
|
|
62
|
-
order : typing.Optional[
|
|
63
|
-
Sort order
|
|
54
|
+
order : typing.Optional[StepsListRequestOrder]
|
|
55
|
+
Sort order for steps by creation time. 'asc' for oldest first, 'desc' for newest first
|
|
56
|
+
|
|
57
|
+
order_by : typing.Optional[typing.Literal["created_at"]]
|
|
58
|
+
Field to sort by
|
|
64
59
|
|
|
65
60
|
request_options : typing.Optional[RequestOptions]
|
|
66
61
|
Request-specific configuration.
|
|
@@ -80,10 +75,20 @@ class StepsClient:
|
|
|
80
75
|
)
|
|
81
76
|
client.runs.steps.list(
|
|
82
77
|
run_id="run_id",
|
|
78
|
+
before="before",
|
|
79
|
+
after="after",
|
|
80
|
+
limit=1,
|
|
81
|
+
order="asc",
|
|
83
82
|
)
|
|
84
83
|
"""
|
|
85
84
|
_response = self._raw_client.list(
|
|
86
|
-
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,
|
|
87
92
|
)
|
|
88
93
|
return _response.data
|
|
89
94
|
|
|
@@ -110,21 +115,12 @@ class AsyncStepsClient:
|
|
|
110
115
|
before: typing.Optional[str] = None,
|
|
111
116
|
after: typing.Optional[str] = None,
|
|
112
117
|
limit: typing.Optional[int] = None,
|
|
113
|
-
order: typing.Optional[
|
|
118
|
+
order: typing.Optional[StepsListRequestOrder] = None,
|
|
119
|
+
order_by: typing.Optional[typing.Literal["created_at"]] = None,
|
|
114
120
|
request_options: typing.Optional[RequestOptions] = None,
|
|
115
121
|
) -> typing.List[Step]:
|
|
116
122
|
"""
|
|
117
|
-
Get
|
|
118
|
-
|
|
119
|
-
Args:
|
|
120
|
-
run_id: ID of the run
|
|
121
|
-
before: A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
|
|
122
|
-
after: A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
|
|
123
|
-
limit: Maximum number of steps to return
|
|
124
|
-
order: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
|
|
125
|
-
|
|
126
|
-
Returns:
|
|
127
|
-
A list of steps associated with the run.
|
|
123
|
+
Get steps associated with a run with filtering options.
|
|
128
124
|
|
|
129
125
|
Parameters
|
|
130
126
|
----------
|
|
@@ -139,8 +135,11 @@ class AsyncStepsClient:
|
|
|
139
135
|
limit : typing.Optional[int]
|
|
140
136
|
Maximum number of messages to return
|
|
141
137
|
|
|
142
|
-
order : typing.Optional[
|
|
143
|
-
Sort order
|
|
138
|
+
order : typing.Optional[StepsListRequestOrder]
|
|
139
|
+
Sort order for steps by creation time. 'asc' for oldest first, 'desc' for newest first
|
|
140
|
+
|
|
141
|
+
order_by : typing.Optional[typing.Literal["created_at"]]
|
|
142
|
+
Field to sort by
|
|
144
143
|
|
|
145
144
|
request_options : typing.Optional[RequestOptions]
|
|
146
145
|
Request-specific configuration.
|
|
@@ -165,12 +164,22 @@ class AsyncStepsClient:
|
|
|
165
164
|
async def main() -> None:
|
|
166
165
|
await client.runs.steps.list(
|
|
167
166
|
run_id="run_id",
|
|
167
|
+
before="before",
|
|
168
|
+
after="after",
|
|
169
|
+
limit=1,
|
|
170
|
+
order="asc",
|
|
168
171
|
)
|
|
169
172
|
|
|
170
173
|
|
|
171
174
|
asyncio.run(main())
|
|
172
175
|
"""
|
|
173
176
|
_response = await self._raw_client.list(
|
|
174
|
-
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,
|
|
175
184
|
)
|
|
176
185
|
return _response.data
|
|
@@ -12,6 +12,7 @@ from ...core.unchecked_base_model import construct_type
|
|
|
12
12
|
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
13
13
|
from ...types.http_validation_error import HttpValidationError
|
|
14
14
|
from ...types.step import Step
|
|
15
|
+
from .types.steps_list_request_order import StepsListRequestOrder
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class RawStepsClient:
|
|
@@ -25,21 +26,12 @@ class RawStepsClient:
|
|
|
25
26
|
before: typing.Optional[str] = None,
|
|
26
27
|
after: typing.Optional[str] = None,
|
|
27
28
|
limit: typing.Optional[int] = None,
|
|
28
|
-
order: typing.Optional[
|
|
29
|
+
order: typing.Optional[StepsListRequestOrder] = None,
|
|
30
|
+
order_by: typing.Optional[typing.Literal["created_at"]] = None,
|
|
29
31
|
request_options: typing.Optional[RequestOptions] = None,
|
|
30
32
|
) -> HttpResponse[typing.List[Step]]:
|
|
31
33
|
"""
|
|
32
|
-
Get
|
|
33
|
-
|
|
34
|
-
Args:
|
|
35
|
-
run_id: ID of the run
|
|
36
|
-
before: A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
|
|
37
|
-
after: A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
|
|
38
|
-
limit: Maximum number of steps to return
|
|
39
|
-
order: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
|
|
40
|
-
|
|
41
|
-
Returns:
|
|
42
|
-
A list of steps associated with the run.
|
|
34
|
+
Get steps associated with a run with filtering options.
|
|
43
35
|
|
|
44
36
|
Parameters
|
|
45
37
|
----------
|
|
@@ -54,8 +46,11 @@ class RawStepsClient:
|
|
|
54
46
|
limit : typing.Optional[int]
|
|
55
47
|
Maximum number of messages to return
|
|
56
48
|
|
|
57
|
-
order : typing.Optional[
|
|
58
|
-
Sort order
|
|
49
|
+
order : typing.Optional[StepsListRequestOrder]
|
|
50
|
+
Sort order for steps by creation time. 'asc' for oldest first, 'desc' for newest first
|
|
51
|
+
|
|
52
|
+
order_by : typing.Optional[typing.Literal["created_at"]]
|
|
53
|
+
Field to sort by
|
|
59
54
|
|
|
60
55
|
request_options : typing.Optional[RequestOptions]
|
|
61
56
|
Request-specific configuration.
|
|
@@ -73,6 +68,7 @@ class RawStepsClient:
|
|
|
73
68
|
"after": after,
|
|
74
69
|
"limit": limit,
|
|
75
70
|
"order": order,
|
|
71
|
+
"order_by": order_by,
|
|
76
72
|
},
|
|
77
73
|
request_options=request_options,
|
|
78
74
|
)
|
|
@@ -114,21 +110,12 @@ class AsyncRawStepsClient:
|
|
|
114
110
|
before: typing.Optional[str] = None,
|
|
115
111
|
after: typing.Optional[str] = None,
|
|
116
112
|
limit: typing.Optional[int] = None,
|
|
117
|
-
order: typing.Optional[
|
|
113
|
+
order: typing.Optional[StepsListRequestOrder] = None,
|
|
114
|
+
order_by: typing.Optional[typing.Literal["created_at"]] = None,
|
|
118
115
|
request_options: typing.Optional[RequestOptions] = None,
|
|
119
116
|
) -> AsyncHttpResponse[typing.List[Step]]:
|
|
120
117
|
"""
|
|
121
|
-
Get
|
|
122
|
-
|
|
123
|
-
Args:
|
|
124
|
-
run_id: ID of the run
|
|
125
|
-
before: A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
|
|
126
|
-
after: A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
|
|
127
|
-
limit: Maximum number of steps to return
|
|
128
|
-
order: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
|
|
129
|
-
|
|
130
|
-
Returns:
|
|
131
|
-
A list of steps associated with the run.
|
|
118
|
+
Get steps associated with a run with filtering options.
|
|
132
119
|
|
|
133
120
|
Parameters
|
|
134
121
|
----------
|
|
@@ -143,8 +130,11 @@ class AsyncRawStepsClient:
|
|
|
143
130
|
limit : typing.Optional[int]
|
|
144
131
|
Maximum number of messages to return
|
|
145
132
|
|
|
146
|
-
order : typing.Optional[
|
|
147
|
-
Sort order
|
|
133
|
+
order : typing.Optional[StepsListRequestOrder]
|
|
134
|
+
Sort order for steps by creation time. 'asc' for oldest first, 'desc' for newest first
|
|
135
|
+
|
|
136
|
+
order_by : typing.Optional[typing.Literal["created_at"]]
|
|
137
|
+
Field to sort by
|
|
148
138
|
|
|
149
139
|
request_options : typing.Optional[RequestOptions]
|
|
150
140
|
Request-specific configuration.
|
|
@@ -162,6 +152,7 @@ class AsyncRawStepsClient:
|
|
|
162
152
|
"after": after,
|
|
163
153
|
"limit": limit,
|
|
164
154
|
"order": order,
|
|
155
|
+
"order_by": order_by,
|
|
165
156
|
},
|
|
166
157
|
request_options=request_options,
|
|
167
158
|
)
|
letta_client/sources/client.py
CHANGED
|
@@ -255,7 +255,9 @@ class SourcesClient:
|
|
|
255
255
|
project="YOUR_PROJECT",
|
|
256
256
|
token="YOUR_TOKEN",
|
|
257
257
|
)
|
|
258
|
-
client.sources.get_sources_metadata(
|
|
258
|
+
client.sources.get_sources_metadata(
|
|
259
|
+
include_detailed_per_source_metadata=True,
|
|
260
|
+
)
|
|
259
261
|
"""
|
|
260
262
|
_response = self._raw_client.get_sources_metadata(
|
|
261
263
|
include_detailed_per_source_metadata=include_detailed_per_source_metadata, request_options=request_options
|
|
@@ -431,6 +433,7 @@ class SourcesClient:
|
|
|
431
433
|
client.sources.get_file_metadata(
|
|
432
434
|
source_id="source_id",
|
|
433
435
|
file_id="file_id",
|
|
436
|
+
include_content=True,
|
|
434
437
|
)
|
|
435
438
|
"""
|
|
436
439
|
_response = self._raw_client.get_file_metadata(
|
|
@@ -725,7 +728,9 @@ class AsyncSourcesClient:
|
|
|
725
728
|
|
|
726
729
|
|
|
727
730
|
async def main() -> None:
|
|
728
|
-
await client.sources.get_sources_metadata(
|
|
731
|
+
await client.sources.get_sources_metadata(
|
|
732
|
+
include_detailed_per_source_metadata=True,
|
|
733
|
+
)
|
|
729
734
|
|
|
730
735
|
|
|
731
736
|
asyncio.run(main())
|
|
@@ -933,6 +938,7 @@ class AsyncSourcesClient:
|
|
|
933
938
|
await client.sources.get_file_metadata(
|
|
934
939
|
source_id="source_id",
|
|
935
940
|
file_id="file_id",
|
|
941
|
+
include_content=True,
|
|
936
942
|
)
|
|
937
943
|
|
|
938
944
|
|
|
@@ -71,6 +71,8 @@ class FilesClient:
|
|
|
71
71
|
)
|
|
72
72
|
client.sources.files.upload(
|
|
73
73
|
source_id="source_id",
|
|
74
|
+
duplicate_handling="skip",
|
|
75
|
+
name="name",
|
|
74
76
|
)
|
|
75
77
|
"""
|
|
76
78
|
_response = self._raw_client.upload(
|
|
@@ -125,6 +127,10 @@ class FilesClient:
|
|
|
125
127
|
)
|
|
126
128
|
client.sources.files.list(
|
|
127
129
|
source_id="source_id",
|
|
130
|
+
limit=1,
|
|
131
|
+
after="after",
|
|
132
|
+
include_content=True,
|
|
133
|
+
check_status_updates=True,
|
|
128
134
|
)
|
|
129
135
|
"""
|
|
130
136
|
_response = self._raw_client.list(
|
|
@@ -234,6 +240,8 @@ class AsyncFilesClient:
|
|
|
234
240
|
async def main() -> None:
|
|
235
241
|
await client.sources.files.upload(
|
|
236
242
|
source_id="source_id",
|
|
243
|
+
duplicate_handling="skip",
|
|
244
|
+
name="name",
|
|
237
245
|
)
|
|
238
246
|
|
|
239
247
|
|
|
@@ -296,6 +304,10 @@ class AsyncFilesClient:
|
|
|
296
304
|
async def main() -> None:
|
|
297
305
|
await client.sources.files.list(
|
|
298
306
|
source_id="source_id",
|
|
307
|
+
limit=1,
|
|
308
|
+
after="after",
|
|
309
|
+
include_content=True,
|
|
310
|
+
check_status_updates=True,
|
|
299
311
|
)
|
|
300
312
|
|
|
301
313
|
|
|
@@ -66,6 +66,9 @@ class PassagesClient:
|
|
|
66
66
|
)
|
|
67
67
|
client.sources.passages.list(
|
|
68
68
|
source_id="source_id",
|
|
69
|
+
after="after",
|
|
70
|
+
before="before",
|
|
71
|
+
limit=1,
|
|
69
72
|
)
|
|
70
73
|
"""
|
|
71
74
|
_response = self._raw_client.list(
|
|
@@ -137,6 +140,9 @@ class AsyncPassagesClient:
|
|
|
137
140
|
async def main() -> None:
|
|
138
141
|
await client.sources.passages.list(
|
|
139
142
|
source_id="source_id",
|
|
143
|
+
after="after",
|
|
144
|
+
before="before",
|
|
145
|
+
limit=1,
|
|
140
146
|
)
|
|
141
147
|
|
|
142
148
|
|
letta_client/steps/client.py
CHANGED
|
@@ -118,7 +118,19 @@ class StepsClient:
|
|
|
118
118
|
project="YOUR_PROJECT",
|
|
119
119
|
token="YOUR_TOKEN",
|
|
120
120
|
)
|
|
121
|
-
client.steps.list(
|
|
121
|
+
client.steps.list(
|
|
122
|
+
before="before",
|
|
123
|
+
after="after",
|
|
124
|
+
limit=1,
|
|
125
|
+
order="asc",
|
|
126
|
+
start_date="start_date",
|
|
127
|
+
end_date="end_date",
|
|
128
|
+
model="model",
|
|
129
|
+
agent_id="agent_id",
|
|
130
|
+
feedback="positive",
|
|
131
|
+
has_feedback=True,
|
|
132
|
+
project_id="project_id",
|
|
133
|
+
)
|
|
122
134
|
"""
|
|
123
135
|
_response = self._raw_client.list(
|
|
124
136
|
before=before,
|
|
@@ -280,7 +292,19 @@ class AsyncStepsClient:
|
|
|
280
292
|
|
|
281
293
|
|
|
282
294
|
async def main() -> None:
|
|
283
|
-
await client.steps.list(
|
|
295
|
+
await client.steps.list(
|
|
296
|
+
before="before",
|
|
297
|
+
after="after",
|
|
298
|
+
limit=1,
|
|
299
|
+
order="asc",
|
|
300
|
+
start_date="start_date",
|
|
301
|
+
end_date="end_date",
|
|
302
|
+
model="model",
|
|
303
|
+
agent_id="agent_id",
|
|
304
|
+
feedback="positive",
|
|
305
|
+
has_feedback=True,
|
|
306
|
+
project_id="project_id",
|
|
307
|
+
)
|
|
284
308
|
|
|
285
309
|
|
|
286
310
|
asyncio.run(main())
|