letta-client 0.1.2__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.
Files changed (65) hide show
  1. letta/__init__.py +40 -34
  2. letta/agents/__init__.py +55 -3
  3. letta/agents/client.py +513 -35
  4. letta/agents/messages/__init__.py +36 -2
  5. letta/agents/messages/client.py +46 -0
  6. letta/agents/messages/types/__init__.py +37 -3
  7. letta/agents/messages/types/letta_streaming_response.py +132 -14
  8. letta/agents/messages/types/messages_list_response_item.py +114 -7
  9. letta/agents/types/__init__.py +36 -2
  10. letta/agents/types/{agents_create_version_response.py → agents_get_agent_variables_response.py} +2 -5
  11. letta/agents/types/agents_search_deployed_agents_request_combinator.py +5 -0
  12. letta/agents/types/agents_search_deployed_agents_request_search_item.py +67 -0
  13. letta/agents/types/agents_search_deployed_agents_request_search_item_name.py +23 -0
  14. letta/agents/types/agents_search_deployed_agents_request_search_item_name_operator.py +7 -0
  15. letta/agents/types/agents_search_deployed_agents_request_search_item_order_by.py +26 -0
  16. letta/agents/types/agents_search_deployed_agents_request_search_item_order_by_direction.py +5 -0
  17. letta/agents/types/agents_search_deployed_agents_request_search_item_order_by_value.py +7 -0
  18. letta/{types/letta_response_tool_call.py → agents/types/agents_search_deployed_agents_request_search_item_version.py} +4 -6
  19. letta/client.py +8 -8
  20. letta/core/client_wrapper.py +7 -18
  21. letta/environment.py +1 -1
  22. letta/types/__init__.py +18 -32
  23. letta/types/agent_environment_variable.py +68 -0
  24. letta/types/agent_state.py +15 -9
  25. letta/types/assistant_message_output.py +1 -2
  26. letta/types/block.py +9 -9
  27. letta/types/context_window_overview.py +5 -0
  28. letta/types/embedding_config.py +13 -8
  29. letta/types/internal_server_error_body.py +1 -1
  30. letta/types/job.py +5 -5
  31. letta/types/letta_response.py +10 -97
  32. letta/types/letta_response_messages_item.py +120 -0
  33. letta/types/letta_schemas_message_message.py +10 -10
  34. letta/types/letta_schemas_tool_tool.py +5 -5
  35. letta/types/letta_usage_statistics.py +4 -4
  36. letta/types/llm_config.py +12 -7
  37. letta/types/not_found_error_body.py +2 -3
  38. letta/types/passage.py +8 -8
  39. letta/types/reasoning_message.py +4 -5
  40. letta/types/sandbox_environment_variable.py +4 -4
  41. letta/types/sandbox_environment_variable_update.py +0 -4
  42. letta/types/source.py +6 -6
  43. letta/types/system_message_output.py +4 -5
  44. letta/types/tool_call_message.py +4 -5
  45. letta/types/tool_return_message.py +8 -9
  46. letta/types/user.py +3 -3
  47. letta/types/user_message_output.py +4 -5
  48. {letta_client-0.1.2.dist-info → letta_client-0.1.6.dist-info}/METADATA +1 -1
  49. {letta_client-0.1.2.dist-info → letta_client-0.1.6.dist-info}/RECORD +50 -56
  50. {letta_client-0.1.2.dist-info → letta_client-0.1.6.dist-info}/WHEEL +1 -1
  51. letta/types/letta_response_assistant_message.py +0 -23
  52. letta/types/letta_response_letta_usage_statistics.py +0 -47
  53. letta/types/letta_response_reasoning_message.py +0 -32
  54. letta/types/letta_response_system_message.py +0 -32
  55. letta/types/letta_response_tool_call_delta.py +0 -21
  56. letta/types/letta_response_tool_call_message.py +0 -33
  57. letta/types/letta_response_tool_call_message_tool_call.py +0 -9
  58. letta/types/letta_response_tool_call_message_tool_call_one.py +0 -21
  59. letta/types/letta_response_tool_call_message_tool_call_zero.py +0 -21
  60. letta/types/letta_response_tool_return_message.py +0 -41
  61. letta/types/letta_response_tool_return_message_status.py +0 -5
  62. letta/types/letta_response_usage_message.py +0 -40
  63. letta/types/letta_response_usage_message_usage.py +0 -47
  64. letta/types/letta_response_user_message.py +0 -32
  65. letta/types/usage_message.py +0 -31
letta/client.py CHANGED
@@ -35,11 +35,11 @@ class Letta:
35
35
 
36
36
 
37
37
 
38
- Defaults to LettaEnvironment.LETTA_HOSTED
38
+ Defaults to LettaEnvironment.LETTA_CLOUD
39
39
 
40
40
 
41
41
 
42
- token : typing.Union[str, typing.Callable[[], str]]
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
 
@@ -62,8 +62,8 @@ class Letta:
62
62
  self,
63
63
  *,
64
64
  base_url: typing.Optional[str] = None,
65
- environment: LettaEnvironment = LettaEnvironment.LETTA_HOSTED,
66
- token: typing.Union[str, typing.Callable[[], str]],
65
+ environment: LettaEnvironment = LettaEnvironment.LETTA_CLOUD,
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,
@@ -102,11 +102,11 @@ class AsyncLetta:
102
102
 
103
103
 
104
104
 
105
- Defaults to LettaEnvironment.LETTA_HOSTED
105
+ Defaults to LettaEnvironment.LETTA_CLOUD
106
106
 
107
107
 
108
108
 
109
- token : typing.Union[str, typing.Callable[[], str]]
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
 
@@ -129,8 +129,8 @@ class AsyncLetta:
129
129
  self,
130
130
  *,
131
131
  base_url: typing.Optional[str] = None,
132
- environment: LettaEnvironment = LettaEnvironment.LETTA_HOSTED,
133
- token: typing.Union[str, typing.Callable[[], str]],
132
+ environment: LettaEnvironment = LettaEnvironment.LETTA_CLOUD,
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,
@@ -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.2",
19
+ "X-Fern-SDK-Version": "0.1.6",
26
20
  }
27
- headers["Authorization"] = f"Bearer {self._get_token()}"
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.Union[str, typing.Callable[[], str]],
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.Union[str, typing.Callable[[], str]],
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/environment.py CHANGED
@@ -4,5 +4,5 @@ import enum
4
4
 
5
5
 
6
6
  class LettaEnvironment(enum.Enum):
7
- LETTA_HOSTED = "https://app.letta.com"
7
+ LETTA_CLOUD = "https://app.letta.com"
8
8
  SELF_HOSTED = "http://localhost:8283"
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,21 +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
52
- from .letta_response_assistant_message import LettaResponseAssistantMessage
53
- from .letta_response_letta_usage_statistics import LettaResponseLettaUsageStatistics
54
- from .letta_response_reasoning_message import LettaResponseReasoningMessage
55
- from .letta_response_system_message import LettaResponseSystemMessage
56
- from .letta_response_tool_call import LettaResponseToolCall
57
- from .letta_response_tool_call_delta import LettaResponseToolCallDelta
58
- from .letta_response_tool_call_message import LettaResponseToolCallMessage
59
- from .letta_response_tool_call_message_tool_call import LettaResponseToolCallMessageToolCall
60
- from .letta_response_tool_call_message_tool_call_one import LettaResponseToolCallMessageToolCallOne
61
- from .letta_response_tool_call_message_tool_call_zero import LettaResponseToolCallMessageToolCallZero
62
- from .letta_response_tool_return_message import LettaResponseToolReturnMessage
63
- from .letta_response_tool_return_message_status import LettaResponseToolReturnMessageStatus
64
- from .letta_response_usage_message import LettaResponseUsageMessage
65
- from .letta_response_usage_message_usage import LettaResponseUsageMessageUsage
66
- from .letta_response_user_message import LettaResponseUserMessage
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
+ )
67
62
  from .letta_schemas_letta_message_tool_call import LettaSchemasLettaMessageToolCall
68
63
  from .letta_schemas_message_message import LettaSchemasMessageMessage
69
64
  from .letta_schemas_openai_chat_completion_request_tool import LettaSchemasOpenaiChatCompletionRequestTool
@@ -120,7 +115,6 @@ from .tool_message import ToolMessage
120
115
  from .tool_return_message import ToolReturnMessage
121
116
  from .tool_return_message_status import ToolReturnMessageStatus
122
117
  from .tool_rule_type import ToolRuleType
123
- from .usage_message import UsageMessage
124
118
  from .usage_statistics import UsageStatistics
125
119
  from .user import User
126
120
  from .user_create import UserCreate
@@ -135,6 +129,7 @@ __all__ = [
135
129
  "ActionModel",
136
130
  "ActionParametersModel",
137
131
  "ActionResponseModel",
132
+ "AgentEnvironmentVariable",
138
133
  "AgentState",
139
134
  "AgentStateToolRulesItem",
140
135
  "AgentType",
@@ -181,21 +176,13 @@ __all__ = [
181
176
  "JobStatus",
182
177
  "LettaRequest",
183
178
  "LettaResponse",
184
- "LettaResponseAssistantMessage",
185
- "LettaResponseLettaUsageStatistics",
186
- "LettaResponseReasoningMessage",
187
- "LettaResponseSystemMessage",
188
- "LettaResponseToolCall",
189
- "LettaResponseToolCallDelta",
190
- "LettaResponseToolCallMessage",
191
- "LettaResponseToolCallMessageToolCall",
192
- "LettaResponseToolCallMessageToolCallOne",
193
- "LettaResponseToolCallMessageToolCallZero",
194
- "LettaResponseToolReturnMessage",
195
- "LettaResponseToolReturnMessageStatus",
196
- "LettaResponseUsageMessage",
197
- "LettaResponseUsageMessageUsage",
198
- "LettaResponseUserMessage",
179
+ "LettaResponseMessagesItem",
180
+ "LettaResponseMessagesItem_AssistantMessage",
181
+ "LettaResponseMessagesItem_ReasoningMessage",
182
+ "LettaResponseMessagesItem_SystemMessage",
183
+ "LettaResponseMessagesItem_ToolCallMessage",
184
+ "LettaResponseMessagesItem_ToolReturnMessage",
185
+ "LettaResponseMessagesItem_UserMessage",
199
186
  "LettaSchemasLettaMessageToolCall",
200
187
  "LettaSchemasMessageMessage",
201
188
  "LettaSchemasOpenaiChatCompletionRequestTool",
@@ -250,7 +237,6 @@ __all__ = [
250
237
  "ToolReturnMessage",
251
238
  "ToolReturnMessageStatus",
252
239
  "ToolRuleType",
253
- "UsageMessage",
254
240
  "UsageStatistics",
255
241
  "User",
256
242
  "UserCreate",
@@ -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
@@ -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
- id (str): The unique identifier of the agent.
25
- name (str): The name of the agent (must be unique to the user).
26
- created_at (datetime): The datetime the agent was created.
27
- message_ids (List[str]): The ids of the messages in the agent's in-context memory.
28
- memory (Memory): The in-context memory of the agent.
29
- tools (List[str]): The tools used by the agent. This includes any memory editing functions specified in `memory`.
30
- system (str): The system prompt used by the agent.
31
- llm_config (LLMConfig): The LLM configuration used by the agent.
32
- embedding_config (EmbeddingConfig): The embedding configuration used by the agent.
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
- 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.
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()
@@ -43,6 +43,11 @@ class ContextWindowOverview(UniversalBaseModel):
43
43
  The number of tokens in the external memory summary (archival + recall metadata).
44
44
  """
45
45
 
46
+ external_memory_summary: str = pydantic.Field()
47
+ """
48
+ The metadata summary of the external memory sources (archival + recall metadata).
49
+ """
50
+
46
51
  num_tokens_system: int = pydantic.Field()
47
52
  """
48
53
  The number of tokens in the system prompt.
@@ -12,14 +12,14 @@ class EmbeddingConfig(UniversalBaseModel):
12
12
  Embedding model configuration. This object specifies all the information necessary to access an embedding model to usage with Letta, except for secret keys.
13
13
 
14
14
  Attributes:
15
- embedding_endpoint_type (str): The endpoint type for the model.
16
- embedding_endpoint (str): The endpoint for the model.
17
- embedding_model (str): The model for the embedding.
18
- embedding_dim (int): The dimension of the embedding.
19
- embedding_chunk_size (int): The chunk size of the embedding.
20
- azure_endpoint (:obj:`str`, optional): The Azure endpoint for the model (Azure only).
21
- azure_version (str): The Azure version for the model (Azure only).
22
- azure_deployment (str): The Azure deployment for the model (Azure only).
15
+ embedding_endpoint_type (str): The endpoint type for the model.
16
+ embedding_endpoint (str): The endpoint for the model.
17
+ embedding_model (str): The model for the embedding.
18
+ embedding_dim (int): The dimension of the embedding.
19
+ embedding_chunk_size (int): The chunk size of the embedding.
20
+ azure_endpoint (:obj:`str`, optional): The Azure endpoint for the model (Azure only).
21
+ azure_version (str): The Azure version for the model (Azure only).
22
+ azure_deployment (str): The Azure deployment for the model (Azure only).
23
23
  """
24
24
 
25
25
  embedding_endpoint_type: EmbeddingConfigEmbeddingEndpointType = pydantic.Field()
@@ -47,6 +47,11 @@ class EmbeddingConfig(UniversalBaseModel):
47
47
  The chunk size of the embedding.
48
48
  """
49
49
 
50
+ handle: typing.Optional[str] = pydantic.Field(default=None)
51
+ """
52
+ The handle for this config, in the format provider/model-name.
53
+ """
54
+
50
55
  azure_endpoint: typing.Optional[str] = pydantic.Field(default=None)
51
56
  """
52
57
  The Azure endpoint for the model.
@@ -7,7 +7,7 @@ import pydantic
7
7
 
8
8
 
9
9
  class InternalServerErrorBody(UniversalBaseModel):
10
- message: typing.Literal["Migration failed"] = "Migration failed"
10
+ message: typing.Literal["Failed to create agent template"] = "Failed to create agent template"
11
11
 
12
12
  if IS_PYDANTIC_V2:
13
13
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
letta/types/job.py CHANGED
@@ -15,11 +15,11 @@ class Job(UniversalBaseModel):
15
15
  Representation of offline jobs, used for tracking status of data loading tasks (involving parsing and embedding files).
16
16
 
17
17
  Parameters:
18
- id (str): The unique identifier of the job.
19
- status (JobStatus): The status of the job.
20
- created_at (datetime): The unix timestamp of when the job was created.
21
- completed_at (datetime): The unix timestamp of when the job was completed.
22
- user_id (str): The unique identifier of the user associated with the.
18
+ id (str): The unique identifier of the job.
19
+ status (JobStatus): The status of the job.
20
+ created_at (datetime): The unix timestamp of when the job was created.
21
+ completed_at (datetime): The unix timestamp of when the job was completed.
22
+ user_id (str): The unique identifier of the user associated with the.
23
23
  """
24
24
 
25
25
  created_by_id: typing.Optional[str] = pydantic.Field(default=None)
@@ -1,118 +1,31 @@
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_extensions
5
4
  import typing
6
- from .letta_response_assistant_message import LettaResponseAssistantMessage
7
- from ..core.serialization import FieldMetadata
8
- from .letta_response_letta_usage_statistics import LettaResponseLettaUsageStatistics
5
+ from .letta_response_messages_item import LettaResponseMessagesItem
9
6
  import pydantic
10
- from .letta_response_reasoning_message import LettaResponseReasoningMessage
11
- from .letta_response_system_message import LettaResponseSystemMessage
12
- from .letta_response_tool_call import LettaResponseToolCall
13
- from .letta_response_tool_call_delta import LettaResponseToolCallDelta
14
- from .letta_response_tool_call_message import LettaResponseToolCallMessage
15
- from .letta_response_tool_return_message import LettaResponseToolReturnMessage
16
- from .letta_response_usage_message import LettaResponseUsageMessage
17
- from .letta_response_user_message import LettaResponseUserMessage
7
+ from .letta_usage_statistics import LettaUsageStatistics
18
8
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
19
9
 
20
10
 
21
11
  class LettaResponse(UniversalBaseModel):
22
- assistant_message: typing_extensions.Annotated[
23
- typing.Optional[LettaResponseAssistantMessage], FieldMetadata(alias="AssistantMessage")
24
- ] = None
25
- letta_usage_statistics: typing_extensions.Annotated[
26
- typing.Optional[LettaResponseLettaUsageStatistics], FieldMetadata(alias="LettaUsageStatistics")
27
- ] = pydantic.Field(default=None)
28
- """
29
- Usage statistics for the agent interaction.
30
-
31
- Attributes:
32
- completion_tokens (int): The number of tokens generated by the agent.
33
- prompt_tokens (int): The number of tokens in the prompt.
34
- total_tokens (int): The total number of tokens processed by the agent.
35
- step_count (int): The number of steps taken by the agent.
36
12
  """
13
+ Response object from an agent interaction, consisting of the new messages generated by the agent and usage statistics.
14
+ The type of the returned messages can be either `Message` or `LettaMessage`, depending on what was specified in the request.
37
15
 
38
- reasoning_message: typing_extensions.Annotated[
39
- typing.Optional[LettaResponseReasoningMessage], FieldMetadata(alias="ReasoningMessage")
40
- ] = pydantic.Field(default=None)
41
- """
42
- Representation of an agent's internal reasoning.
43
-
44
16
  Attributes:
45
- reasoning (str): The internal reasoning of the agent
46
- id (str): The ID of the message
47
- date (datetime): The date the message was created in ISO format
17
+ messages (List[Union[Message, LettaMessage]]): The messages returned by the agent.
18
+ usage (LettaUsageStatistics): The usage statistics
48
19
  """
49
20
 
50
- system_message: typing_extensions.Annotated[
51
- typing.Optional[LettaResponseSystemMessage], FieldMetadata(alias="SystemMessage")
52
- ] = pydantic.Field(default=None)
21
+ messages: typing.List[LettaResponseMessagesItem] = pydantic.Field()
53
22
  """
54
- A message generated by the system. Never streamed back on a response, only used for cursor pagination.
55
-
56
- Attributes:
57
- message (str): The message sent by the system
58
- id (str): The ID of the message
59
- date (datetime): The date the message was created in ISO format
23
+ The messages returned by the agent.
60
24
  """
61
25
 
62
- tool_call: typing_extensions.Annotated[typing.Optional[LettaResponseToolCall], FieldMetadata(alias="ToolCall")] = (
63
- None
64
- )
65
- tool_call_delta: typing_extensions.Annotated[
66
- typing.Optional[LettaResponseToolCallDelta], FieldMetadata(alias="ToolCallDelta")
67
- ] = None
68
- tool_call_message: typing_extensions.Annotated[
69
- typing.Optional[LettaResponseToolCallMessage], FieldMetadata(alias="ToolCallMessage")
70
- ] = pydantic.Field(default=None)
26
+ usage: LettaUsageStatistics = pydantic.Field()
71
27
  """
72
- A message representing a request to call a tool (generated by the LLM to trigger tool execution).
73
-
74
- Attributes:
75
- tool_call (Union[ToolCall, ToolCallDelta]): The tool call
76
- id (str): The ID of the message
77
- date (datetime): The date the message was created in ISO format
78
- """
79
-
80
- tool_return_message: typing_extensions.Annotated[
81
- typing.Optional[LettaResponseToolReturnMessage], FieldMetadata(alias="ToolReturnMessage")
82
- ] = pydantic.Field(default=None)
83
- """
84
- A message representing the return value of a tool call (generated by Letta executing the requested tool).
85
-
86
- Attributes:
87
- tool_return (str): The return value of the tool
88
- status (Literal["success", "error"]): The status of the tool call
89
- id (str): The ID of the message
90
- date (datetime): The date the message was created in ISO format
91
- tool_call_id (str): A unique identifier for the tool call that generated this message
92
- stdout (Optional[List(str)]): Captured stdout (e.g. prints, logs) from the tool invocation
93
- stderr (Optional[List(str)]): Captured stderr from the tool invocation
94
- """
95
-
96
- usage_message: typing_extensions.Annotated[
97
- typing.Optional[LettaResponseUsageMessage], FieldMetadata(alias="UsageMessage")
98
- ] = pydantic.Field(default=None)
99
- """
100
- A message representint the usage statistics for the agent interaction.
101
-
102
- Attributes:
103
- usage (LettaUsageStatistics): Usage statistics for the agent interaction.
104
- """
105
-
106
- user_message: typing_extensions.Annotated[
107
- typing.Optional[LettaResponseUserMessage], FieldMetadata(alias="UserMessage")
108
- ] = pydantic.Field(default=None)
109
- """
110
- A message sent by the user. Never streamed back on a response, only used for cursor pagination.
111
-
112
- Attributes:
113
- message (str): The message sent by the user
114
- id (str): The ID of the message
115
- date (datetime): The date the message was created in ISO format
28
+ The usage statistics of the agent.
116
29
  """
117
30
 
118
31
  if IS_PYDANTIC_V2: