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
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..core.api_error import ApiError
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
+
from ..core.request_options import RequestOptions
|
|
10
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
11
|
+
from ..core.unchecked_base_model import construct_type
|
|
12
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
13
|
+
from ..types.chat_completion import ChatCompletion
|
|
14
|
+
from ..types.http_validation_error import HttpValidationError
|
|
15
|
+
from .types.chat_completion_request_messages_item import ChatCompletionRequestMessagesItem
|
|
16
|
+
from .types.chat_completion_request_stop import ChatCompletionRequestStop
|
|
17
|
+
|
|
18
|
+
# this is used as the default value for optional parameters
|
|
19
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class RawChatClient:
|
|
23
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
24
|
+
self._client_wrapper = client_wrapper
|
|
25
|
+
|
|
26
|
+
def create_chat_completion(
|
|
27
|
+
self,
|
|
28
|
+
*,
|
|
29
|
+
model: str,
|
|
30
|
+
messages: typing.Sequence[ChatCompletionRequestMessagesItem],
|
|
31
|
+
temperature: typing.Optional[float] = OMIT,
|
|
32
|
+
top_p: typing.Optional[float] = OMIT,
|
|
33
|
+
n: typing.Optional[int] = OMIT,
|
|
34
|
+
stream: typing.Optional[bool] = OMIT,
|
|
35
|
+
stop: typing.Optional[ChatCompletionRequestStop] = OMIT,
|
|
36
|
+
max_tokens: typing.Optional[int] = OMIT,
|
|
37
|
+
presence_penalty: typing.Optional[float] = OMIT,
|
|
38
|
+
frequency_penalty: typing.Optional[float] = OMIT,
|
|
39
|
+
user: typing.Optional[str] = OMIT,
|
|
40
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
41
|
+
) -> HttpResponse[ChatCompletion]:
|
|
42
|
+
"""
|
|
43
|
+
Create a chat completion using a Letta agent (OpenAI-compatible).
|
|
44
|
+
|
|
45
|
+
This endpoint provides full OpenAI API compatibility. The agent is selected based on:
|
|
46
|
+
- The 'model' parameter in the request (should contain an agent ID in format 'agent-...')
|
|
47
|
+
|
|
48
|
+
When streaming is enabled (stream=true), the response will be Server-Sent Events
|
|
49
|
+
with ChatCompletionChunk objects.
|
|
50
|
+
|
|
51
|
+
Parameters
|
|
52
|
+
----------
|
|
53
|
+
model : str
|
|
54
|
+
ID of the model to use
|
|
55
|
+
|
|
56
|
+
messages : typing.Sequence[ChatCompletionRequestMessagesItem]
|
|
57
|
+
Messages comprising the conversation so far
|
|
58
|
+
|
|
59
|
+
temperature : typing.Optional[float]
|
|
60
|
+
Sampling temperature
|
|
61
|
+
|
|
62
|
+
top_p : typing.Optional[float]
|
|
63
|
+
Nucleus sampling parameter
|
|
64
|
+
|
|
65
|
+
n : typing.Optional[int]
|
|
66
|
+
Number of chat completion choices to generate
|
|
67
|
+
|
|
68
|
+
stream : typing.Optional[bool]
|
|
69
|
+
Whether to stream back partial progress
|
|
70
|
+
|
|
71
|
+
stop : typing.Optional[ChatCompletionRequestStop]
|
|
72
|
+
Sequences where the API will stop generating
|
|
73
|
+
|
|
74
|
+
max_tokens : typing.Optional[int]
|
|
75
|
+
Maximum number of tokens to generate
|
|
76
|
+
|
|
77
|
+
presence_penalty : typing.Optional[float]
|
|
78
|
+
Presence penalty
|
|
79
|
+
|
|
80
|
+
frequency_penalty : typing.Optional[float]
|
|
81
|
+
Frequency penalty
|
|
82
|
+
|
|
83
|
+
user : typing.Optional[str]
|
|
84
|
+
A unique identifier representing your end-user
|
|
85
|
+
|
|
86
|
+
request_options : typing.Optional[RequestOptions]
|
|
87
|
+
Request-specific configuration.
|
|
88
|
+
|
|
89
|
+
Returns
|
|
90
|
+
-------
|
|
91
|
+
HttpResponse[ChatCompletion]
|
|
92
|
+
Successful response
|
|
93
|
+
"""
|
|
94
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
95
|
+
"v1/chat/completions",
|
|
96
|
+
method="POST",
|
|
97
|
+
json={
|
|
98
|
+
"model": model,
|
|
99
|
+
"messages": convert_and_respect_annotation_metadata(
|
|
100
|
+
object_=messages, annotation=typing.Sequence[ChatCompletionRequestMessagesItem], direction="write"
|
|
101
|
+
),
|
|
102
|
+
"temperature": temperature,
|
|
103
|
+
"top_p": top_p,
|
|
104
|
+
"n": n,
|
|
105
|
+
"stream": stream,
|
|
106
|
+
"stop": convert_and_respect_annotation_metadata(
|
|
107
|
+
object_=stop, annotation=ChatCompletionRequestStop, direction="write"
|
|
108
|
+
),
|
|
109
|
+
"max_tokens": max_tokens,
|
|
110
|
+
"presence_penalty": presence_penalty,
|
|
111
|
+
"frequency_penalty": frequency_penalty,
|
|
112
|
+
"user": user,
|
|
113
|
+
},
|
|
114
|
+
headers={
|
|
115
|
+
"content-type": "application/json",
|
|
116
|
+
},
|
|
117
|
+
request_options=request_options,
|
|
118
|
+
omit=OMIT,
|
|
119
|
+
)
|
|
120
|
+
try:
|
|
121
|
+
if 200 <= _response.status_code < 300:
|
|
122
|
+
_data = typing.cast(
|
|
123
|
+
ChatCompletion,
|
|
124
|
+
construct_type(
|
|
125
|
+
type_=ChatCompletion, # type: ignore
|
|
126
|
+
object_=_response.json(),
|
|
127
|
+
),
|
|
128
|
+
)
|
|
129
|
+
return HttpResponse(response=_response, data=_data)
|
|
130
|
+
if _response.status_code == 422:
|
|
131
|
+
raise UnprocessableEntityError(
|
|
132
|
+
headers=dict(_response.headers),
|
|
133
|
+
body=typing.cast(
|
|
134
|
+
HttpValidationError,
|
|
135
|
+
construct_type(
|
|
136
|
+
type_=HttpValidationError, # type: ignore
|
|
137
|
+
object_=_response.json(),
|
|
138
|
+
),
|
|
139
|
+
),
|
|
140
|
+
)
|
|
141
|
+
_response_json = _response.json()
|
|
142
|
+
except JSONDecodeError:
|
|
143
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
144
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class AsyncRawChatClient:
|
|
148
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
149
|
+
self._client_wrapper = client_wrapper
|
|
150
|
+
|
|
151
|
+
async def create_chat_completion(
|
|
152
|
+
self,
|
|
153
|
+
*,
|
|
154
|
+
model: str,
|
|
155
|
+
messages: typing.Sequence[ChatCompletionRequestMessagesItem],
|
|
156
|
+
temperature: typing.Optional[float] = OMIT,
|
|
157
|
+
top_p: typing.Optional[float] = OMIT,
|
|
158
|
+
n: typing.Optional[int] = OMIT,
|
|
159
|
+
stream: typing.Optional[bool] = OMIT,
|
|
160
|
+
stop: typing.Optional[ChatCompletionRequestStop] = OMIT,
|
|
161
|
+
max_tokens: typing.Optional[int] = OMIT,
|
|
162
|
+
presence_penalty: typing.Optional[float] = OMIT,
|
|
163
|
+
frequency_penalty: typing.Optional[float] = OMIT,
|
|
164
|
+
user: typing.Optional[str] = OMIT,
|
|
165
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
166
|
+
) -> AsyncHttpResponse[ChatCompletion]:
|
|
167
|
+
"""
|
|
168
|
+
Create a chat completion using a Letta agent (OpenAI-compatible).
|
|
169
|
+
|
|
170
|
+
This endpoint provides full OpenAI API compatibility. The agent is selected based on:
|
|
171
|
+
- The 'model' parameter in the request (should contain an agent ID in format 'agent-...')
|
|
172
|
+
|
|
173
|
+
When streaming is enabled (stream=true), the response will be Server-Sent Events
|
|
174
|
+
with ChatCompletionChunk objects.
|
|
175
|
+
|
|
176
|
+
Parameters
|
|
177
|
+
----------
|
|
178
|
+
model : str
|
|
179
|
+
ID of the model to use
|
|
180
|
+
|
|
181
|
+
messages : typing.Sequence[ChatCompletionRequestMessagesItem]
|
|
182
|
+
Messages comprising the conversation so far
|
|
183
|
+
|
|
184
|
+
temperature : typing.Optional[float]
|
|
185
|
+
Sampling temperature
|
|
186
|
+
|
|
187
|
+
top_p : typing.Optional[float]
|
|
188
|
+
Nucleus sampling parameter
|
|
189
|
+
|
|
190
|
+
n : typing.Optional[int]
|
|
191
|
+
Number of chat completion choices to generate
|
|
192
|
+
|
|
193
|
+
stream : typing.Optional[bool]
|
|
194
|
+
Whether to stream back partial progress
|
|
195
|
+
|
|
196
|
+
stop : typing.Optional[ChatCompletionRequestStop]
|
|
197
|
+
Sequences where the API will stop generating
|
|
198
|
+
|
|
199
|
+
max_tokens : typing.Optional[int]
|
|
200
|
+
Maximum number of tokens to generate
|
|
201
|
+
|
|
202
|
+
presence_penalty : typing.Optional[float]
|
|
203
|
+
Presence penalty
|
|
204
|
+
|
|
205
|
+
frequency_penalty : typing.Optional[float]
|
|
206
|
+
Frequency penalty
|
|
207
|
+
|
|
208
|
+
user : typing.Optional[str]
|
|
209
|
+
A unique identifier representing your end-user
|
|
210
|
+
|
|
211
|
+
request_options : typing.Optional[RequestOptions]
|
|
212
|
+
Request-specific configuration.
|
|
213
|
+
|
|
214
|
+
Returns
|
|
215
|
+
-------
|
|
216
|
+
AsyncHttpResponse[ChatCompletion]
|
|
217
|
+
Successful response
|
|
218
|
+
"""
|
|
219
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
220
|
+
"v1/chat/completions",
|
|
221
|
+
method="POST",
|
|
222
|
+
json={
|
|
223
|
+
"model": model,
|
|
224
|
+
"messages": convert_and_respect_annotation_metadata(
|
|
225
|
+
object_=messages, annotation=typing.Sequence[ChatCompletionRequestMessagesItem], direction="write"
|
|
226
|
+
),
|
|
227
|
+
"temperature": temperature,
|
|
228
|
+
"top_p": top_p,
|
|
229
|
+
"n": n,
|
|
230
|
+
"stream": stream,
|
|
231
|
+
"stop": convert_and_respect_annotation_metadata(
|
|
232
|
+
object_=stop, annotation=ChatCompletionRequestStop, direction="write"
|
|
233
|
+
),
|
|
234
|
+
"max_tokens": max_tokens,
|
|
235
|
+
"presence_penalty": presence_penalty,
|
|
236
|
+
"frequency_penalty": frequency_penalty,
|
|
237
|
+
"user": user,
|
|
238
|
+
},
|
|
239
|
+
headers={
|
|
240
|
+
"content-type": "application/json",
|
|
241
|
+
},
|
|
242
|
+
request_options=request_options,
|
|
243
|
+
omit=OMIT,
|
|
244
|
+
)
|
|
245
|
+
try:
|
|
246
|
+
if 200 <= _response.status_code < 300:
|
|
247
|
+
_data = typing.cast(
|
|
248
|
+
ChatCompletion,
|
|
249
|
+
construct_type(
|
|
250
|
+
type_=ChatCompletion, # type: ignore
|
|
251
|
+
object_=_response.json(),
|
|
252
|
+
),
|
|
253
|
+
)
|
|
254
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
255
|
+
if _response.status_code == 422:
|
|
256
|
+
raise UnprocessableEntityError(
|
|
257
|
+
headers=dict(_response.headers),
|
|
258
|
+
body=typing.cast(
|
|
259
|
+
HttpValidationError,
|
|
260
|
+
construct_type(
|
|
261
|
+
type_=HttpValidationError, # type: ignore
|
|
262
|
+
object_=_response.json(),
|
|
263
|
+
),
|
|
264
|
+
),
|
|
265
|
+
)
|
|
266
|
+
_response_json = _response.json()
|
|
267
|
+
except JSONDecodeError:
|
|
268
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
269
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
from .chat_completion_request_messages_item import ChatCompletionRequestMessagesItem
|
|
6
|
+
from .chat_completion_request_stop import ChatCompletionRequestStop
|
|
7
|
+
|
|
8
|
+
__all__ = ["ChatCompletionRequestMessagesItem", "ChatCompletionRequestStop"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ...types.chat_completion_assistant_message_param import ChatCompletionAssistantMessageParam
|
|
6
|
+
from ...types.chat_completion_developer_message_param import ChatCompletionDeveloperMessageParam
|
|
7
|
+
from ...types.chat_completion_function_message_param import ChatCompletionFunctionMessageParam
|
|
8
|
+
from ...types.chat_completion_system_message_param import ChatCompletionSystemMessageParam
|
|
9
|
+
from ...types.chat_completion_tool_message_param import ChatCompletionToolMessageParam
|
|
10
|
+
from ...types.chat_completion_user_message_param import ChatCompletionUserMessageParam
|
|
11
|
+
|
|
12
|
+
ChatCompletionRequestMessagesItem = typing.Union[
|
|
13
|
+
ChatCompletionDeveloperMessageParam,
|
|
14
|
+
ChatCompletionSystemMessageParam,
|
|
15
|
+
ChatCompletionUserMessageParam,
|
|
16
|
+
ChatCompletionAssistantMessageParam,
|
|
17
|
+
ChatCompletionToolMessageParam,
|
|
18
|
+
ChatCompletionFunctionMessageParam,
|
|
19
|
+
]
|
|
@@ -68,7 +68,11 @@ class ClientSideAccessTokensClient:
|
|
|
68
68
|
project="YOUR_PROJECT",
|
|
69
69
|
token="YOUR_TOKEN",
|
|
70
70
|
)
|
|
71
|
-
client.client_side_access_tokens.client_side_access_tokens_list_client_side_access_tokens(
|
|
71
|
+
client.client_side_access_tokens.client_side_access_tokens_list_client_side_access_tokens(
|
|
72
|
+
agent_id="agentId",
|
|
73
|
+
offset=1.1,
|
|
74
|
+
limit=1.1,
|
|
75
|
+
)
|
|
72
76
|
"""
|
|
73
77
|
_response = self._raw_client.client_side_access_tokens_list_client_side_access_tokens(
|
|
74
78
|
agent_id=agent_id, offset=offset, limit=limit, request_options=request_options
|
|
@@ -230,7 +234,11 @@ class AsyncClientSideAccessTokensClient:
|
|
|
230
234
|
|
|
231
235
|
|
|
232
236
|
async def main() -> None:
|
|
233
|
-
await client.client_side_access_tokens.client_side_access_tokens_list_client_side_access_tokens(
|
|
237
|
+
await client.client_side_access_tokens.client_side_access_tokens_list_client_side_access_tokens(
|
|
238
|
+
agent_id="agentId",
|
|
239
|
+
offset=1.1,
|
|
240
|
+
limit=1.1,
|
|
241
|
+
)
|
|
234
242
|
|
|
235
243
|
|
|
236
244
|
asyncio.run(main())
|
|
@@ -24,10 +24,10 @@ class BaseClientWrapper:
|
|
|
24
24
|
|
|
25
25
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
26
26
|
headers: typing.Dict[str, str] = {
|
|
27
|
-
"User-Agent": "letta-client/1.0.
|
|
27
|
+
"User-Agent": "letta-client/1.0.0a3",
|
|
28
28
|
"X-Fern-Language": "Python",
|
|
29
29
|
"X-Fern-SDK-Name": "letta-client",
|
|
30
|
-
"X-Fern-SDK-Version": "1.0.
|
|
30
|
+
"X-Fern-SDK-Version": "1.0.0a3",
|
|
31
31
|
**(self.get_custom_headers() or {}),
|
|
32
32
|
}
|
|
33
33
|
if self._project is not None:
|
letta_client/errors/__init__.py
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
from .bad_request_error import BadRequestError
|
|
6
6
|
from .conflict_error import ConflictError
|
|
7
|
+
from .gone_error import GoneError
|
|
7
8
|
from .internal_server_error import InternalServerError
|
|
8
9
|
from .not_found_error import NotFoundError
|
|
9
10
|
from .payment_required_error import PaymentRequiredError
|
|
@@ -12,6 +13,7 @@ from .unprocessable_entity_error import UnprocessableEntityError
|
|
|
12
13
|
__all__ = [
|
|
13
14
|
"BadRequestError",
|
|
14
15
|
"ConflictError",
|
|
16
|
+
"GoneError",
|
|
15
17
|
"InternalServerError",
|
|
16
18
|
"NotFoundError",
|
|
17
19
|
"PaymentRequiredError",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.api_error import ApiError
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class GoneError(ApiError):
|
|
9
|
+
def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
|
+
super().__init__(status_code=410, headers=headers, body=body)
|
|
@@ -74,6 +74,10 @@ class AgentsClient:
|
|
|
74
74
|
)
|
|
75
75
|
client.folders.agents.list(
|
|
76
76
|
folder_id="folder_id",
|
|
77
|
+
before="before",
|
|
78
|
+
after="after",
|
|
79
|
+
limit=1,
|
|
80
|
+
order="asc",
|
|
77
81
|
)
|
|
78
82
|
"""
|
|
79
83
|
_response = self._raw_client.list(
|
|
@@ -159,6 +163,10 @@ class AsyncAgentsClient:
|
|
|
159
163
|
async def main() -> None:
|
|
160
164
|
await client.folders.agents.list(
|
|
161
165
|
folder_id="folder_id",
|
|
166
|
+
before="before",
|
|
167
|
+
after="after",
|
|
168
|
+
limit=1,
|
|
169
|
+
order="asc",
|
|
162
170
|
)
|
|
163
171
|
|
|
164
172
|
|
letta_client/folders/client.py
CHANGED
|
@@ -261,7 +261,9 @@ class FoldersClient:
|
|
|
261
261
|
project="YOUR_PROJECT",
|
|
262
262
|
token="YOUR_TOKEN",
|
|
263
263
|
)
|
|
264
|
-
client.folders.retrieve_metadata(
|
|
264
|
+
client.folders.retrieve_metadata(
|
|
265
|
+
include_detailed_per_source_metadata=True,
|
|
266
|
+
)
|
|
265
267
|
"""
|
|
266
268
|
_response = self._raw_client.retrieve_metadata(
|
|
267
269
|
include_detailed_per_source_metadata=include_detailed_per_source_metadata, request_options=request_options
|
|
@@ -318,7 +320,13 @@ class FoldersClient:
|
|
|
318
320
|
project="YOUR_PROJECT",
|
|
319
321
|
token="YOUR_TOKEN",
|
|
320
322
|
)
|
|
321
|
-
client.folders.list(
|
|
323
|
+
client.folders.list(
|
|
324
|
+
before="before",
|
|
325
|
+
after="after",
|
|
326
|
+
limit=1,
|
|
327
|
+
order="asc",
|
|
328
|
+
name="name",
|
|
329
|
+
)
|
|
322
330
|
"""
|
|
323
331
|
_response = self._raw_client.list(
|
|
324
332
|
before=before,
|
|
@@ -693,7 +701,9 @@ class AsyncFoldersClient:
|
|
|
693
701
|
|
|
694
702
|
|
|
695
703
|
async def main() -> None:
|
|
696
|
-
await client.folders.retrieve_metadata(
|
|
704
|
+
await client.folders.retrieve_metadata(
|
|
705
|
+
include_detailed_per_source_metadata=True,
|
|
706
|
+
)
|
|
697
707
|
|
|
698
708
|
|
|
699
709
|
asyncio.run(main())
|
|
@@ -758,7 +768,13 @@ class AsyncFoldersClient:
|
|
|
758
768
|
|
|
759
769
|
|
|
760
770
|
async def main() -> None:
|
|
761
|
-
await client.folders.list(
|
|
771
|
+
await client.folders.list(
|
|
772
|
+
before="before",
|
|
773
|
+
after="after",
|
|
774
|
+
limit=1,
|
|
775
|
+
order="asc",
|
|
776
|
+
name="name",
|
|
777
|
+
)
|
|
762
778
|
|
|
763
779
|
|
|
764
780
|
asyncio.run(main())
|
|
@@ -72,6 +72,8 @@ class FilesClient:
|
|
|
72
72
|
)
|
|
73
73
|
client.folders.files.upload(
|
|
74
74
|
folder_id="folder_id",
|
|
75
|
+
duplicate_handling="skip",
|
|
76
|
+
name="name",
|
|
75
77
|
)
|
|
76
78
|
"""
|
|
77
79
|
_response = self._raw_client.upload(
|
|
@@ -134,6 +136,11 @@ class FilesClient:
|
|
|
134
136
|
)
|
|
135
137
|
client.folders.files.list(
|
|
136
138
|
folder_id="folder_id",
|
|
139
|
+
before="before",
|
|
140
|
+
after="after",
|
|
141
|
+
limit=1,
|
|
142
|
+
order="asc",
|
|
143
|
+
include_content=True,
|
|
137
144
|
)
|
|
138
145
|
"""
|
|
139
146
|
_response = self._raw_client.list(
|
|
@@ -245,6 +252,8 @@ class AsyncFilesClient:
|
|
|
245
252
|
async def main() -> None:
|
|
246
253
|
await client.folders.files.upload(
|
|
247
254
|
folder_id="folder_id",
|
|
255
|
+
duplicate_handling="skip",
|
|
256
|
+
name="name",
|
|
248
257
|
)
|
|
249
258
|
|
|
250
259
|
|
|
@@ -315,6 +324,11 @@ class AsyncFilesClient:
|
|
|
315
324
|
async def main() -> None:
|
|
316
325
|
await client.folders.files.list(
|
|
317
326
|
folder_id="folder_id",
|
|
327
|
+
before="before",
|
|
328
|
+
after="after",
|
|
329
|
+
limit=1,
|
|
330
|
+
order="asc",
|
|
331
|
+
include_content=True,
|
|
318
332
|
)
|
|
319
333
|
|
|
320
334
|
|
|
@@ -75,6 +75,10 @@ class PassagesClient:
|
|
|
75
75
|
)
|
|
76
76
|
client.folders.passages.list(
|
|
77
77
|
folder_id="folder_id",
|
|
78
|
+
before="before",
|
|
79
|
+
after="after",
|
|
80
|
+
limit=1,
|
|
81
|
+
order="asc",
|
|
78
82
|
)
|
|
79
83
|
"""
|
|
80
84
|
_response = self._raw_client.list(
|
|
@@ -160,6 +164,10 @@ class AsyncPassagesClient:
|
|
|
160
164
|
async def main() -> None:
|
|
161
165
|
await client.folders.passages.list(
|
|
162
166
|
folder_id="folder_id",
|
|
167
|
+
before="before",
|
|
168
|
+
after="after",
|
|
169
|
+
limit=1,
|
|
170
|
+
order="asc",
|
|
163
171
|
)
|
|
164
172
|
|
|
165
173
|
|
letta_client/groups/client.py
CHANGED
|
@@ -86,7 +86,14 @@ class GroupsClient:
|
|
|
86
86
|
project="YOUR_PROJECT",
|
|
87
87
|
token="YOUR_TOKEN",
|
|
88
88
|
)
|
|
89
|
-
client.groups.list(
|
|
89
|
+
client.groups.list(
|
|
90
|
+
manager_type="round_robin",
|
|
91
|
+
before="before",
|
|
92
|
+
after="after",
|
|
93
|
+
limit=1,
|
|
94
|
+
order="asc",
|
|
95
|
+
project_id="project_id",
|
|
96
|
+
)
|
|
90
97
|
"""
|
|
91
98
|
_response = self._raw_client.list(
|
|
92
99
|
manager_type=manager_type,
|
|
@@ -397,7 +404,14 @@ class AsyncGroupsClient:
|
|
|
397
404
|
|
|
398
405
|
|
|
399
406
|
async def main() -> None:
|
|
400
|
-
await client.groups.list(
|
|
407
|
+
await client.groups.list(
|
|
408
|
+
manager_type="round_robin",
|
|
409
|
+
before="before",
|
|
410
|
+
after="after",
|
|
411
|
+
limit=1,
|
|
412
|
+
order="asc",
|
|
413
|
+
project_id="project_id",
|
|
414
|
+
)
|
|
401
415
|
|
|
402
416
|
|
|
403
417
|
asyncio.run(main())
|
|
@@ -97,6 +97,13 @@ class MessagesClient:
|
|
|
97
97
|
)
|
|
98
98
|
client.groups.messages.list(
|
|
99
99
|
group_id="group_id",
|
|
100
|
+
before="before",
|
|
101
|
+
after="after",
|
|
102
|
+
limit=1,
|
|
103
|
+
order="asc",
|
|
104
|
+
use_assistant_message=True,
|
|
105
|
+
assistant_message_tool_name="assistant_message_tool_name",
|
|
106
|
+
assistant_message_tool_kwarg="assistant_message_tool_kwarg",
|
|
100
107
|
)
|
|
101
108
|
"""
|
|
102
109
|
_response = self._raw_client.list(
|
|
@@ -464,6 +471,13 @@ class AsyncMessagesClient:
|
|
|
464
471
|
async def main() -> None:
|
|
465
472
|
await client.groups.messages.list(
|
|
466
473
|
group_id="group_id",
|
|
474
|
+
before="before",
|
|
475
|
+
after="after",
|
|
476
|
+
limit=1,
|
|
477
|
+
order="asc",
|
|
478
|
+
use_assistant_message=True,
|
|
479
|
+
assistant_message_tool_name="assistant_message_tool_name",
|
|
480
|
+
assistant_message_tool_kwarg="assistant_message_tool_kwarg",
|
|
467
481
|
)
|
|
468
482
|
|
|
469
483
|
|
|
@@ -75,6 +75,10 @@ class AgentsClient:
|
|
|
75
75
|
)
|
|
76
76
|
client.identities.agents.list(
|
|
77
77
|
identity_id="identity_id",
|
|
78
|
+
before="before",
|
|
79
|
+
after="after",
|
|
80
|
+
limit=1,
|
|
81
|
+
order="asc",
|
|
78
82
|
)
|
|
79
83
|
"""
|
|
80
84
|
_response = self._raw_client.list(
|
|
@@ -160,6 +164,10 @@ class AsyncAgentsClient:
|
|
|
160
164
|
async def main() -> None:
|
|
161
165
|
await client.identities.agents.list(
|
|
162
166
|
identity_id="identity_id",
|
|
167
|
+
before="before",
|
|
168
|
+
after="after",
|
|
169
|
+
limit=1,
|
|
170
|
+
order="asc",
|
|
163
171
|
)
|
|
164
172
|
|
|
165
173
|
|
|
@@ -75,6 +75,10 @@ class BlocksClient:
|
|
|
75
75
|
)
|
|
76
76
|
client.identities.blocks.list(
|
|
77
77
|
identity_id="identity_id",
|
|
78
|
+
before="before",
|
|
79
|
+
after="after",
|
|
80
|
+
limit=1,
|
|
81
|
+
order="asc",
|
|
78
82
|
)
|
|
79
83
|
"""
|
|
80
84
|
_response = self._raw_client.list(
|
|
@@ -160,6 +164,10 @@ class AsyncBlocksClient:
|
|
|
160
164
|
async def main() -> None:
|
|
161
165
|
await client.identities.blocks.list(
|
|
162
166
|
identity_id="identity_id",
|
|
167
|
+
before="before",
|
|
168
|
+
after="after",
|
|
169
|
+
limit=1,
|
|
170
|
+
order="asc",
|
|
163
171
|
)
|
|
164
172
|
|
|
165
173
|
|
|
@@ -95,7 +95,16 @@ class IdentitiesClient:
|
|
|
95
95
|
project="YOUR_PROJECT",
|
|
96
96
|
token="YOUR_TOKEN",
|
|
97
97
|
)
|
|
98
|
-
client.identities.list(
|
|
98
|
+
client.identities.list(
|
|
99
|
+
name="name",
|
|
100
|
+
project_id="project_id",
|
|
101
|
+
identifier_key="identifier_key",
|
|
102
|
+
identity_type="org",
|
|
103
|
+
before="before",
|
|
104
|
+
after="after",
|
|
105
|
+
limit=1,
|
|
106
|
+
order="asc",
|
|
107
|
+
)
|
|
99
108
|
"""
|
|
100
109
|
_response = self._raw_client.list(
|
|
101
110
|
name=name,
|
|
@@ -491,7 +500,16 @@ class AsyncIdentitiesClient:
|
|
|
491
500
|
|
|
492
501
|
|
|
493
502
|
async def main() -> None:
|
|
494
|
-
await client.identities.list(
|
|
503
|
+
await client.identities.list(
|
|
504
|
+
name="name",
|
|
505
|
+
project_id="project_id",
|
|
506
|
+
identifier_key="identifier_key",
|
|
507
|
+
identity_type="org",
|
|
508
|
+
before="before",
|
|
509
|
+
after="after",
|
|
510
|
+
limit=1,
|
|
511
|
+
order="asc",
|
|
512
|
+
)
|
|
495
513
|
|
|
496
514
|
|
|
497
515
|
asyncio.run(main())
|