letta-client 0.1.4__py3-none-any.whl → 0.1.6__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/__init__.py +34 -12
- letta/agents/__init__.py +49 -13
- letta/agents/client.py +40 -0
- letta/agents/messages/__init__.py +36 -2
- letta/agents/messages/client.py +46 -0
- letta/agents/messages/types/__init__.py +37 -3
- letta/agents/messages/types/letta_streaming_response.py +132 -14
- letta/agents/messages/types/messages_list_response_item.py +114 -7
- letta/agents/types/__init__.py +26 -18
- letta/agents/types/agents_search_deployed_agents_request_search_item.py +59 -8
- letta/agents/types/{agents_search_deployed_agents_request_search_item_operator.py → agents_search_deployed_agents_request_search_item_name.py} +5 -6
- letta/agents/types/{agents_search_deployed_agents_request_search_item_operator_operator.py → agents_search_deployed_agents_request_search_item_name_operator.py} +1 -1
- letta/agents/types/agents_search_deployed_agents_request_search_item_order_by.py +26 -0
- letta/agents/types/agents_search_deployed_agents_request_search_item_order_by_direction.py +5 -0
- letta/agents/types/{agents_search_deployed_agents_request_search_item_direction_value.py → agents_search_deployed_agents_request_search_item_order_by_value.py} +1 -1
- letta/agents/types/{agents_search_deployed_agents_request_search_item_zero.py → agents_search_deployed_agents_request_search_item_version.py} +2 -3
- letta/client.py +4 -4
- letta/core/client_wrapper.py +7 -18
- letta/types/__init__.py +18 -0
- letta/types/agent_environment_variable.py +68 -0
- letta/types/agent_state.py +15 -9
- letta/types/assistant_message_output.py +1 -2
- letta/types/block.py +9 -9
- letta/types/context_window_overview.py +5 -0
- letta/types/embedding_config.py +8 -8
- letta/types/job.py +5 -5
- letta/types/letta_response.py +4 -3
- letta/types/letta_response_messages_item.py +120 -0
- letta/types/letta_schemas_message_message.py +10 -10
- letta/types/letta_schemas_tool_tool.py +5 -5
- letta/types/letta_usage_statistics.py +4 -5
- letta/types/llm_config.py +7 -7
- letta/types/passage.py +8 -8
- letta/types/reasoning_message.py +4 -5
- letta/types/sandbox_environment_variable.py +4 -4
- letta/types/sandbox_environment_variable_update.py +0 -4
- letta/types/source.py +6 -6
- letta/types/system_message_output.py +4 -5
- letta/types/tool_call_message.py +4 -5
- letta/types/tool_return_message.py +8 -9
- letta/types/user.py +3 -3
- letta/types/user_message_output.py +4 -5
- {letta_client-0.1.4.dist-info → letta_client-0.1.6.dist-info}/METADATA +1 -1
- {letta_client-0.1.4.dist-info → letta_client-0.1.6.dist-info}/RECORD +45 -43
- letta/agents/types/agents_search_deployed_agents_request_search_item_direction.py +0 -27
- letta/agents/types/agents_search_deployed_agents_request_search_item_direction_direction.py +0 -5
- {letta_client-0.1.4.dist-info → letta_client-0.1.6.dist-info}/WHEEL +0 -0
|
@@ -1,13 +1,120 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from ....core.pydantic_utilities import UniversalBaseModel
|
|
3
5
|
import typing
|
|
4
|
-
|
|
5
|
-
from ....
|
|
6
|
-
|
|
7
|
-
from ....types.
|
|
8
|
-
from ....types.
|
|
9
|
-
|
|
6
|
+
import datetime as dt
|
|
7
|
+
from ....core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
import pydantic
|
|
9
|
+
from ....types.tool_call_message_tool_call import ToolCallMessageToolCall
|
|
10
|
+
from ....types.tool_return_message_status import ToolReturnMessageStatus
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class MessagesListResponseItem_SystemMessage(UniversalBaseModel):
|
|
14
|
+
message_type: typing.Literal["system_message"] = "system_message"
|
|
15
|
+
id: str
|
|
16
|
+
date: dt.datetime
|
|
17
|
+
message: str
|
|
18
|
+
|
|
19
|
+
if IS_PYDANTIC_V2:
|
|
20
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
21
|
+
else:
|
|
22
|
+
|
|
23
|
+
class Config:
|
|
24
|
+
frozen = True
|
|
25
|
+
smart_union = True
|
|
26
|
+
extra = pydantic.Extra.allow
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class MessagesListResponseItem_UserMessage(UniversalBaseModel):
|
|
30
|
+
message_type: typing.Literal["user_message"] = "user_message"
|
|
31
|
+
id: str
|
|
32
|
+
date: dt.datetime
|
|
33
|
+
message: str
|
|
34
|
+
|
|
35
|
+
if IS_PYDANTIC_V2:
|
|
36
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
37
|
+
else:
|
|
38
|
+
|
|
39
|
+
class Config:
|
|
40
|
+
frozen = True
|
|
41
|
+
smart_union = True
|
|
42
|
+
extra = pydantic.Extra.allow
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class MessagesListResponseItem_ReasoningMessage(UniversalBaseModel):
|
|
46
|
+
message_type: typing.Literal["reasoning_message"] = "reasoning_message"
|
|
47
|
+
id: str
|
|
48
|
+
date: dt.datetime
|
|
49
|
+
reasoning: str
|
|
50
|
+
|
|
51
|
+
if IS_PYDANTIC_V2:
|
|
52
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
53
|
+
else:
|
|
54
|
+
|
|
55
|
+
class Config:
|
|
56
|
+
frozen = True
|
|
57
|
+
smart_union = True
|
|
58
|
+
extra = pydantic.Extra.allow
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class MessagesListResponseItem_ToolCallMessage(UniversalBaseModel):
|
|
62
|
+
message_type: typing.Literal["tool_call_message"] = "tool_call_message"
|
|
63
|
+
id: str
|
|
64
|
+
date: dt.datetime
|
|
65
|
+
tool_call: ToolCallMessageToolCall
|
|
66
|
+
|
|
67
|
+
if IS_PYDANTIC_V2:
|
|
68
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
69
|
+
else:
|
|
70
|
+
|
|
71
|
+
class Config:
|
|
72
|
+
frozen = True
|
|
73
|
+
smart_union = True
|
|
74
|
+
extra = pydantic.Extra.allow
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class MessagesListResponseItem_ToolReturnMessage(UniversalBaseModel):
|
|
78
|
+
message_type: typing.Literal["tool_return_message"] = "tool_return_message"
|
|
79
|
+
id: str
|
|
80
|
+
date: dt.datetime
|
|
81
|
+
tool_return: str
|
|
82
|
+
status: ToolReturnMessageStatus
|
|
83
|
+
tool_call_id: str
|
|
84
|
+
stdout: typing.Optional[typing.List[str]] = None
|
|
85
|
+
stderr: typing.Optional[typing.List[str]] = None
|
|
86
|
+
|
|
87
|
+
if IS_PYDANTIC_V2:
|
|
88
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
89
|
+
else:
|
|
90
|
+
|
|
91
|
+
class Config:
|
|
92
|
+
frozen = True
|
|
93
|
+
smart_union = True
|
|
94
|
+
extra = pydantic.Extra.allow
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class MessagesListResponseItem_AssistantMessage(UniversalBaseModel):
|
|
98
|
+
message_type: typing.Literal["assistant_message"] = "assistant_message"
|
|
99
|
+
id: str
|
|
100
|
+
date: dt.datetime
|
|
101
|
+
assistant_message: str
|
|
102
|
+
|
|
103
|
+
if IS_PYDANTIC_V2:
|
|
104
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
105
|
+
else:
|
|
106
|
+
|
|
107
|
+
class Config:
|
|
108
|
+
frozen = True
|
|
109
|
+
smart_union = True
|
|
110
|
+
extra = pydantic.Extra.allow
|
|
111
|
+
|
|
10
112
|
|
|
11
113
|
MessagesListResponseItem = typing.Union[
|
|
12
|
-
|
|
114
|
+
MessagesListResponseItem_SystemMessage,
|
|
115
|
+
MessagesListResponseItem_UserMessage,
|
|
116
|
+
MessagesListResponseItem_ReasoningMessage,
|
|
117
|
+
MessagesListResponseItem_ToolCallMessage,
|
|
118
|
+
MessagesListResponseItem_ToolReturnMessage,
|
|
119
|
+
MessagesListResponseItem_AssistantMessage,
|
|
13
120
|
]
|
letta/agents/types/__init__.py
CHANGED
|
@@ -3,23 +3,28 @@
|
|
|
3
3
|
from .agents_get_agent_variables_response import AgentsGetAgentVariablesResponse
|
|
4
4
|
from .agents_migrate_response import AgentsMigrateResponse
|
|
5
5
|
from .agents_search_deployed_agents_request_combinator import AgentsSearchDeployedAgentsRequestCombinator
|
|
6
|
-
from .agents_search_deployed_agents_request_search_item import
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
from .agents_search_deployed_agents_request_search_item import (
|
|
7
|
+
AgentsSearchDeployedAgentsRequestSearchItem,
|
|
8
|
+
AgentsSearchDeployedAgentsRequestSearchItem_Name,
|
|
9
|
+
AgentsSearchDeployedAgentsRequestSearchItem_OrderBy,
|
|
10
|
+
AgentsSearchDeployedAgentsRequestSearchItem_Version,
|
|
9
11
|
)
|
|
10
|
-
from .
|
|
11
|
-
|
|
12
|
+
from .agents_search_deployed_agents_request_search_item_name import AgentsSearchDeployedAgentsRequestSearchItemName
|
|
13
|
+
from .agents_search_deployed_agents_request_search_item_name_operator import (
|
|
14
|
+
AgentsSearchDeployedAgentsRequestSearchItemNameOperator,
|
|
12
15
|
)
|
|
13
|
-
from .
|
|
14
|
-
|
|
16
|
+
from .agents_search_deployed_agents_request_search_item_order_by import (
|
|
17
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderBy,
|
|
15
18
|
)
|
|
16
|
-
from .
|
|
17
|
-
|
|
19
|
+
from .agents_search_deployed_agents_request_search_item_order_by_direction import (
|
|
20
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection,
|
|
18
21
|
)
|
|
19
|
-
from .
|
|
20
|
-
|
|
22
|
+
from .agents_search_deployed_agents_request_search_item_order_by_value import (
|
|
23
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderByValue,
|
|
24
|
+
)
|
|
25
|
+
from .agents_search_deployed_agents_request_search_item_version import (
|
|
26
|
+
AgentsSearchDeployedAgentsRequestSearchItemVersion,
|
|
21
27
|
)
|
|
22
|
-
from .agents_search_deployed_agents_request_search_item_zero import AgentsSearchDeployedAgentsRequestSearchItemZero
|
|
23
28
|
from .create_agent_request_tool_rules_item import CreateAgentRequestToolRulesItem
|
|
24
29
|
from .update_agent_tool_rules_item import UpdateAgentToolRulesItem
|
|
25
30
|
|
|
@@ -28,12 +33,15 @@ __all__ = [
|
|
|
28
33
|
"AgentsMigrateResponse",
|
|
29
34
|
"AgentsSearchDeployedAgentsRequestCombinator",
|
|
30
35
|
"AgentsSearchDeployedAgentsRequestSearchItem",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
36
|
+
"AgentsSearchDeployedAgentsRequestSearchItemName",
|
|
37
|
+
"AgentsSearchDeployedAgentsRequestSearchItemNameOperator",
|
|
38
|
+
"AgentsSearchDeployedAgentsRequestSearchItemOrderBy",
|
|
39
|
+
"AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection",
|
|
40
|
+
"AgentsSearchDeployedAgentsRequestSearchItemOrderByValue",
|
|
41
|
+
"AgentsSearchDeployedAgentsRequestSearchItemVersion",
|
|
42
|
+
"AgentsSearchDeployedAgentsRequestSearchItem_Name",
|
|
43
|
+
"AgentsSearchDeployedAgentsRequestSearchItem_OrderBy",
|
|
44
|
+
"AgentsSearchDeployedAgentsRequestSearchItem_Version",
|
|
37
45
|
"CreateAgentRequestToolRulesItem",
|
|
38
46
|
"UpdateAgentToolRulesItem",
|
|
39
47
|
]
|
|
@@ -1,16 +1,67 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
3
5
|
import typing
|
|
4
|
-
from .
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
import pydantic
|
|
8
|
+
from .agents_search_deployed_agents_request_search_item_name_operator import (
|
|
9
|
+
AgentsSearchDeployedAgentsRequestSearchItemNameOperator,
|
|
7
10
|
)
|
|
8
|
-
from .
|
|
9
|
-
|
|
11
|
+
from .agents_search_deployed_agents_request_search_item_order_by_value import (
|
|
12
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderByValue,
|
|
10
13
|
)
|
|
14
|
+
from .agents_search_deployed_agents_request_search_item_order_by_direction import (
|
|
15
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class AgentsSearchDeployedAgentsRequestSearchItem_Version(UniversalBaseModel):
|
|
20
|
+
field: typing.Literal["version"] = "version"
|
|
21
|
+
value: str
|
|
22
|
+
|
|
23
|
+
if IS_PYDANTIC_V2:
|
|
24
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
25
|
+
else:
|
|
26
|
+
|
|
27
|
+
class Config:
|
|
28
|
+
frozen = True
|
|
29
|
+
smart_union = True
|
|
30
|
+
extra = pydantic.Extra.allow
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class AgentsSearchDeployedAgentsRequestSearchItem_Name(UniversalBaseModel):
|
|
34
|
+
field: typing.Literal["name"] = "name"
|
|
35
|
+
operator: AgentsSearchDeployedAgentsRequestSearchItemNameOperator
|
|
36
|
+
value: str
|
|
37
|
+
|
|
38
|
+
if IS_PYDANTIC_V2:
|
|
39
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
40
|
+
else:
|
|
41
|
+
|
|
42
|
+
class Config:
|
|
43
|
+
frozen = True
|
|
44
|
+
smart_union = True
|
|
45
|
+
extra = pydantic.Extra.allow
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class AgentsSearchDeployedAgentsRequestSearchItem_OrderBy(UniversalBaseModel):
|
|
49
|
+
field: typing.Literal["order_by"] = "order_by"
|
|
50
|
+
value: AgentsSearchDeployedAgentsRequestSearchItemOrderByValue
|
|
51
|
+
direction: AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection
|
|
52
|
+
|
|
53
|
+
if IS_PYDANTIC_V2:
|
|
54
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
55
|
+
else:
|
|
56
|
+
|
|
57
|
+
class Config:
|
|
58
|
+
frozen = True
|
|
59
|
+
smart_union = True
|
|
60
|
+
extra = pydantic.Extra.allow
|
|
61
|
+
|
|
11
62
|
|
|
12
63
|
AgentsSearchDeployedAgentsRequestSearchItem = typing.Union[
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
64
|
+
AgentsSearchDeployedAgentsRequestSearchItem_Version,
|
|
65
|
+
AgentsSearchDeployedAgentsRequestSearchItem_Name,
|
|
66
|
+
AgentsSearchDeployedAgentsRequestSearchItem_OrderBy,
|
|
16
67
|
]
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
AgentsSearchDeployedAgentsRequestSearchItemOperatorOperator,
|
|
4
|
+
from .agents_search_deployed_agents_request_search_item_name_operator import (
|
|
5
|
+
AgentsSearchDeployedAgentsRequestSearchItemNameOperator,
|
|
7
6
|
)
|
|
8
7
|
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
import typing
|
|
9
9
|
import pydantic
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
class
|
|
13
|
-
|
|
14
|
-
operator: AgentsSearchDeployedAgentsRequestSearchItemOperatorOperator
|
|
12
|
+
class AgentsSearchDeployedAgentsRequestSearchItemName(UniversalBaseModel):
|
|
13
|
+
operator: AgentsSearchDeployedAgentsRequestSearchItemNameOperator
|
|
15
14
|
value: str
|
|
16
15
|
|
|
17
16
|
if IS_PYDANTIC_V2:
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
|
+
from .agents_search_deployed_agents_request_search_item_order_by_value import (
|
|
5
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderByValue,
|
|
6
|
+
)
|
|
7
|
+
from .agents_search_deployed_agents_request_search_item_order_by_direction import (
|
|
8
|
+
AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection,
|
|
9
|
+
)
|
|
10
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
11
|
+
import typing
|
|
12
|
+
import pydantic
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class AgentsSearchDeployedAgentsRequestSearchItemOrderBy(UniversalBaseModel):
|
|
16
|
+
value: AgentsSearchDeployedAgentsRequestSearchItemOrderByValue
|
|
17
|
+
direction: AgentsSearchDeployedAgentsRequestSearchItemOrderByDirection
|
|
18
|
+
|
|
19
|
+
if IS_PYDANTIC_V2:
|
|
20
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
21
|
+
else:
|
|
22
|
+
|
|
23
|
+
class Config:
|
|
24
|
+
frozen = True
|
|
25
|
+
smart_union = True
|
|
26
|
+
extra = pydantic.Extra.allow
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
|
-
import typing
|
|
5
4
|
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
5
|
+
import typing
|
|
6
6
|
import pydantic
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class
|
|
10
|
-
field: typing.Literal["version"] = "version"
|
|
9
|
+
class AgentsSearchDeployedAgentsRequestSearchItemVersion(UniversalBaseModel):
|
|
11
10
|
value: str
|
|
12
11
|
|
|
13
12
|
if IS_PYDANTIC_V2:
|
letta/client.py
CHANGED
|
@@ -39,7 +39,7 @@ class Letta:
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
token : typing.
|
|
42
|
+
token : typing.Optional[str]
|
|
43
43
|
timeout : typing.Optional[float]
|
|
44
44
|
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
45
45
|
|
|
@@ -63,7 +63,7 @@ class Letta:
|
|
|
63
63
|
*,
|
|
64
64
|
base_url: typing.Optional[str] = None,
|
|
65
65
|
environment: LettaEnvironment = LettaEnvironment.LETTA_CLOUD,
|
|
66
|
-
token: typing.
|
|
66
|
+
token: typing.Optional[str] = None,
|
|
67
67
|
timeout: typing.Optional[float] = None,
|
|
68
68
|
follow_redirects: typing.Optional[bool] = True,
|
|
69
69
|
httpx_client: typing.Optional[httpx.Client] = None,
|
|
@@ -106,7 +106,7 @@ class AsyncLetta:
|
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
token : typing.
|
|
109
|
+
token : typing.Optional[str]
|
|
110
110
|
timeout : typing.Optional[float]
|
|
111
111
|
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
112
112
|
|
|
@@ -130,7 +130,7 @@ class AsyncLetta:
|
|
|
130
130
|
*,
|
|
131
131
|
base_url: typing.Optional[str] = None,
|
|
132
132
|
environment: LettaEnvironment = LettaEnvironment.LETTA_CLOUD,
|
|
133
|
-
token: typing.
|
|
133
|
+
token: typing.Optional[str] = None,
|
|
134
134
|
timeout: typing.Optional[float] = None,
|
|
135
135
|
follow_redirects: typing.Optional[bool] = True,
|
|
136
136
|
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
letta/core/client_wrapper.py
CHANGED
|
@@ -7,14 +7,8 @@ from .http_client import AsyncHttpClient
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class BaseClientWrapper:
|
|
10
|
-
def __init__(
|
|
11
|
-
self
|
|
12
|
-
*,
|
|
13
|
-
token: typing.Union[str, typing.Callable[[], str]],
|
|
14
|
-
base_url: str,
|
|
15
|
-
timeout: typing.Optional[float] = None,
|
|
16
|
-
):
|
|
17
|
-
self._token = token
|
|
10
|
+
def __init__(self, *, token: typing.Optional[str] = None, base_url: str, timeout: typing.Optional[float] = None):
|
|
11
|
+
self.token = token
|
|
18
12
|
self._base_url = base_url
|
|
19
13
|
self._timeout = timeout
|
|
20
14
|
|
|
@@ -22,17 +16,12 @@ class BaseClientWrapper:
|
|
|
22
16
|
headers: typing.Dict[str, str] = {
|
|
23
17
|
"X-Fern-Language": "Python",
|
|
24
18
|
"X-Fern-SDK-Name": "letta-client",
|
|
25
|
-
"X-Fern-SDK-Version": "0.1.
|
|
19
|
+
"X-Fern-SDK-Version": "0.1.6",
|
|
26
20
|
}
|
|
27
|
-
|
|
21
|
+
if self.token is not None:
|
|
22
|
+
headers["Authorization"] = f"Bearer {self.token}"
|
|
28
23
|
return headers
|
|
29
24
|
|
|
30
|
-
def _get_token(self) -> str:
|
|
31
|
-
if isinstance(self._token, str):
|
|
32
|
-
return self._token
|
|
33
|
-
else:
|
|
34
|
-
return self._token()
|
|
35
|
-
|
|
36
25
|
def get_base_url(self) -> str:
|
|
37
26
|
return self._base_url
|
|
38
27
|
|
|
@@ -44,7 +33,7 @@ class SyncClientWrapper(BaseClientWrapper):
|
|
|
44
33
|
def __init__(
|
|
45
34
|
self,
|
|
46
35
|
*,
|
|
47
|
-
token: typing.
|
|
36
|
+
token: typing.Optional[str] = None,
|
|
48
37
|
base_url: str,
|
|
49
38
|
timeout: typing.Optional[float] = None,
|
|
50
39
|
httpx_client: httpx.Client,
|
|
@@ -62,7 +51,7 @@ class AsyncClientWrapper(BaseClientWrapper):
|
|
|
62
51
|
def __init__(
|
|
63
52
|
self,
|
|
64
53
|
*,
|
|
65
|
-
token: typing.
|
|
54
|
+
token: typing.Optional[str] = None,
|
|
66
55
|
base_url: str,
|
|
67
56
|
timeout: typing.Optional[float] = None,
|
|
68
57
|
httpx_client: httpx.AsyncClient,
|
letta/types/__init__.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from .action_model import ActionModel
|
|
4
4
|
from .action_parameters_model import ActionParametersModel
|
|
5
5
|
from .action_response_model import ActionResponseModel
|
|
6
|
+
from .agent_environment_variable import AgentEnvironmentVariable
|
|
6
7
|
from .agent_state import AgentState
|
|
7
8
|
from .agent_state_tool_rules_item import AgentStateToolRulesItem
|
|
8
9
|
from .agent_type import AgentType
|
|
@@ -49,6 +50,15 @@ from .job import Job
|
|
|
49
50
|
from .job_status import JobStatus
|
|
50
51
|
from .letta_request import LettaRequest
|
|
51
52
|
from .letta_response import LettaResponse
|
|
53
|
+
from .letta_response_messages_item import (
|
|
54
|
+
LettaResponseMessagesItem,
|
|
55
|
+
LettaResponseMessagesItem_AssistantMessage,
|
|
56
|
+
LettaResponseMessagesItem_ReasoningMessage,
|
|
57
|
+
LettaResponseMessagesItem_SystemMessage,
|
|
58
|
+
LettaResponseMessagesItem_ToolCallMessage,
|
|
59
|
+
LettaResponseMessagesItem_ToolReturnMessage,
|
|
60
|
+
LettaResponseMessagesItem_UserMessage,
|
|
61
|
+
)
|
|
52
62
|
from .letta_schemas_letta_message_tool_call import LettaSchemasLettaMessageToolCall
|
|
53
63
|
from .letta_schemas_message_message import LettaSchemasMessageMessage
|
|
54
64
|
from .letta_schemas_openai_chat_completion_request_tool import LettaSchemasOpenaiChatCompletionRequestTool
|
|
@@ -119,6 +129,7 @@ __all__ = [
|
|
|
119
129
|
"ActionModel",
|
|
120
130
|
"ActionParametersModel",
|
|
121
131
|
"ActionResponseModel",
|
|
132
|
+
"AgentEnvironmentVariable",
|
|
122
133
|
"AgentState",
|
|
123
134
|
"AgentStateToolRulesItem",
|
|
124
135
|
"AgentType",
|
|
@@ -165,6 +176,13 @@ __all__ = [
|
|
|
165
176
|
"JobStatus",
|
|
166
177
|
"LettaRequest",
|
|
167
178
|
"LettaResponse",
|
|
179
|
+
"LettaResponseMessagesItem",
|
|
180
|
+
"LettaResponseMessagesItem_AssistantMessage",
|
|
181
|
+
"LettaResponseMessagesItem_ReasoningMessage",
|
|
182
|
+
"LettaResponseMessagesItem_SystemMessage",
|
|
183
|
+
"LettaResponseMessagesItem_ToolCallMessage",
|
|
184
|
+
"LettaResponseMessagesItem_ToolReturnMessage",
|
|
185
|
+
"LettaResponseMessagesItem_UserMessage",
|
|
168
186
|
"LettaSchemasLettaMessageToolCall",
|
|
169
187
|
"LettaSchemasMessageMessage",
|
|
170
188
|
"LettaSchemasOpenaiChatCompletionRequestTool",
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
import pydantic
|
|
6
|
+
import datetime as dt
|
|
7
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class AgentEnvironmentVariable(UniversalBaseModel):
|
|
11
|
+
created_by_id: typing.Optional[str] = pydantic.Field(default=None)
|
|
12
|
+
"""
|
|
13
|
+
The id of the user that made this object.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
last_updated_by_id: typing.Optional[str] = pydantic.Field(default=None)
|
|
17
|
+
"""
|
|
18
|
+
The id of the user that made this object.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
|
|
22
|
+
"""
|
|
23
|
+
The timestamp when the object was created.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
|
|
27
|
+
"""
|
|
28
|
+
The timestamp when the object was last updated.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
id: typing.Optional[str] = pydantic.Field(default=None)
|
|
32
|
+
"""
|
|
33
|
+
The human-friendly ID of the Agent-env
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
key: str = pydantic.Field()
|
|
37
|
+
"""
|
|
38
|
+
The name of the environment variable.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
value: str = pydantic.Field()
|
|
42
|
+
"""
|
|
43
|
+
The value of the environment variable.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
description: typing.Optional[str] = pydantic.Field(default=None)
|
|
47
|
+
"""
|
|
48
|
+
An optional description of the environment variable.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
organization_id: typing.Optional[str] = pydantic.Field(default=None)
|
|
52
|
+
"""
|
|
53
|
+
The ID of the organization this environment variable belongs to.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
agent_id: str = pydantic.Field()
|
|
57
|
+
"""
|
|
58
|
+
The ID of the agent this environment variable belongs to.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
if IS_PYDANTIC_V2:
|
|
62
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
63
|
+
else:
|
|
64
|
+
|
|
65
|
+
class Config:
|
|
66
|
+
frozen = True
|
|
67
|
+
smart_union = True
|
|
68
|
+
extra = pydantic.Extra.allow
|
letta/types/agent_state.py
CHANGED
|
@@ -13,6 +13,7 @@ from ..core.serialization import FieldMetadata
|
|
|
13
13
|
from .memory import Memory
|
|
14
14
|
from .letta_schemas_tool_tool import LettaSchemasToolTool
|
|
15
15
|
from .source import Source
|
|
16
|
+
from .agent_environment_variable import AgentEnvironmentVariable
|
|
16
17
|
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
17
18
|
|
|
18
19
|
|
|
@@ -21,15 +22,15 @@ class AgentState(UniversalBaseModel):
|
|
|
21
22
|
Representation of an agent's state. This is the state of the agent at a given time, and is persisted in the DB backend. The state has all the information needed to recreate a persisted agent.
|
|
22
23
|
|
|
23
24
|
Parameters:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
id (str): The unique identifier of the agent.
|
|
26
|
+
name (str): The name of the agent (must be unique to the user).
|
|
27
|
+
created_at (datetime): The datetime the agent was created.
|
|
28
|
+
message_ids (List[str]): The ids of the messages in the agent's in-context memory.
|
|
29
|
+
memory (Memory): The in-context memory of the agent.
|
|
30
|
+
tools (List[str]): The tools used by the agent. This includes any memory editing functions specified in `memory`.
|
|
31
|
+
system (str): The system prompt used by the agent.
|
|
32
|
+
llm_config (LLMConfig): The LLM configuration used by the agent.
|
|
33
|
+
embedding_config (EmbeddingConfig): The embedding configuration used by the agent.
|
|
33
34
|
"""
|
|
34
35
|
|
|
35
36
|
created_by_id: typing.Optional[str] = pydantic.Field(default=None)
|
|
@@ -129,6 +130,11 @@ class AgentState(UniversalBaseModel):
|
|
|
129
130
|
The tags associated with the agent.
|
|
130
131
|
"""
|
|
131
132
|
|
|
133
|
+
tool_exec_environment_variables: typing.List[AgentEnvironmentVariable] = pydantic.Field()
|
|
134
|
+
"""
|
|
135
|
+
The environment variables for tool execution specific to this agent.
|
|
136
|
+
"""
|
|
137
|
+
|
|
132
138
|
if IS_PYDANTIC_V2:
|
|
133
139
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
134
140
|
else:
|
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
4
|
import datetime as dt
|
|
5
|
-
import typing
|
|
6
5
|
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
|
+
import typing
|
|
7
7
|
import pydantic
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class AssistantMessageOutput(UniversalBaseModel):
|
|
11
11
|
id: str
|
|
12
12
|
date: dt.datetime
|
|
13
|
-
message_type: typing.Literal["assistant_message"] = "assistant_message"
|
|
14
13
|
assistant_message: str
|
|
15
14
|
|
|
16
15
|
if IS_PYDANTIC_V2:
|
letta/types/block.py
CHANGED
|
@@ -13,15 +13,15 @@ class Block(UniversalBaseModel):
|
|
|
13
13
|
A Block represents a reserved section of the LLM's context window which is editable. `Block` objects contained in the `Memory` object, which is able to edit the Block values.
|
|
14
14
|
|
|
15
15
|
Parameters:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
label (str): The label of the block (e.g. 'human', 'persona'). This defines a category for the block.
|
|
17
|
+
value (str): The value of the block. This is the string that is represented in the context window.
|
|
18
|
+
limit (int): The character limit of the block.
|
|
19
|
+
is_template (bool): Whether the block is a template (e.g. saved human/persona options). Non-template blocks are not stored in the database and are ephemeral, while templated blocks are stored in the database.
|
|
20
|
+
label (str): The label of the block (e.g. 'human', 'persona'). This defines a category for the block.
|
|
21
|
+
template_name (str): The name of the block template (if it is a template).
|
|
22
|
+
description (str): Description of the block.
|
|
23
|
+
metadata_ (Dict): Metadata of the block.
|
|
24
|
+
user_id (str): The unique identifier of the user associated with the block.
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
value: str = pydantic.Field()
|