letta-client 0.1.294__py3-none-any.whl → 0.1.299__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 +16 -0
- letta_client/agents/__init__.py +2 -0
- letta_client/agents/client.py +100 -0
- letta_client/agents/messages/__init__.py +2 -0
- letta_client/agents/messages/client.py +17 -15
- letta_client/agents/messages/raw_client.py +23 -21
- letta_client/agents/messages/types/__init__.py +2 -0
- letta_client/agents/messages/types/letta_async_request_messages_item.py +8 -0
- letta_client/agents/messages/types/messages_modify_response.py +4 -0
- letta_client/agents/raw_client.py +122 -0
- letta_client/agents/tools/client.py +74 -0
- letta_client/agents/tools/raw_client.py +60 -0
- letta_client/agents/types/create_agent_request_tool_rules_item.py +2 -0
- letta_client/agents/types/update_agent_tool_rules_item.py +2 -0
- letta_client/core/client_wrapper.py +2 -2
- letta_client/groups/messages/client.py +12 -11
- letta_client/groups/messages/raw_client.py +16 -15
- letta_client/groups/messages/types/messages_modify_response.py +4 -0
- letta_client/templates/__init__.py +2 -0
- letta_client/templates/client.py +20 -0
- letta_client/templates/raw_client.py +20 -0
- letta_client/templates/types/__init__.py +4 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item.py +4 -0
- letta_client/templates/types/templates_get_template_snapshot_response_agents_item_tool_rules_item_prompt_template.py +22 -0
- letta_client/tools/client.py +30 -0
- letta_client/tools/raw_client.py +30 -0
- letta_client/types/__init__.py +14 -0
- letta_client/types/agent_state_tool_rules_item.py +2 -0
- letta_client/types/approval_create.py +42 -0
- letta_client/types/approval_request_message.py +45 -0
- letta_client/types/approval_response_message.py +56 -0
- letta_client/types/letta_batch_request.py +2 -2
- letta_client/types/letta_batch_request_messages_item.py +8 -0
- letta_client/types/letta_message_union.py +4 -0
- letta_client/types/letta_request.py +2 -2
- letta_client/types/letta_request_messages_item.py +8 -0
- letta_client/types/letta_schemas_agent_file_agent_schema_tool_rules_item.py +2 -0
- letta_client/types/letta_schemas_agent_file_message_schema.py +5 -0
- letta_client/types/letta_schemas_agent_file_tool_schema.py +5 -0
- letta_client/types/letta_streaming_request.py +3 -3
- letta_client/types/letta_streaming_request_messages_item.py +8 -0
- letta_client/types/message_create.py +5 -0
- letta_client/types/message_role.py +1 -1
- letta_client/types/message_type.py +2 -0
- letta_client/types/passage.py +5 -0
- letta_client/types/requires_approval_tool_rule.py +33 -0
- letta_client/types/stop_reason_type.py +1 -0
- letta_client/types/tool.py +5 -0
- letta_client/types/tool_create.py +5 -0
- {letta_client-0.1.294.dist-info → letta_client-0.1.299.dist-info}/METADATA +1 -1
- {letta_client-0.1.294.dist-info → letta_client-0.1.299.dist-info}/RECORD +52 -43
- {letta_client-0.1.294.dist-info → letta_client-0.1.299.dist-info}/WHEEL +0 -0
|
@@ -981,6 +981,67 @@ class RawAgentsClient:
|
|
|
981
981
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
982
982
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
983
983
|
|
|
984
|
+
def modify_approval(
|
|
985
|
+
self,
|
|
986
|
+
agent_id: str,
|
|
987
|
+
tool_name: str,
|
|
988
|
+
*,
|
|
989
|
+
requires_approval: bool,
|
|
990
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
991
|
+
) -> HttpResponse[AgentState]:
|
|
992
|
+
"""
|
|
993
|
+
Attach a tool to an agent.
|
|
994
|
+
|
|
995
|
+
Parameters
|
|
996
|
+
----------
|
|
997
|
+
agent_id : str
|
|
998
|
+
|
|
999
|
+
tool_name : str
|
|
1000
|
+
|
|
1001
|
+
requires_approval : bool
|
|
1002
|
+
|
|
1003
|
+
request_options : typing.Optional[RequestOptions]
|
|
1004
|
+
Request-specific configuration.
|
|
1005
|
+
|
|
1006
|
+
Returns
|
|
1007
|
+
-------
|
|
1008
|
+
HttpResponse[AgentState]
|
|
1009
|
+
Successful Response
|
|
1010
|
+
"""
|
|
1011
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1012
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/tools/approval/{jsonable_encoder(tool_name)}",
|
|
1013
|
+
method="PATCH",
|
|
1014
|
+
params={
|
|
1015
|
+
"requires_approval": requires_approval,
|
|
1016
|
+
},
|
|
1017
|
+
request_options=request_options,
|
|
1018
|
+
)
|
|
1019
|
+
try:
|
|
1020
|
+
if 200 <= _response.status_code < 300:
|
|
1021
|
+
_data = typing.cast(
|
|
1022
|
+
AgentState,
|
|
1023
|
+
construct_type(
|
|
1024
|
+
type_=AgentState, # type: ignore
|
|
1025
|
+
object_=_response.json(),
|
|
1026
|
+
),
|
|
1027
|
+
)
|
|
1028
|
+
return HttpResponse(response=_response, data=_data)
|
|
1029
|
+
if _response.status_code == 422:
|
|
1030
|
+
raise UnprocessableEntityError(
|
|
1031
|
+
headers=dict(_response.headers),
|
|
1032
|
+
body=typing.cast(
|
|
1033
|
+
HttpValidationError,
|
|
1034
|
+
construct_type(
|
|
1035
|
+
type_=HttpValidationError, # type: ignore
|
|
1036
|
+
object_=_response.json(),
|
|
1037
|
+
),
|
|
1038
|
+
),
|
|
1039
|
+
)
|
|
1040
|
+
_response_json = _response.json()
|
|
1041
|
+
except JSONDecodeError:
|
|
1042
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1043
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1044
|
+
|
|
984
1045
|
def list_agent_files(
|
|
985
1046
|
self,
|
|
986
1047
|
agent_id: str,
|
|
@@ -2124,6 +2185,67 @@ class AsyncRawAgentsClient:
|
|
|
2124
2185
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2125
2186
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2126
2187
|
|
|
2188
|
+
async def modify_approval(
|
|
2189
|
+
self,
|
|
2190
|
+
agent_id: str,
|
|
2191
|
+
tool_name: str,
|
|
2192
|
+
*,
|
|
2193
|
+
requires_approval: bool,
|
|
2194
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2195
|
+
) -> AsyncHttpResponse[AgentState]:
|
|
2196
|
+
"""
|
|
2197
|
+
Attach a tool to an agent.
|
|
2198
|
+
|
|
2199
|
+
Parameters
|
|
2200
|
+
----------
|
|
2201
|
+
agent_id : str
|
|
2202
|
+
|
|
2203
|
+
tool_name : str
|
|
2204
|
+
|
|
2205
|
+
requires_approval : bool
|
|
2206
|
+
|
|
2207
|
+
request_options : typing.Optional[RequestOptions]
|
|
2208
|
+
Request-specific configuration.
|
|
2209
|
+
|
|
2210
|
+
Returns
|
|
2211
|
+
-------
|
|
2212
|
+
AsyncHttpResponse[AgentState]
|
|
2213
|
+
Successful Response
|
|
2214
|
+
"""
|
|
2215
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2216
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/tools/approval/{jsonable_encoder(tool_name)}",
|
|
2217
|
+
method="PATCH",
|
|
2218
|
+
params={
|
|
2219
|
+
"requires_approval": requires_approval,
|
|
2220
|
+
},
|
|
2221
|
+
request_options=request_options,
|
|
2222
|
+
)
|
|
2223
|
+
try:
|
|
2224
|
+
if 200 <= _response.status_code < 300:
|
|
2225
|
+
_data = typing.cast(
|
|
2226
|
+
AgentState,
|
|
2227
|
+
construct_type(
|
|
2228
|
+
type_=AgentState, # type: ignore
|
|
2229
|
+
object_=_response.json(),
|
|
2230
|
+
),
|
|
2231
|
+
)
|
|
2232
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2233
|
+
if _response.status_code == 422:
|
|
2234
|
+
raise UnprocessableEntityError(
|
|
2235
|
+
headers=dict(_response.headers),
|
|
2236
|
+
body=typing.cast(
|
|
2237
|
+
HttpValidationError,
|
|
2238
|
+
construct_type(
|
|
2239
|
+
type_=HttpValidationError, # type: ignore
|
|
2240
|
+
object_=_response.json(),
|
|
2241
|
+
),
|
|
2242
|
+
),
|
|
2243
|
+
)
|
|
2244
|
+
_response_json = _response.json()
|
|
2245
|
+
except JSONDecodeError:
|
|
2246
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2247
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2248
|
+
|
|
2127
2249
|
async def list_agent_files(
|
|
2128
2250
|
self,
|
|
2129
2251
|
agent_id: str,
|
|
@@ -127,6 +127,39 @@ class ToolsClient:
|
|
|
127
127
|
_response = self._raw_client.detach(agent_id, tool_id, request_options=request_options)
|
|
128
128
|
return _response.data
|
|
129
129
|
|
|
130
|
+
def modify_approval(
|
|
131
|
+
self, agent_id: str, tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
132
|
+
) -> None:
|
|
133
|
+
"""
|
|
134
|
+
Parameters
|
|
135
|
+
----------
|
|
136
|
+
agent_id : str
|
|
137
|
+
|
|
138
|
+
tool_id : str
|
|
139
|
+
|
|
140
|
+
request_options : typing.Optional[RequestOptions]
|
|
141
|
+
Request-specific configuration.
|
|
142
|
+
|
|
143
|
+
Returns
|
|
144
|
+
-------
|
|
145
|
+
None
|
|
146
|
+
|
|
147
|
+
Examples
|
|
148
|
+
--------
|
|
149
|
+
from letta_client import Letta
|
|
150
|
+
|
|
151
|
+
client = Letta(
|
|
152
|
+
project="YOUR_PROJECT",
|
|
153
|
+
token="YOUR_TOKEN",
|
|
154
|
+
)
|
|
155
|
+
client.agents.tools.modify_approval(
|
|
156
|
+
agent_id="agent_id",
|
|
157
|
+
tool_id="tool_id",
|
|
158
|
+
)
|
|
159
|
+
"""
|
|
160
|
+
_response = self._raw_client.modify_approval(agent_id, tool_id, request_options=request_options)
|
|
161
|
+
return _response.data
|
|
162
|
+
|
|
130
163
|
|
|
131
164
|
class AsyncToolsClient:
|
|
132
165
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -271,3 +304,44 @@ class AsyncToolsClient:
|
|
|
271
304
|
"""
|
|
272
305
|
_response = await self._raw_client.detach(agent_id, tool_id, request_options=request_options)
|
|
273
306
|
return _response.data
|
|
307
|
+
|
|
308
|
+
async def modify_approval(
|
|
309
|
+
self, agent_id: str, tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
310
|
+
) -> None:
|
|
311
|
+
"""
|
|
312
|
+
Parameters
|
|
313
|
+
----------
|
|
314
|
+
agent_id : str
|
|
315
|
+
|
|
316
|
+
tool_id : str
|
|
317
|
+
|
|
318
|
+
request_options : typing.Optional[RequestOptions]
|
|
319
|
+
Request-specific configuration.
|
|
320
|
+
|
|
321
|
+
Returns
|
|
322
|
+
-------
|
|
323
|
+
None
|
|
324
|
+
|
|
325
|
+
Examples
|
|
326
|
+
--------
|
|
327
|
+
import asyncio
|
|
328
|
+
|
|
329
|
+
from letta_client import AsyncLetta
|
|
330
|
+
|
|
331
|
+
client = AsyncLetta(
|
|
332
|
+
project="YOUR_PROJECT",
|
|
333
|
+
token="YOUR_TOKEN",
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
async def main() -> None:
|
|
338
|
+
await client.agents.tools.modify_approval(
|
|
339
|
+
agent_id="agent_id",
|
|
340
|
+
tool_id="tool_id",
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
asyncio.run(main())
|
|
345
|
+
"""
|
|
346
|
+
_response = await self._raw_client.modify_approval(agent_id, tool_id, request_options=request_options)
|
|
347
|
+
return _response.data
|
|
@@ -170,6 +170,36 @@ class RawToolsClient:
|
|
|
170
170
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
171
171
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
172
172
|
|
|
173
|
+
def modify_approval(
|
|
174
|
+
self, agent_id: str, tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
175
|
+
) -> HttpResponse[None]:
|
|
176
|
+
"""
|
|
177
|
+
Parameters
|
|
178
|
+
----------
|
|
179
|
+
agent_id : str
|
|
180
|
+
|
|
181
|
+
tool_id : str
|
|
182
|
+
|
|
183
|
+
request_options : typing.Optional[RequestOptions]
|
|
184
|
+
Request-specific configuration.
|
|
185
|
+
|
|
186
|
+
Returns
|
|
187
|
+
-------
|
|
188
|
+
HttpResponse[None]
|
|
189
|
+
"""
|
|
190
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
191
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/tools/approval/{jsonable_encoder(tool_id)}",
|
|
192
|
+
method="PATCH",
|
|
193
|
+
request_options=request_options,
|
|
194
|
+
)
|
|
195
|
+
try:
|
|
196
|
+
if 200 <= _response.status_code < 300:
|
|
197
|
+
return HttpResponse(response=_response, data=None)
|
|
198
|
+
_response_json = _response.json()
|
|
199
|
+
except JSONDecodeError:
|
|
200
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
201
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
202
|
+
|
|
173
203
|
|
|
174
204
|
class AsyncRawToolsClient:
|
|
175
205
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -325,3 +355,33 @@ class AsyncRawToolsClient:
|
|
|
325
355
|
except JSONDecodeError:
|
|
326
356
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
327
357
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
358
|
+
|
|
359
|
+
async def modify_approval(
|
|
360
|
+
self, agent_id: str, tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
361
|
+
) -> AsyncHttpResponse[None]:
|
|
362
|
+
"""
|
|
363
|
+
Parameters
|
|
364
|
+
----------
|
|
365
|
+
agent_id : str
|
|
366
|
+
|
|
367
|
+
tool_id : str
|
|
368
|
+
|
|
369
|
+
request_options : typing.Optional[RequestOptions]
|
|
370
|
+
Request-specific configuration.
|
|
371
|
+
|
|
372
|
+
Returns
|
|
373
|
+
-------
|
|
374
|
+
AsyncHttpResponse[None]
|
|
375
|
+
"""
|
|
376
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
377
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/tools/approval/{jsonable_encoder(tool_id)}",
|
|
378
|
+
method="PATCH",
|
|
379
|
+
request_options=request_options,
|
|
380
|
+
)
|
|
381
|
+
try:
|
|
382
|
+
if 200 <= _response.status_code < 300:
|
|
383
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
384
|
+
_response_json = _response.json()
|
|
385
|
+
except JSONDecodeError:
|
|
386
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
387
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -9,6 +9,7 @@ from ...types.init_tool_rule import InitToolRule
|
|
|
9
9
|
from ...types.max_count_per_step_tool_rule import MaxCountPerStepToolRule
|
|
10
10
|
from ...types.parent_tool_rule import ParentToolRule
|
|
11
11
|
from ...types.required_before_exit_tool_rule import RequiredBeforeExitToolRule
|
|
12
|
+
from ...types.requires_approval_tool_rule import RequiresApprovalToolRule
|
|
12
13
|
from ...types.terminal_tool_rule import TerminalToolRule
|
|
13
14
|
|
|
14
15
|
CreateAgentRequestToolRulesItem = typing.Union[
|
|
@@ -19,5 +20,6 @@ CreateAgentRequestToolRulesItem = typing.Union[
|
|
|
19
20
|
MaxCountPerStepToolRule,
|
|
20
21
|
ParentToolRule,
|
|
21
22
|
RequiredBeforeExitToolRule,
|
|
23
|
+
RequiresApprovalToolRule,
|
|
22
24
|
InitToolRule,
|
|
23
25
|
]
|
|
@@ -9,6 +9,7 @@ from ...types.init_tool_rule import InitToolRule
|
|
|
9
9
|
from ...types.max_count_per_step_tool_rule import MaxCountPerStepToolRule
|
|
10
10
|
from ...types.parent_tool_rule import ParentToolRule
|
|
11
11
|
from ...types.required_before_exit_tool_rule import RequiredBeforeExitToolRule
|
|
12
|
+
from ...types.requires_approval_tool_rule import RequiresApprovalToolRule
|
|
12
13
|
from ...types.terminal_tool_rule import TerminalToolRule
|
|
13
14
|
|
|
14
15
|
UpdateAgentToolRulesItem = typing.Union[
|
|
@@ -19,5 +20,6 @@ UpdateAgentToolRulesItem = typing.Union[
|
|
|
19
20
|
MaxCountPerStepToolRule,
|
|
20
21
|
ParentToolRule,
|
|
21
22
|
RequiredBeforeExitToolRule,
|
|
23
|
+
RequiresApprovalToolRule,
|
|
22
24
|
InitToolRule,
|
|
23
25
|
]
|
|
@@ -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/0.1.
|
|
27
|
+
"User-Agent": "letta-client/0.1.299",
|
|
28
28
|
"X-Fern-Language": "Python",
|
|
29
29
|
"X-Fern-SDK-Name": "letta-client",
|
|
30
|
-
"X-Fern-SDK-Version": "0.1.
|
|
30
|
+
"X-Fern-SDK-Version": "0.1.299",
|
|
31
31
|
**(self.get_custom_headers() or {}),
|
|
32
32
|
}
|
|
33
33
|
if self._project is not None:
|
|
@@ -5,8 +5,9 @@ import typing
|
|
|
5
5
|
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
6
|
from ...core.request_options import RequestOptions
|
|
7
7
|
from ...types.letta_message_union import LettaMessageUnion
|
|
8
|
+
from ...types.letta_request_messages_item import LettaRequestMessagesItem
|
|
8
9
|
from ...types.letta_response import LettaResponse
|
|
9
|
-
from ...types.
|
|
10
|
+
from ...types.letta_streaming_request_messages_item import LettaStreamingRequestMessagesItem
|
|
10
11
|
from ...types.message_type import MessageType
|
|
11
12
|
from .raw_client import AsyncRawMessagesClient, RawMessagesClient
|
|
12
13
|
from .types.letta_streaming_response import LettaStreamingResponse
|
|
@@ -105,7 +106,7 @@ class MessagesClient:
|
|
|
105
106
|
self,
|
|
106
107
|
group_id: str,
|
|
107
108
|
*,
|
|
108
|
-
messages: typing.Sequence[
|
|
109
|
+
messages: typing.Sequence[LettaRequestMessagesItem],
|
|
109
110
|
max_steps: typing.Optional[int] = OMIT,
|
|
110
111
|
use_assistant_message: typing.Optional[bool] = OMIT,
|
|
111
112
|
assistant_message_tool_name: typing.Optional[str] = OMIT,
|
|
@@ -122,7 +123,7 @@ class MessagesClient:
|
|
|
122
123
|
----------
|
|
123
124
|
group_id : str
|
|
124
125
|
|
|
125
|
-
messages : typing.Sequence[
|
|
126
|
+
messages : typing.Sequence[LettaRequestMessagesItem]
|
|
126
127
|
The messages to be sent to the agent.
|
|
127
128
|
|
|
128
129
|
max_steps : typing.Optional[int]
|
|
@@ -190,7 +191,7 @@ class MessagesClient:
|
|
|
190
191
|
self,
|
|
191
192
|
group_id: str,
|
|
192
193
|
*,
|
|
193
|
-
messages: typing.Sequence[
|
|
194
|
+
messages: typing.Sequence[LettaStreamingRequestMessagesItem],
|
|
194
195
|
max_steps: typing.Optional[int] = OMIT,
|
|
195
196
|
use_assistant_message: typing.Optional[bool] = OMIT,
|
|
196
197
|
assistant_message_tool_name: typing.Optional[str] = OMIT,
|
|
@@ -211,7 +212,7 @@ class MessagesClient:
|
|
|
211
212
|
----------
|
|
212
213
|
group_id : str
|
|
213
214
|
|
|
214
|
-
messages : typing.Sequence[
|
|
215
|
+
messages : typing.Sequence[LettaStreamingRequestMessagesItem]
|
|
215
216
|
The messages to be sent to the agent.
|
|
216
217
|
|
|
217
218
|
max_steps : typing.Optional[int]
|
|
@@ -233,7 +234,7 @@ class MessagesClient:
|
|
|
233
234
|
If set to True, enables reasoning before responses or tool calls from the agent.
|
|
234
235
|
|
|
235
236
|
stream_tokens : typing.Optional[bool]
|
|
236
|
-
Flag to determine if individual tokens should be streamed
|
|
237
|
+
Flag to determine if individual tokens should be streamed, rather than streaming per step.
|
|
237
238
|
|
|
238
239
|
include_pings : typing.Optional[bool]
|
|
239
240
|
Whether to include periodic keepalive ping messages in the stream to prevent connection timeouts.
|
|
@@ -465,7 +466,7 @@ class AsyncMessagesClient:
|
|
|
465
466
|
self,
|
|
466
467
|
group_id: str,
|
|
467
468
|
*,
|
|
468
|
-
messages: typing.Sequence[
|
|
469
|
+
messages: typing.Sequence[LettaRequestMessagesItem],
|
|
469
470
|
max_steps: typing.Optional[int] = OMIT,
|
|
470
471
|
use_assistant_message: typing.Optional[bool] = OMIT,
|
|
471
472
|
assistant_message_tool_name: typing.Optional[str] = OMIT,
|
|
@@ -482,7 +483,7 @@ class AsyncMessagesClient:
|
|
|
482
483
|
----------
|
|
483
484
|
group_id : str
|
|
484
485
|
|
|
485
|
-
messages : typing.Sequence[
|
|
486
|
+
messages : typing.Sequence[LettaRequestMessagesItem]
|
|
486
487
|
The messages to be sent to the agent.
|
|
487
488
|
|
|
488
489
|
max_steps : typing.Optional[int]
|
|
@@ -558,7 +559,7 @@ class AsyncMessagesClient:
|
|
|
558
559
|
self,
|
|
559
560
|
group_id: str,
|
|
560
561
|
*,
|
|
561
|
-
messages: typing.Sequence[
|
|
562
|
+
messages: typing.Sequence[LettaStreamingRequestMessagesItem],
|
|
562
563
|
max_steps: typing.Optional[int] = OMIT,
|
|
563
564
|
use_assistant_message: typing.Optional[bool] = OMIT,
|
|
564
565
|
assistant_message_tool_name: typing.Optional[str] = OMIT,
|
|
@@ -579,7 +580,7 @@ class AsyncMessagesClient:
|
|
|
579
580
|
----------
|
|
580
581
|
group_id : str
|
|
581
582
|
|
|
582
|
-
messages : typing.Sequence[
|
|
583
|
+
messages : typing.Sequence[LettaStreamingRequestMessagesItem]
|
|
583
584
|
The messages to be sent to the agent.
|
|
584
585
|
|
|
585
586
|
max_steps : typing.Optional[int]
|
|
@@ -601,7 +602,7 @@ class AsyncMessagesClient:
|
|
|
601
602
|
If set to True, enables reasoning before responses or tool calls from the agent.
|
|
602
603
|
|
|
603
604
|
stream_tokens : typing.Optional[bool]
|
|
604
|
-
Flag to determine if individual tokens should be streamed
|
|
605
|
+
Flag to determine if individual tokens should be streamed, rather than streaming per step.
|
|
605
606
|
|
|
606
607
|
include_pings : typing.Optional[bool]
|
|
607
608
|
Whether to include periodic keepalive ping messages in the stream to prevent connection timeouts.
|
|
@@ -16,8 +16,9 @@ from ...core.unchecked_base_model import construct_type
|
|
|
16
16
|
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
17
17
|
from ...types.http_validation_error import HttpValidationError
|
|
18
18
|
from ...types.letta_message_union import LettaMessageUnion
|
|
19
|
+
from ...types.letta_request_messages_item import LettaRequestMessagesItem
|
|
19
20
|
from ...types.letta_response import LettaResponse
|
|
20
|
-
from ...types.
|
|
21
|
+
from ...types.letta_streaming_request_messages_item import LettaStreamingRequestMessagesItem
|
|
21
22
|
from ...types.message_type import MessageType
|
|
22
23
|
from .types.letta_streaming_response import LettaStreamingResponse
|
|
23
24
|
from .types.messages_modify_request import MessagesModifyRequest
|
|
@@ -119,7 +120,7 @@ class RawMessagesClient:
|
|
|
119
120
|
self,
|
|
120
121
|
group_id: str,
|
|
121
122
|
*,
|
|
122
|
-
messages: typing.Sequence[
|
|
123
|
+
messages: typing.Sequence[LettaRequestMessagesItem],
|
|
123
124
|
max_steps: typing.Optional[int] = OMIT,
|
|
124
125
|
use_assistant_message: typing.Optional[bool] = OMIT,
|
|
125
126
|
assistant_message_tool_name: typing.Optional[str] = OMIT,
|
|
@@ -136,7 +137,7 @@ class RawMessagesClient:
|
|
|
136
137
|
----------
|
|
137
138
|
group_id : str
|
|
138
139
|
|
|
139
|
-
messages : typing.Sequence[
|
|
140
|
+
messages : typing.Sequence[LettaRequestMessagesItem]
|
|
140
141
|
The messages to be sent to the agent.
|
|
141
142
|
|
|
142
143
|
max_steps : typing.Optional[int]
|
|
@@ -170,7 +171,7 @@ class RawMessagesClient:
|
|
|
170
171
|
method="POST",
|
|
171
172
|
json={
|
|
172
173
|
"messages": convert_and_respect_annotation_metadata(
|
|
173
|
-
object_=messages, annotation=typing.Sequence[
|
|
174
|
+
object_=messages, annotation=typing.Sequence[LettaRequestMessagesItem], direction="write"
|
|
174
175
|
),
|
|
175
176
|
"max_steps": max_steps,
|
|
176
177
|
"use_assistant_message": use_assistant_message,
|
|
@@ -216,7 +217,7 @@ class RawMessagesClient:
|
|
|
216
217
|
self,
|
|
217
218
|
group_id: str,
|
|
218
219
|
*,
|
|
219
|
-
messages: typing.Sequence[
|
|
220
|
+
messages: typing.Sequence[LettaStreamingRequestMessagesItem],
|
|
220
221
|
max_steps: typing.Optional[int] = OMIT,
|
|
221
222
|
use_assistant_message: typing.Optional[bool] = OMIT,
|
|
222
223
|
assistant_message_tool_name: typing.Optional[str] = OMIT,
|
|
@@ -237,7 +238,7 @@ class RawMessagesClient:
|
|
|
237
238
|
----------
|
|
238
239
|
group_id : str
|
|
239
240
|
|
|
240
|
-
messages : typing.Sequence[
|
|
241
|
+
messages : typing.Sequence[LettaStreamingRequestMessagesItem]
|
|
241
242
|
The messages to be sent to the agent.
|
|
242
243
|
|
|
243
244
|
max_steps : typing.Optional[int]
|
|
@@ -259,7 +260,7 @@ class RawMessagesClient:
|
|
|
259
260
|
If set to True, enables reasoning before responses or tool calls from the agent.
|
|
260
261
|
|
|
261
262
|
stream_tokens : typing.Optional[bool]
|
|
262
|
-
Flag to determine if individual tokens should be streamed
|
|
263
|
+
Flag to determine if individual tokens should be streamed, rather than streaming per step.
|
|
263
264
|
|
|
264
265
|
include_pings : typing.Optional[bool]
|
|
265
266
|
Whether to include periodic keepalive ping messages in the stream to prevent connection timeouts.
|
|
@@ -280,7 +281,7 @@ class RawMessagesClient:
|
|
|
280
281
|
method="POST",
|
|
281
282
|
json={
|
|
282
283
|
"messages": convert_and_respect_annotation_metadata(
|
|
283
|
-
object_=messages, annotation=typing.Sequence[
|
|
284
|
+
object_=messages, annotation=typing.Sequence[LettaStreamingRequestMessagesItem], direction="write"
|
|
284
285
|
),
|
|
285
286
|
"max_steps": max_steps,
|
|
286
287
|
"use_assistant_message": use_assistant_message,
|
|
@@ -551,7 +552,7 @@ class AsyncRawMessagesClient:
|
|
|
551
552
|
self,
|
|
552
553
|
group_id: str,
|
|
553
554
|
*,
|
|
554
|
-
messages: typing.Sequence[
|
|
555
|
+
messages: typing.Sequence[LettaRequestMessagesItem],
|
|
555
556
|
max_steps: typing.Optional[int] = OMIT,
|
|
556
557
|
use_assistant_message: typing.Optional[bool] = OMIT,
|
|
557
558
|
assistant_message_tool_name: typing.Optional[str] = OMIT,
|
|
@@ -568,7 +569,7 @@ class AsyncRawMessagesClient:
|
|
|
568
569
|
----------
|
|
569
570
|
group_id : str
|
|
570
571
|
|
|
571
|
-
messages : typing.Sequence[
|
|
572
|
+
messages : typing.Sequence[LettaRequestMessagesItem]
|
|
572
573
|
The messages to be sent to the agent.
|
|
573
574
|
|
|
574
575
|
max_steps : typing.Optional[int]
|
|
@@ -602,7 +603,7 @@ class AsyncRawMessagesClient:
|
|
|
602
603
|
method="POST",
|
|
603
604
|
json={
|
|
604
605
|
"messages": convert_and_respect_annotation_metadata(
|
|
605
|
-
object_=messages, annotation=typing.Sequence[
|
|
606
|
+
object_=messages, annotation=typing.Sequence[LettaRequestMessagesItem], direction="write"
|
|
606
607
|
),
|
|
607
608
|
"max_steps": max_steps,
|
|
608
609
|
"use_assistant_message": use_assistant_message,
|
|
@@ -648,7 +649,7 @@ class AsyncRawMessagesClient:
|
|
|
648
649
|
self,
|
|
649
650
|
group_id: str,
|
|
650
651
|
*,
|
|
651
|
-
messages: typing.Sequence[
|
|
652
|
+
messages: typing.Sequence[LettaStreamingRequestMessagesItem],
|
|
652
653
|
max_steps: typing.Optional[int] = OMIT,
|
|
653
654
|
use_assistant_message: typing.Optional[bool] = OMIT,
|
|
654
655
|
assistant_message_tool_name: typing.Optional[str] = OMIT,
|
|
@@ -669,7 +670,7 @@ class AsyncRawMessagesClient:
|
|
|
669
670
|
----------
|
|
670
671
|
group_id : str
|
|
671
672
|
|
|
672
|
-
messages : typing.Sequence[
|
|
673
|
+
messages : typing.Sequence[LettaStreamingRequestMessagesItem]
|
|
673
674
|
The messages to be sent to the agent.
|
|
674
675
|
|
|
675
676
|
max_steps : typing.Optional[int]
|
|
@@ -691,7 +692,7 @@ class AsyncRawMessagesClient:
|
|
|
691
692
|
If set to True, enables reasoning before responses or tool calls from the agent.
|
|
692
693
|
|
|
693
694
|
stream_tokens : typing.Optional[bool]
|
|
694
|
-
Flag to determine if individual tokens should be streamed
|
|
695
|
+
Flag to determine if individual tokens should be streamed, rather than streaming per step.
|
|
695
696
|
|
|
696
697
|
include_pings : typing.Optional[bool]
|
|
697
698
|
Whether to include periodic keepalive ping messages in the stream to prevent connection timeouts.
|
|
@@ -712,7 +713,7 @@ class AsyncRawMessagesClient:
|
|
|
712
713
|
method="POST",
|
|
713
714
|
json={
|
|
714
715
|
"messages": convert_and_respect_annotation_metadata(
|
|
715
|
-
object_=messages, annotation=typing.Sequence[
|
|
716
|
+
object_=messages, annotation=typing.Sequence[LettaStreamingRequestMessagesItem], direction="write"
|
|
716
717
|
),
|
|
717
718
|
"max_steps": max_steps,
|
|
718
719
|
"use_assistant_message": use_assistant_message,
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
|
+
from ....types.approval_request_message import ApprovalRequestMessage
|
|
6
|
+
from ....types.approval_response_message import ApprovalResponseMessage
|
|
5
7
|
from ....types.assistant_message import AssistantMessage
|
|
6
8
|
from ....types.hidden_reasoning_message import HiddenReasoningMessage
|
|
7
9
|
from ....types.reasoning_message import ReasoningMessage
|
|
@@ -18,4 +20,6 @@ MessagesModifyResponse = typing.Union[
|
|
|
18
20
|
ToolCallMessage,
|
|
19
21
|
ToolReturnMessage,
|
|
20
22
|
AssistantMessage,
|
|
23
|
+
ApprovalRequestMessage,
|
|
24
|
+
ApprovalResponseMessage,
|
|
21
25
|
]
|
|
@@ -17,6 +17,7 @@ from .types import (
|
|
|
17
17
|
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemFour,
|
|
18
18
|
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemMaxCountLimit,
|
|
19
19
|
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemOne,
|
|
20
|
+
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemPromptTemplate,
|
|
20
21
|
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemSeven,
|
|
21
22
|
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemTwo,
|
|
22
23
|
TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemZero,
|
|
@@ -58,6 +59,7 @@ __all__ = [
|
|
|
58
59
|
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemFour",
|
|
59
60
|
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemMaxCountLimit",
|
|
60
61
|
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemOne",
|
|
62
|
+
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemPromptTemplate",
|
|
61
63
|
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemSeven",
|
|
62
64
|
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemTwo",
|
|
63
65
|
"TemplatesGetTemplateSnapshotResponseAgentsItemToolRulesItemZero",
|
letta_client/templates/client.py
CHANGED
|
@@ -40,7 +40,9 @@ class TemplatesClient:
|
|
|
40
40
|
self,
|
|
41
41
|
*,
|
|
42
42
|
offset: typing.Optional[str] = None,
|
|
43
|
+
exact: typing.Optional[str] = None,
|
|
43
44
|
limit: typing.Optional[str] = None,
|
|
45
|
+
version: typing.Optional[str] = None,
|
|
44
46
|
template_id: typing.Optional[str] = None,
|
|
45
47
|
name: typing.Optional[str] = None,
|
|
46
48
|
search: typing.Optional[str] = None,
|
|
@@ -56,8 +58,14 @@ class TemplatesClient:
|
|
|
56
58
|
----------
|
|
57
59
|
offset : typing.Optional[str]
|
|
58
60
|
|
|
61
|
+
exact : typing.Optional[str]
|
|
62
|
+
Whether to search for an exact name match
|
|
63
|
+
|
|
59
64
|
limit : typing.Optional[str]
|
|
60
65
|
|
|
66
|
+
version : typing.Optional[str]
|
|
67
|
+
Specify the version you want to return, otherwise will return the latest version
|
|
68
|
+
|
|
61
69
|
template_id : typing.Optional[str]
|
|
62
70
|
|
|
63
71
|
name : typing.Optional[str]
|
|
@@ -90,7 +98,9 @@ class TemplatesClient:
|
|
|
90
98
|
"""
|
|
91
99
|
_response = self._raw_client.list(
|
|
92
100
|
offset=offset,
|
|
101
|
+
exact=exact,
|
|
93
102
|
limit=limit,
|
|
103
|
+
version=version,
|
|
94
104
|
template_id=template_id,
|
|
95
105
|
name=name,
|
|
96
106
|
search=search,
|
|
@@ -457,7 +467,9 @@ class AsyncTemplatesClient:
|
|
|
457
467
|
self,
|
|
458
468
|
*,
|
|
459
469
|
offset: typing.Optional[str] = None,
|
|
470
|
+
exact: typing.Optional[str] = None,
|
|
460
471
|
limit: typing.Optional[str] = None,
|
|
472
|
+
version: typing.Optional[str] = None,
|
|
461
473
|
template_id: typing.Optional[str] = None,
|
|
462
474
|
name: typing.Optional[str] = None,
|
|
463
475
|
search: typing.Optional[str] = None,
|
|
@@ -473,8 +485,14 @@ class AsyncTemplatesClient:
|
|
|
473
485
|
----------
|
|
474
486
|
offset : typing.Optional[str]
|
|
475
487
|
|
|
488
|
+
exact : typing.Optional[str]
|
|
489
|
+
Whether to search for an exact name match
|
|
490
|
+
|
|
476
491
|
limit : typing.Optional[str]
|
|
477
492
|
|
|
493
|
+
version : typing.Optional[str]
|
|
494
|
+
Specify the version you want to return, otherwise will return the latest version
|
|
495
|
+
|
|
478
496
|
template_id : typing.Optional[str]
|
|
479
497
|
|
|
480
498
|
name : typing.Optional[str]
|
|
@@ -515,7 +533,9 @@ class AsyncTemplatesClient:
|
|
|
515
533
|
"""
|
|
516
534
|
_response = await self._raw_client.list(
|
|
517
535
|
offset=offset,
|
|
536
|
+
exact=exact,
|
|
518
537
|
limit=limit,
|
|
538
|
+
version=version,
|
|
519
539
|
template_id=template_id,
|
|
520
540
|
name=name,
|
|
521
541
|
search=search,
|