letta-client 0.1.195__py3-none-any.whl → 0.1.197__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/agents/__init__.py +7 -1
- letta_client/agents/messages/__init__.py +12 -2
- letta_client/agents/messages/client.py +179 -0
- letta_client/agents/messages/types/__init__.py +7 -1
- letta_client/agents/messages/types/messages_preview_raw_payload_request.py +7 -0
- letta_client/core/client_wrapper.py +1 -1
- {letta_client-0.1.195.dist-info → letta_client-0.1.197.dist-info}/METADATA +1 -1
- {letta_client-0.1.195.dist-info → letta_client-0.1.197.dist-info}/RECORD +9 -8
- {letta_client-0.1.195.dist-info → letta_client-0.1.197.dist-info}/WHEEL +0 -0
letta_client/agents/__init__.py
CHANGED
|
@@ -18,7 +18,12 @@ from .types import (
|
|
|
18
18
|
)
|
|
19
19
|
from . import blocks, context, core_memory, groups, memory_variables, messages, passages, sources, templates, tools
|
|
20
20
|
from .memory_variables import MemoryVariablesListResponse
|
|
21
|
-
from .messages import
|
|
21
|
+
from .messages import (
|
|
22
|
+
LettaStreamingResponse,
|
|
23
|
+
MessagesModifyRequest,
|
|
24
|
+
MessagesModifyResponse,
|
|
25
|
+
MessagesPreviewRawPayloadRequest,
|
|
26
|
+
)
|
|
22
27
|
from .templates import TemplatesCreateResponse, TemplatesCreateVersionRequestReturnAgentState, TemplatesMigrateResponse
|
|
23
28
|
|
|
24
29
|
__all__ = [
|
|
@@ -38,6 +43,7 @@ __all__ = [
|
|
|
38
43
|
"MemoryVariablesListResponse",
|
|
39
44
|
"MessagesModifyRequest",
|
|
40
45
|
"MessagesModifyResponse",
|
|
46
|
+
"MessagesPreviewRawPayloadRequest",
|
|
41
47
|
"TemplatesCreateResponse",
|
|
42
48
|
"TemplatesCreateVersionRequestReturnAgentState",
|
|
43
49
|
"TemplatesMigrateResponse",
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from .types import
|
|
3
|
+
from .types import (
|
|
4
|
+
LettaStreamingResponse,
|
|
5
|
+
MessagesModifyRequest,
|
|
6
|
+
MessagesModifyResponse,
|
|
7
|
+
MessagesPreviewRawPayloadRequest,
|
|
8
|
+
)
|
|
4
9
|
|
|
5
|
-
__all__ = [
|
|
10
|
+
__all__ = [
|
|
11
|
+
"LettaStreamingResponse",
|
|
12
|
+
"MessagesModifyRequest",
|
|
13
|
+
"MessagesModifyResponse",
|
|
14
|
+
"MessagesPreviewRawPayloadRequest",
|
|
15
|
+
]
|
|
@@ -21,6 +21,7 @@ import httpx_sse
|
|
|
21
21
|
import json
|
|
22
22
|
from ...types.run import Run
|
|
23
23
|
from ...types.agent_state import AgentState
|
|
24
|
+
from .types.messages_preview_raw_payload_request import MessagesPreviewRawPayloadRequest
|
|
24
25
|
from ...core.client_wrapper import AsyncClientWrapper
|
|
25
26
|
|
|
26
27
|
# this is used as the default value for optional parameters
|
|
@@ -694,6 +695,91 @@ class MessagesClient:
|
|
|
694
695
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
695
696
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
696
697
|
|
|
698
|
+
def preview_raw_payload(
|
|
699
|
+
self,
|
|
700
|
+
agent_id: str,
|
|
701
|
+
*,
|
|
702
|
+
request: MessagesPreviewRawPayloadRequest,
|
|
703
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
704
|
+
) -> typing.Dict[str, typing.Optional[typing.Any]]:
|
|
705
|
+
"""
|
|
706
|
+
Inspect the raw LLM request payload without sending it.
|
|
707
|
+
|
|
708
|
+
This endpoint processes the message through the agent loop up until
|
|
709
|
+
the LLM request, then returns the raw request payload that would
|
|
710
|
+
be sent to the LLM provider. Useful for debugging and inspection.
|
|
711
|
+
|
|
712
|
+
Parameters
|
|
713
|
+
----------
|
|
714
|
+
agent_id : str
|
|
715
|
+
|
|
716
|
+
request : MessagesPreviewRawPayloadRequest
|
|
717
|
+
|
|
718
|
+
request_options : typing.Optional[RequestOptions]
|
|
719
|
+
Request-specific configuration.
|
|
720
|
+
|
|
721
|
+
Returns
|
|
722
|
+
-------
|
|
723
|
+
typing.Dict[str, typing.Optional[typing.Any]]
|
|
724
|
+
Successful Response
|
|
725
|
+
|
|
726
|
+
Examples
|
|
727
|
+
--------
|
|
728
|
+
from letta_client import Letta, LettaRequest, MessageCreate, TextContent
|
|
729
|
+
|
|
730
|
+
client = Letta(
|
|
731
|
+
project="YOUR_PROJECT",
|
|
732
|
+
token="YOUR_TOKEN",
|
|
733
|
+
)
|
|
734
|
+
client.agents.messages.preview_raw_payload(
|
|
735
|
+
agent_id="agent_id",
|
|
736
|
+
request=LettaRequest(
|
|
737
|
+
messages=[
|
|
738
|
+
MessageCreate(
|
|
739
|
+
role="user",
|
|
740
|
+
content=[
|
|
741
|
+
TextContent(
|
|
742
|
+
text="text",
|
|
743
|
+
)
|
|
744
|
+
],
|
|
745
|
+
)
|
|
746
|
+
],
|
|
747
|
+
),
|
|
748
|
+
)
|
|
749
|
+
"""
|
|
750
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
751
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/messages/preview-raw-payload",
|
|
752
|
+
method="POST",
|
|
753
|
+
json=convert_and_respect_annotation_metadata(
|
|
754
|
+
object_=request, annotation=MessagesPreviewRawPayloadRequest, direction="write"
|
|
755
|
+
),
|
|
756
|
+
request_options=request_options,
|
|
757
|
+
omit=OMIT,
|
|
758
|
+
)
|
|
759
|
+
try:
|
|
760
|
+
if 200 <= _response.status_code < 300:
|
|
761
|
+
return typing.cast(
|
|
762
|
+
typing.Dict[str, typing.Optional[typing.Any]],
|
|
763
|
+
construct_type(
|
|
764
|
+
type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
|
|
765
|
+
object_=_response.json(),
|
|
766
|
+
),
|
|
767
|
+
)
|
|
768
|
+
if _response.status_code == 422:
|
|
769
|
+
raise UnprocessableEntityError(
|
|
770
|
+
typing.cast(
|
|
771
|
+
HttpValidationError,
|
|
772
|
+
construct_type(
|
|
773
|
+
type_=HttpValidationError, # type: ignore
|
|
774
|
+
object_=_response.json(),
|
|
775
|
+
),
|
|
776
|
+
)
|
|
777
|
+
)
|
|
778
|
+
_response_json = _response.json()
|
|
779
|
+
except JSONDecodeError:
|
|
780
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
781
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
782
|
+
|
|
697
783
|
|
|
698
784
|
class AsyncMessagesClient:
|
|
699
785
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -1417,3 +1503,96 @@ class AsyncMessagesClient:
|
|
|
1417
1503
|
except JSONDecodeError:
|
|
1418
1504
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1419
1505
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1506
|
+
|
|
1507
|
+
async def preview_raw_payload(
|
|
1508
|
+
self,
|
|
1509
|
+
agent_id: str,
|
|
1510
|
+
*,
|
|
1511
|
+
request: MessagesPreviewRawPayloadRequest,
|
|
1512
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1513
|
+
) -> typing.Dict[str, typing.Optional[typing.Any]]:
|
|
1514
|
+
"""
|
|
1515
|
+
Inspect the raw LLM request payload without sending it.
|
|
1516
|
+
|
|
1517
|
+
This endpoint processes the message through the agent loop up until
|
|
1518
|
+
the LLM request, then returns the raw request payload that would
|
|
1519
|
+
be sent to the LLM provider. Useful for debugging and inspection.
|
|
1520
|
+
|
|
1521
|
+
Parameters
|
|
1522
|
+
----------
|
|
1523
|
+
agent_id : str
|
|
1524
|
+
|
|
1525
|
+
request : MessagesPreviewRawPayloadRequest
|
|
1526
|
+
|
|
1527
|
+
request_options : typing.Optional[RequestOptions]
|
|
1528
|
+
Request-specific configuration.
|
|
1529
|
+
|
|
1530
|
+
Returns
|
|
1531
|
+
-------
|
|
1532
|
+
typing.Dict[str, typing.Optional[typing.Any]]
|
|
1533
|
+
Successful Response
|
|
1534
|
+
|
|
1535
|
+
Examples
|
|
1536
|
+
--------
|
|
1537
|
+
import asyncio
|
|
1538
|
+
|
|
1539
|
+
from letta_client import AsyncLetta, LettaRequest, MessageCreate, TextContent
|
|
1540
|
+
|
|
1541
|
+
client = AsyncLetta(
|
|
1542
|
+
project="YOUR_PROJECT",
|
|
1543
|
+
token="YOUR_TOKEN",
|
|
1544
|
+
)
|
|
1545
|
+
|
|
1546
|
+
|
|
1547
|
+
async def main() -> None:
|
|
1548
|
+
await client.agents.messages.preview_raw_payload(
|
|
1549
|
+
agent_id="agent_id",
|
|
1550
|
+
request=LettaRequest(
|
|
1551
|
+
messages=[
|
|
1552
|
+
MessageCreate(
|
|
1553
|
+
role="user",
|
|
1554
|
+
content=[
|
|
1555
|
+
TextContent(
|
|
1556
|
+
text="text",
|
|
1557
|
+
)
|
|
1558
|
+
],
|
|
1559
|
+
)
|
|
1560
|
+
],
|
|
1561
|
+
),
|
|
1562
|
+
)
|
|
1563
|
+
|
|
1564
|
+
|
|
1565
|
+
asyncio.run(main())
|
|
1566
|
+
"""
|
|
1567
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1568
|
+
f"v1/agents/{jsonable_encoder(agent_id)}/messages/preview-raw-payload",
|
|
1569
|
+
method="POST",
|
|
1570
|
+
json=convert_and_respect_annotation_metadata(
|
|
1571
|
+
object_=request, annotation=MessagesPreviewRawPayloadRequest, direction="write"
|
|
1572
|
+
),
|
|
1573
|
+
request_options=request_options,
|
|
1574
|
+
omit=OMIT,
|
|
1575
|
+
)
|
|
1576
|
+
try:
|
|
1577
|
+
if 200 <= _response.status_code < 300:
|
|
1578
|
+
return typing.cast(
|
|
1579
|
+
typing.Dict[str, typing.Optional[typing.Any]],
|
|
1580
|
+
construct_type(
|
|
1581
|
+
type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
|
|
1582
|
+
object_=_response.json(),
|
|
1583
|
+
),
|
|
1584
|
+
)
|
|
1585
|
+
if _response.status_code == 422:
|
|
1586
|
+
raise UnprocessableEntityError(
|
|
1587
|
+
typing.cast(
|
|
1588
|
+
HttpValidationError,
|
|
1589
|
+
construct_type(
|
|
1590
|
+
type_=HttpValidationError, # type: ignore
|
|
1591
|
+
object_=_response.json(),
|
|
1592
|
+
),
|
|
1593
|
+
)
|
|
1594
|
+
)
|
|
1595
|
+
_response_json = _response.json()
|
|
1596
|
+
except JSONDecodeError:
|
|
1597
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1598
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -3,5 +3,11 @@
|
|
|
3
3
|
from .letta_streaming_response import LettaStreamingResponse
|
|
4
4
|
from .messages_modify_request import MessagesModifyRequest
|
|
5
5
|
from .messages_modify_response import MessagesModifyResponse
|
|
6
|
+
from .messages_preview_raw_payload_request import MessagesPreviewRawPayloadRequest
|
|
6
7
|
|
|
7
|
-
__all__ = [
|
|
8
|
+
__all__ = [
|
|
9
|
+
"LettaStreamingResponse",
|
|
10
|
+
"MessagesModifyRequest",
|
|
11
|
+
"MessagesModifyResponse",
|
|
12
|
+
"MessagesPreviewRawPayloadRequest",
|
|
13
|
+
]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ....types.letta_request import LettaRequest
|
|
5
|
+
from ....types.letta_streaming_request import LettaStreamingRequest
|
|
6
|
+
|
|
7
|
+
MessagesPreviewRawPayloadRequest = typing.Union[LettaRequest, LettaStreamingRequest]
|
|
@@ -24,7 +24,7 @@ class BaseClientWrapper:
|
|
|
24
24
|
headers: typing.Dict[str, str] = {
|
|
25
25
|
"X-Fern-Language": "Python",
|
|
26
26
|
"X-Fern-SDK-Name": "letta-client",
|
|
27
|
-
"X-Fern-SDK-Version": "0.1.
|
|
27
|
+
"X-Fern-SDK-Version": "0.1.197",
|
|
28
28
|
}
|
|
29
29
|
if self._project is not None:
|
|
30
30
|
headers["X-Project"] = self._project
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
letta_client/__init__.py,sha256=PaPQ6XnP5KGKv2jElXjj6d483LOtbaRGJu3n88rW1WA,18256
|
|
2
|
-
letta_client/agents/__init__.py,sha256=
|
|
2
|
+
letta_client/agents/__init__.py,sha256=i9PmBueIWESDLqmpzWt1oZVgZNr1rNkO6j0pl5sgvGo,2049
|
|
3
3
|
letta_client/agents/blocks/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
4
4
|
letta_client/agents/blocks/client.py,sha256=4UGPYxfGwNN3ZW-SkIdfVZK6cvCcumVAw0_AM8OmoBY,25046
|
|
5
5
|
letta_client/agents/client.py,sha256=B7ZsJGQqmeTUdP8yybRWh6qaoybopFCujzP99EDwk_k,93753
|
|
@@ -13,12 +13,13 @@ letta_client/agents/memory_variables/__init__.py,sha256=goz3kTaLM-v8g-hYEhzyqBYz
|
|
|
13
13
|
letta_client/agents/memory_variables/client.py,sha256=DGJvV5k5H-BRE-FWMLNrCqKkHJJuMK9P4K7ncJis8PU,5037
|
|
14
14
|
letta_client/agents/memory_variables/types/__init__.py,sha256=EoznK0WvhCyFYd4KDdU-cGDQWpSXmq79BSkqVHN-j7A,180
|
|
15
15
|
letta_client/agents/memory_variables/types/memory_variables_list_response.py,sha256=bsF__n_B4ZXEHzg--OVD6tHHXt_aM-FjHm2x1ZXPnL0,599
|
|
16
|
-
letta_client/agents/messages/__init__.py,sha256=
|
|
17
|
-
letta_client/agents/messages/client.py,sha256=
|
|
18
|
-
letta_client/agents/messages/types/__init__.py,sha256=
|
|
16
|
+
letta_client/agents/messages/__init__.py,sha256=RSmlezGH90RirElX0LHusjD03EN6UqGsrS-A0Bue2hA,353
|
|
17
|
+
letta_client/agents/messages/client.py,sha256=dlVqB2PO29NgVhKvZr5vWtrcDsfCrgIh5C1CVeJ5cRM,57596
|
|
18
|
+
letta_client/agents/messages/types/__init__.py,sha256=uDn0e1-EJ7g2U0EHD8SkP38liALoVCTJ7bJhUAOutwE,473
|
|
19
19
|
letta_client/agents/messages/types/letta_streaming_response.py,sha256=8VR2F32xjoPFXL4YBvBbAZclaJG4ENPTjk7BrlZkmtw,742
|
|
20
20
|
letta_client/agents/messages/types/messages_modify_request.py,sha256=7C2X3BKye-YDSXOkdEmxxt34seI4jkLK0-govtc4nhg,475
|
|
21
21
|
letta_client/agents/messages/types/messages_modify_response.py,sha256=THyiUMxZyzVSp0kk1s0XOLW1LUass7mXcfFER1PTLyw,671
|
|
22
|
+
letta_client/agents/messages/types/messages_preview_raw_payload_request.py,sha256=Lat4Nj4LETdWswrF9PJfDZVw23KvQGVUvw9JXXPYY8I,282
|
|
22
23
|
letta_client/agents/passages/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
23
24
|
letta_client/agents/passages/client.py,sha256=XgEzJvHv5yOFK--W5mU3Hgqv5-mmlVRLPOb3aQ1QOUA,26434
|
|
24
25
|
letta_client/agents/sources/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
@@ -65,7 +66,7 @@ letta_client/client_side_access_tokens/types/client_side_access_tokens_create_re
|
|
|
65
66
|
letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response_policy_data_item_access_item.py,sha256=R-H25IpNp9feSrW8Yj3h9O3UTMVvFniQJElogKxLuoE,254
|
|
66
67
|
letta_client/core/__init__.py,sha256=OKbX2aCZXgHCDUsCouqv-OiX32xA6eFFCKIUH9M5Vzk,1591
|
|
67
68
|
letta_client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
|
68
|
-
letta_client/core/client_wrapper.py,sha256=
|
|
69
|
+
letta_client/core/client_wrapper.py,sha256=xUxNRGy3q-2inkpv1DjYNocNzmS0b9YoeGy6NAntVIs,2336
|
|
69
70
|
letta_client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
|
70
71
|
letta_client/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
|
|
71
72
|
letta_client/core/http_client.py,sha256=Z77OIxIbL4OAB2IDqjRq_sYa5yNYAWfmdhdCSSvh6Y4,19552
|
|
@@ -418,6 +419,6 @@ letta_client/types/web_search_options_user_location_approximate.py,sha256=Ywk01J
|
|
|
418
419
|
letta_client/version.py,sha256=bttKLbIhO3UonCYQlqs600zzbQgfhCCMjeXR9WRzid4,79
|
|
419
420
|
letta_client/voice/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
420
421
|
letta_client/voice/client.py,sha256=47iQYCuW_qpKI4hM3pYVxn3hw7kgQj3emU1_oRpkRMA,5811
|
|
421
|
-
letta_client-0.1.
|
|
422
|
-
letta_client-0.1.
|
|
423
|
-
letta_client-0.1.
|
|
422
|
+
letta_client-0.1.197.dist-info/METADATA,sha256=zleshuJ2dHoLmE0SOmUMFd6IM9Znmj4OFQutMG28yP8,5177
|
|
423
|
+
letta_client-0.1.197.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
|
424
|
+
letta_client-0.1.197.dist-info/RECORD,,
|
|
File without changes
|