letta-client 0.1.0__py3-none-any.whl → 0.1.4__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.

Files changed (193) hide show
  1. letta/__init__.py +277 -0
  2. letta/agents/__init__.py +44 -0
  3. letta/agents/archival_memory/__init__.py +2 -0
  4. letta/agents/archival_memory/client.py +591 -0
  5. letta/agents/client.py +2604 -0
  6. letta/agents/context/__init__.py +2 -0
  7. letta/agents/context/client.py +145 -0
  8. letta/agents/memory/__init__.py +5 -0
  9. letta/agents/memory/client.py +149 -0
  10. letta/agents/memory/messages/__init__.py +2 -0
  11. letta/agents/memory/messages/client.py +147 -0
  12. letta/agents/memory_blocks/__init__.py +2 -0
  13. letta/agents/memory_blocks/client.py +364 -0
  14. letta/agents/messages/__init__.py +5 -0
  15. letta/agents/messages/client.py +787 -0
  16. letta/agents/messages/types/__init__.py +7 -0
  17. letta/agents/messages/types/letta_streaming_response.py +20 -0
  18. letta/agents/messages/types/messages_list_response.py +7 -0
  19. letta/agents/messages/types/messages_list_response_item.py +13 -0
  20. letta/agents/recall_memory/__init__.py +2 -0
  21. letta/agents/recall_memory/client.py +147 -0
  22. letta/agents/sources/__init__.py +2 -0
  23. letta/agents/sources/client.py +145 -0
  24. letta/agents/tools/__init__.py +2 -0
  25. letta/agents/tools/client.py +408 -0
  26. letta/agents/types/__init__.py +39 -0
  27. letta/agents/types/agents_get_agent_variables_response.py +19 -0
  28. letta/agents/types/agents_migrate_response.py +19 -0
  29. letta/agents/types/agents_search_deployed_agents_request_combinator.py +5 -0
  30. letta/agents/types/agents_search_deployed_agents_request_search_item.py +16 -0
  31. letta/agents/types/agents_search_deployed_agents_request_search_item_direction.py +27 -0
  32. letta/agents/types/agents_search_deployed_agents_request_search_item_direction_direction.py +5 -0
  33. letta/agents/types/agents_search_deployed_agents_request_search_item_direction_value.py +7 -0
  34. letta/agents/types/agents_search_deployed_agents_request_search_item_operator.py +24 -0
  35. letta/agents/types/agents_search_deployed_agents_request_search_item_operator_operator.py +7 -0
  36. letta/agents/types/agents_search_deployed_agents_request_search_item_zero.py +20 -0
  37. letta/agents/types/create_agent_request_tool_rules_item.py +9 -0
  38. letta/agents/types/update_agent_tool_rules_item.py +9 -0
  39. letta/blocks/__init__.py +2 -0
  40. letta/blocks/client.py +1054 -0
  41. letta/client.py +164 -0
  42. letta/core/__init__.py +47 -0
  43. letta/core/api_error.py +15 -0
  44. letta/core/client_wrapper.py +76 -0
  45. letta/core/datetime_utils.py +28 -0
  46. letta/core/file.py +67 -0
  47. letta/core/http_client.py +499 -0
  48. letta/core/jsonable_encoder.py +101 -0
  49. letta/core/pydantic_utilities.py +296 -0
  50. letta/core/query_encoder.py +58 -0
  51. letta/core/remove_none_from_dict.py +11 -0
  52. letta/core/request_options.py +35 -0
  53. letta/core/serialization.py +272 -0
  54. letta/environment.py +8 -0
  55. letta/errors/__init__.py +8 -0
  56. letta/errors/conflict_error.py +9 -0
  57. letta/errors/internal_server_error.py +9 -0
  58. letta/errors/not_found_error.py +9 -0
  59. letta/errors/unprocessable_entity_error.py +9 -0
  60. letta/health/__init__.py +2 -0
  61. letta/health/client.py +108 -0
  62. letta/jobs/__init__.py +2 -0
  63. letta/jobs/client.py +503 -0
  64. letta/models/__init__.py +2 -0
  65. letta/models/client.py +201 -0
  66. letta/sources/__init__.py +5 -0
  67. letta/sources/client.py +1154 -0
  68. letta/sources/files/__init__.py +2 -0
  69. letta/sources/files/client.py +436 -0
  70. letta/sources/passages/__init__.py +2 -0
  71. letta/sources/passages/client.py +145 -0
  72. letta/tools/__init__.py +2 -0
  73. letta/tools/client.py +1823 -0
  74. letta/types/__init__.py +231 -0
  75. letta/types/action_model.py +36 -0
  76. letta/types/action_parameters_model.py +26 -0
  77. letta/types/action_response_model.py +26 -0
  78. letta/types/agent_state.py +139 -0
  79. letta/types/agent_state_tool_rules_item.py +9 -0
  80. letta/types/agent_type.py +8 -0
  81. letta/types/app_auth_scheme.py +34 -0
  82. letta/types/app_auth_scheme_auth_mode.py +7 -0
  83. letta/types/app_model.py +44 -0
  84. letta/types/archival_memory_summary.py +22 -0
  85. letta/types/assistant_file.py +33 -0
  86. letta/types/assistant_message_input.py +23 -0
  87. letta/types/assistant_message_output.py +23 -0
  88. letta/types/auth_request.py +22 -0
  89. letta/types/auth_response.py +29 -0
  90. letta/types/auth_scheme_field.py +30 -0
  91. letta/types/block.py +91 -0
  92. letta/types/block_update.py +60 -0
  93. letta/types/chat_completion_request.py +49 -0
  94. letta/types/chat_completion_request_function_call.py +6 -0
  95. letta/types/chat_completion_request_messages_item.py +11 -0
  96. letta/types/chat_completion_request_stop.py +5 -0
  97. letta/types/chat_completion_request_tool_choice.py +8 -0
  98. letta/types/chat_completion_response.py +32 -0
  99. letta/types/child_tool_rule.py +33 -0
  100. letta/types/choice.py +25 -0
  101. letta/types/conditional_tool_rule.py +43 -0
  102. letta/types/conflict_error_body.py +21 -0
  103. letta/types/context_window_overview.py +105 -0
  104. letta/types/create_assistant_file_request.py +22 -0
  105. letta/types/create_assistant_request.py +57 -0
  106. letta/types/create_block.py +56 -0
  107. letta/types/delete_assistant_file_response.py +28 -0
  108. letta/types/delete_assistant_response.py +28 -0
  109. letta/types/e_2_b_sandbox_config.py +32 -0
  110. letta/types/embedding_config.py +77 -0
  111. letta/types/embedding_config_embedding_endpoint_type.py +26 -0
  112. letta/types/file_metadata.py +82 -0
  113. letta/types/function_call_input.py +19 -0
  114. letta/types/function_call_output.py +20 -0
  115. letta/types/function_schema.py +21 -0
  116. letta/types/health.py +24 -0
  117. letta/types/http_validation_error.py +20 -0
  118. letta/types/init_tool_rule.py +29 -0
  119. letta/types/internal_server_error_body.py +19 -0
  120. letta/types/job.py +79 -0
  121. letta/types/job_status.py +5 -0
  122. letta/types/letta_request.py +33 -0
  123. letta/types/letta_response.py +37 -0
  124. letta/types/letta_schemas_letta_message_tool_call.py +21 -0
  125. letta/types/letta_schemas_message_message.py +103 -0
  126. letta/types/letta_schemas_openai_chat_completion_request_tool.py +21 -0
  127. letta/types/letta_schemas_openai_chat_completion_request_tool_call.py +24 -0
  128. letta/types/letta_schemas_openai_chat_completion_request_tool_call_function.py +20 -0
  129. letta/types/letta_schemas_openai_chat_completion_response_message.py +24 -0
  130. letta/types/letta_schemas_openai_chat_completion_response_tool_call.py +22 -0
  131. letta/types/letta_schemas_openai_chat_completions_tool_call_function.py +27 -0
  132. letta/types/letta_schemas_openai_chat_completions_tool_call_input.py +29 -0
  133. letta/types/letta_schemas_openai_chat_completions_tool_call_output.py +29 -0
  134. letta/types/letta_schemas_tool_tool.py +88 -0
  135. letta/types/letta_usage_statistics.py +48 -0
  136. letta/types/llm_config.py +65 -0
  137. letta/types/llm_config_model_endpoint_type.py +26 -0
  138. letta/types/local_sandbox_config.py +32 -0
  139. letta/types/log_prob_token.py +21 -0
  140. letta/types/memory.py +32 -0
  141. letta/types/message_content_log_prob.py +23 -0
  142. letta/types/message_create.py +37 -0
  143. letta/types/message_create_role.py +5 -0
  144. letta/types/message_role.py +5 -0
  145. letta/types/not_found_error_body.py +19 -0
  146. letta/types/not_found_error_body_message.py +11 -0
  147. letta/types/open_ai_assistant.py +67 -0
  148. letta/types/organization.py +33 -0
  149. letta/types/organization_create.py +22 -0
  150. letta/types/passage.py +107 -0
  151. letta/types/reasoning_message.py +32 -0
  152. letta/types/recall_memory_summary.py +22 -0
  153. letta/types/response_format.py +19 -0
  154. letta/types/sandbox_config.py +59 -0
  155. letta/types/sandbox_config_create.py +23 -0
  156. letta/types/sandbox_config_create_config.py +7 -0
  157. letta/types/sandbox_config_update.py +27 -0
  158. letta/types/sandbox_config_update_config.py +7 -0
  159. letta/types/sandbox_environment_variable.py +68 -0
  160. letta/types/sandbox_environment_variable_create.py +32 -0
  161. letta/types/sandbox_environment_variable_update.py +36 -0
  162. letta/types/sandbox_type.py +5 -0
  163. letta/types/source.py +85 -0
  164. letta/types/system_message_input.py +21 -0
  165. letta/types/system_message_output.py +32 -0
  166. letta/types/terminal_tool_rule.py +29 -0
  167. letta/types/tool_call_delta.py +21 -0
  168. letta/types/tool_call_function_output.py +27 -0
  169. letta/types/tool_call_message.py +33 -0
  170. letta/types/tool_call_message_tool_call.py +7 -0
  171. letta/types/tool_create.py +57 -0
  172. letta/types/tool_function_choice.py +21 -0
  173. letta/types/tool_input.py +21 -0
  174. letta/types/tool_message.py +21 -0
  175. letta/types/tool_return_message.py +41 -0
  176. letta/types/tool_return_message_status.py +5 -0
  177. letta/types/tool_rule_type.py +10 -0
  178. letta/types/usage_statistics.py +21 -0
  179. letta/types/user.py +57 -0
  180. letta/types/user_create.py +27 -0
  181. letta/types/user_message_input.py +22 -0
  182. letta/types/user_message_input_content.py +5 -0
  183. letta/types/user_message_output.py +32 -0
  184. letta/types/user_update.py +32 -0
  185. letta/types/validation_error.py +22 -0
  186. letta/types/validation_error_loc_item.py +5 -0
  187. letta/version.py +3 -0
  188. letta_client-0.1.4.dist-info/METADATA +189 -0
  189. letta_client-0.1.4.dist-info/RECORD +191 -0
  190. {letta_client-0.1.0.dist-info → letta_client-0.1.4.dist-info}/WHEEL +1 -1
  191. letta_client-0.1.0.dist-info/METADATA +0 -15
  192. letta_client-0.1.0.dist-info/RECORD +0 -4
  193. /letta_client/__init__.py → /letta/py.typed +0 -0
@@ -0,0 +1,22 @@
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
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+
8
+
9
+ class AuthRequest(UniversalBaseModel):
10
+ password: typing.Optional[str] = pydantic.Field(default=None)
11
+ """
12
+ Admin password provided when starting the Letta server
13
+ """
14
+
15
+ if IS_PYDANTIC_V2:
16
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
17
+ else:
18
+
19
+ class Config:
20
+ frozen = True
21
+ smart_union = True
22
+ extra = pydantic.Extra.allow
@@ -0,0 +1,29 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing_extensions
5
+ from ..core.serialization import FieldMetadata
6
+ import pydantic
7
+ import typing
8
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
9
+
10
+
11
+ class AuthResponse(UniversalBaseModel):
12
+ uuid_: typing_extensions.Annotated[str, FieldMetadata(alias="uuid")] = pydantic.Field()
13
+ """
14
+ UUID of the user
15
+ """
16
+
17
+ is_admin: typing.Optional[bool] = pydantic.Field(default=None)
18
+ """
19
+ Whether the user is an admin
20
+ """
21
+
22
+ if IS_PYDANTIC_V2:
23
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
24
+ else:
25
+
26
+ class Config:
27
+ frozen = True
28
+ smart_union = True
29
+ extra = pydantic.Extra.allow
@@ -0,0 +1,30 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import pydantic
7
+
8
+
9
+ class AuthSchemeField(UniversalBaseModel):
10
+ """
11
+ Auth scheme field.
12
+ """
13
+
14
+ name: str
15
+ display_name: typing.Optional[str] = None
16
+ description: str
17
+ type: str
18
+ default: typing.Optional[str] = None
19
+ required: typing.Optional[bool] = None
20
+ expected_from_customer: typing.Optional[bool] = None
21
+ get_current_user_endpoint: typing.Optional[str] = None
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
letta/types/block.py ADDED
@@ -0,0 +1,91 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ import typing
6
+ import typing_extensions
7
+ from ..core.serialization import FieldMetadata
8
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
9
+
10
+
11
+ class Block(UniversalBaseModel):
12
+ """
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
+
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.
25
+ """
26
+
27
+ value: str = pydantic.Field()
28
+ """
29
+ Value of the block.
30
+ """
31
+
32
+ limit: typing.Optional[int] = pydantic.Field(default=None)
33
+ """
34
+ Character limit of the block.
35
+ """
36
+
37
+ name: typing.Optional[str] = pydantic.Field(default=None)
38
+ """
39
+ Name of the block if it is a template.
40
+ """
41
+
42
+ is_template: typing.Optional[bool] = pydantic.Field(default=None)
43
+ """
44
+ Whether the block is a template (e.g. saved human/persona options).
45
+ """
46
+
47
+ label: typing.Optional[str] = pydantic.Field(default=None)
48
+ """
49
+ Label of the block (e.g. 'human', 'persona') in the context window.
50
+ """
51
+
52
+ description: typing.Optional[str] = pydantic.Field(default=None)
53
+ """
54
+ Description of the block.
55
+ """
56
+
57
+ metadata: typing_extensions.Annotated[
58
+ typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="metadata_")
59
+ ] = pydantic.Field(default=None)
60
+ """
61
+ Metadata of the block.
62
+ """
63
+
64
+ id: typing.Optional[str] = pydantic.Field(default=None)
65
+ """
66
+ The human-friendly ID of the Block
67
+ """
68
+
69
+ organization_id: typing.Optional[str] = pydantic.Field(default=None)
70
+ """
71
+ The unique identifier of the organization associated with the block.
72
+ """
73
+
74
+ created_by_id: typing.Optional[str] = pydantic.Field(default=None)
75
+ """
76
+ The id of the user that made this Block.
77
+ """
78
+
79
+ last_updated_by_id: typing.Optional[str] = pydantic.Field(default=None)
80
+ """
81
+ The id of the user that last updated this Block.
82
+ """
83
+
84
+ if IS_PYDANTIC_V2:
85
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
86
+ else:
87
+
88
+ class Config:
89
+ frozen = True
90
+ smart_union = True
91
+ extra = pydantic.Extra.allow
@@ -0,0 +1,60 @@
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 typing_extensions
7
+ from ..core.serialization import FieldMetadata
8
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
9
+
10
+
11
+ class BlockUpdate(UniversalBaseModel):
12
+ """
13
+ Update a block
14
+ """
15
+
16
+ value: typing.Optional[str] = pydantic.Field(default=None)
17
+ """
18
+ Value of the block.
19
+ """
20
+
21
+ limit: typing.Optional[int] = pydantic.Field(default=None)
22
+ """
23
+ Character limit of the block.
24
+ """
25
+
26
+ name: typing.Optional[str] = pydantic.Field(default=None)
27
+ """
28
+ Name of the block if it is a template.
29
+ """
30
+
31
+ is_template: typing.Optional[bool] = pydantic.Field(default=None)
32
+ """
33
+ Whether the block is a template (e.g. saved human/persona options).
34
+ """
35
+
36
+ label: typing.Optional[str] = pydantic.Field(default=None)
37
+ """
38
+ Label of the block (e.g. 'human', 'persona') in the context window.
39
+ """
40
+
41
+ description: typing.Optional[str] = pydantic.Field(default=None)
42
+ """
43
+ Description of the block.
44
+ """
45
+
46
+ metadata: typing_extensions.Annotated[
47
+ typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="metadata_")
48
+ ] = pydantic.Field(default=None)
49
+ """
50
+ Metadata of the block.
51
+ """
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
@@ -0,0 +1,49 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from .chat_completion_request_messages_item import ChatCompletionRequestMessagesItem
6
+ from .response_format import ResponseFormat
7
+ from .chat_completion_request_stop import ChatCompletionRequestStop
8
+ from .tool_input import ToolInput
9
+ from .chat_completion_request_tool_choice import ChatCompletionRequestToolChoice
10
+ from .function_schema import FunctionSchema
11
+ from .chat_completion_request_function_call import ChatCompletionRequestFunctionCall
12
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
13
+ import pydantic
14
+
15
+
16
+ class ChatCompletionRequest(UniversalBaseModel):
17
+ """
18
+ https://platform.openai.com/docs/api-reference/chat/create
19
+ """
20
+
21
+ model: str
22
+ messages: typing.List[ChatCompletionRequestMessagesItem]
23
+ frequency_penalty: typing.Optional[float] = None
24
+ logit_bias: typing.Optional[typing.Dict[str, typing.Optional[int]]] = None
25
+ logprobs: typing.Optional[bool] = None
26
+ top_logprobs: typing.Optional[int] = None
27
+ max_tokens: typing.Optional[int] = None
28
+ n: typing.Optional[int] = None
29
+ presence_penalty: typing.Optional[float] = None
30
+ response_format: typing.Optional[ResponseFormat] = None
31
+ seed: typing.Optional[int] = None
32
+ stop: typing.Optional[ChatCompletionRequestStop] = None
33
+ stream: typing.Optional[bool] = None
34
+ temperature: typing.Optional[float] = None
35
+ top_p: typing.Optional[float] = None
36
+ user: typing.Optional[str] = None
37
+ tools: typing.Optional[typing.List[ToolInput]] = None
38
+ tool_choice: typing.Optional[ChatCompletionRequestToolChoice] = None
39
+ functions: typing.Optional[typing.List[FunctionSchema]] = None
40
+ function_call: typing.Optional[ChatCompletionRequestFunctionCall] = None
41
+
42
+ if IS_PYDANTIC_V2:
43
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
44
+ else:
45
+
46
+ class Config:
47
+ frozen = True
48
+ smart_union = True
49
+ extra = pydantic.Extra.allow
@@ -0,0 +1,6 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from .function_call_input import FunctionCallInput
5
+
6
+ ChatCompletionRequestFunctionCall = typing.Union[typing.Literal["none"], typing.Literal["auto"], FunctionCallInput]
@@ -0,0 +1,11 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from .system_message_input import SystemMessageInput
5
+ from .user_message_input import UserMessageInput
6
+ from .assistant_message_input import AssistantMessageInput
7
+ from .tool_message import ToolMessage
8
+
9
+ ChatCompletionRequestMessagesItem = typing.Union[
10
+ SystemMessageInput, UserMessageInput, AssistantMessageInput, ToolMessage
11
+ ]
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ ChatCompletionRequestStop = typing.Union[str, typing.List[str]]
@@ -0,0 +1,8 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from .tool_function_choice import ToolFunctionChoice
5
+
6
+ ChatCompletionRequestToolChoice = typing.Union[
7
+ typing.Literal["none"], typing.Literal["auto"], typing.Literal["required"], ToolFunctionChoice
8
+ ]
@@ -0,0 +1,32 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from .choice import Choice
6
+ import datetime as dt
7
+ from .usage_statistics import UsageStatistics
8
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
9
+ import pydantic
10
+
11
+
12
+ class ChatCompletionResponse(UniversalBaseModel):
13
+ """
14
+ https://platform.openai.com/docs/api-reference/chat/object
15
+ """
16
+
17
+ id: str
18
+ choices: typing.List[Choice]
19
+ created: dt.datetime
20
+ model: typing.Optional[str] = None
21
+ system_fingerprint: typing.Optional[str] = None
22
+ object: typing.Optional[typing.Literal["chat.completion"]] = None
23
+ usage: UsageStatistics
24
+
25
+ if IS_PYDANTIC_V2:
26
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
27
+ else:
28
+
29
+ class Config:
30
+ frozen = True
31
+ smart_union = True
32
+ extra = pydantic.Extra.allow
@@ -0,0 +1,33 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ import typing
6
+ from .tool_rule_type import ToolRuleType
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
+
9
+
10
+ class ChildToolRule(UniversalBaseModel):
11
+ """
12
+ A ToolRule represents a tool that can be invoked by the agent.
13
+ """
14
+
15
+ tool_name: str = pydantic.Field()
16
+ """
17
+ The name of the tool. Must exist in the database for the user's organization.
18
+ """
19
+
20
+ type: typing.Optional[ToolRuleType] = None
21
+ children: typing.List[str] = pydantic.Field()
22
+ """
23
+ The children tools that can be invoked.
24
+ """
25
+
26
+ if IS_PYDANTIC_V2:
27
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
28
+ else:
29
+
30
+ class Config:
31
+ frozen = True
32
+ smart_union = True
33
+ extra = pydantic.Extra.allow
letta/types/choice.py ADDED
@@ -0,0 +1,25 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ from .letta_schemas_openai_chat_completion_response_message import LettaSchemasOpenaiChatCompletionResponseMessage
5
+ import typing
6
+ from .message_content_log_prob import MessageContentLogProb
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
+ import pydantic
9
+
10
+
11
+ class Choice(UniversalBaseModel):
12
+ finish_reason: str
13
+ index: int
14
+ message: LettaSchemasOpenaiChatCompletionResponseMessage
15
+ logprobs: typing.Optional[typing.Dict[str, typing.Optional[typing.List[MessageContentLogProb]]]] = None
16
+ seed: typing.Optional[int] = None
17
+
18
+ if IS_PYDANTIC_V2:
19
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
20
+ else:
21
+
22
+ class Config:
23
+ frozen = True
24
+ smart_union = True
25
+ extra = pydantic.Extra.allow
@@ -0,0 +1,43 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ import typing
6
+ from .tool_rule_type import ToolRuleType
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
+
9
+
10
+ class ConditionalToolRule(UniversalBaseModel):
11
+ """
12
+ A ToolRule that conditionally maps to different child tools based on the output.
13
+ """
14
+
15
+ tool_name: str = pydantic.Field()
16
+ """
17
+ The name of the tool. Must exist in the database for the user's organization.
18
+ """
19
+
20
+ type: typing.Optional[ToolRuleType] = None
21
+ default_child: typing.Optional[str] = pydantic.Field(default=None)
22
+ """
23
+ The default child tool to be called. If None, any tool can be called.
24
+ """
25
+
26
+ child_output_mapping: typing.Dict[str, str] = pydantic.Field()
27
+ """
28
+ The output case to check for mapping
29
+ """
30
+
31
+ require_output_mapping: typing.Optional[bool] = pydantic.Field(default=None)
32
+ """
33
+ Whether to throw an error when output doesn't match any case
34
+ """
35
+
36
+ if IS_PYDANTIC_V2:
37
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
38
+ else:
39
+
40
+ class Config:
41
+ frozen = True
42
+ smart_union = True
43
+ extra = pydantic.Extra.allow
@@ -0,0 +1,21 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import pydantic
7
+
8
+
9
+ class ConflictErrorBody(UniversalBaseModel):
10
+ message: typing.Literal[
11
+ "You can only migrate agents to a new versioned agent template that belongs to the same project"
12
+ ] = "You can only migrate agents to a new versioned agent template that belongs to the same project"
13
+
14
+ if IS_PYDANTIC_V2:
15
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
16
+ else:
17
+
18
+ class Config:
19
+ frozen = True
20
+ smart_union = True
21
+ extra = pydantic.Extra.allow
@@ -0,0 +1,105 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ import typing
6
+ from .letta_schemas_openai_chat_completion_request_tool import LettaSchemasOpenaiChatCompletionRequestTool
7
+ from .letta_schemas_message_message import LettaSchemasMessageMessage
8
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
9
+
10
+
11
+ class ContextWindowOverview(UniversalBaseModel):
12
+ """
13
+ Overview of the context window, including the number of messages and tokens.
14
+ """
15
+
16
+ context_window_size_max: int = pydantic.Field()
17
+ """
18
+ The maximum amount of tokens the context window can hold.
19
+ """
20
+
21
+ context_window_size_current: int = pydantic.Field()
22
+ """
23
+ The current number of tokens in the context window.
24
+ """
25
+
26
+ num_messages: int = pydantic.Field()
27
+ """
28
+ The number of messages in the context window.
29
+ """
30
+
31
+ num_archival_memory: int = pydantic.Field()
32
+ """
33
+ The number of messages in the archival memory.
34
+ """
35
+
36
+ num_recall_memory: int = pydantic.Field()
37
+ """
38
+ The number of messages in the recall memory.
39
+ """
40
+
41
+ num_tokens_external_memory_summary: int = pydantic.Field()
42
+ """
43
+ The number of tokens in the external memory summary (archival + recall metadata).
44
+ """
45
+
46
+ num_tokens_system: int = pydantic.Field()
47
+ """
48
+ The number of tokens in the system prompt.
49
+ """
50
+
51
+ system_prompt: str = pydantic.Field()
52
+ """
53
+ The content of the system prompt.
54
+ """
55
+
56
+ num_tokens_core_memory: int = pydantic.Field()
57
+ """
58
+ The number of tokens in the core memory.
59
+ """
60
+
61
+ core_memory: str = pydantic.Field()
62
+ """
63
+ The content of the core memory.
64
+ """
65
+
66
+ num_tokens_summary_memory: int = pydantic.Field()
67
+ """
68
+ The number of tokens in the summary memory.
69
+ """
70
+
71
+ summary_memory: typing.Optional[str] = pydantic.Field(default=None)
72
+ """
73
+ The content of the summary memory.
74
+ """
75
+
76
+ num_tokens_functions_definitions: int = pydantic.Field()
77
+ """
78
+ The number of tokens in the functions definitions.
79
+ """
80
+
81
+ functions_definitions: typing.Optional[typing.List[LettaSchemasOpenaiChatCompletionRequestTool]] = pydantic.Field(
82
+ default=None
83
+ )
84
+ """
85
+ The content of the functions definitions.
86
+ """
87
+
88
+ num_tokens_messages: int = pydantic.Field()
89
+ """
90
+ The number of tokens in the messages list.
91
+ """
92
+
93
+ messages: typing.List[LettaSchemasMessageMessage] = pydantic.Field()
94
+ """
95
+ The messages in the context window.
96
+ """
97
+
98
+ if IS_PYDANTIC_V2:
99
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
100
+ else:
101
+
102
+ class Config:
103
+ frozen = True
104
+ smart_union = True
105
+ extra = pydantic.Extra.allow
@@ -0,0 +1,22 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import typing
7
+
8
+
9
+ class CreateAssistantFileRequest(UniversalBaseModel):
10
+ file_id: str = pydantic.Field()
11
+ """
12
+ The unique identifier of the file.
13
+ """
14
+
15
+ if IS_PYDANTIC_V2:
16
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
17
+ else:
18
+
19
+ class Config:
20
+ frozen = True
21
+ smart_union = True
22
+ extra = pydantic.Extra.allow
@@ -0,0 +1,57 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ import typing
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+
8
+
9
+ class CreateAssistantRequest(UniversalBaseModel):
10
+ model: str = pydantic.Field()
11
+ """
12
+ The model to use for the assistant.
13
+ """
14
+
15
+ name: str = pydantic.Field()
16
+ """
17
+ The name of the assistant.
18
+ """
19
+
20
+ description: typing.Optional[str] = pydantic.Field(default=None)
21
+ """
22
+ The description of the assistant.
23
+ """
24
+
25
+ instructions: str = pydantic.Field()
26
+ """
27
+ The instructions for the assistant.
28
+ """
29
+
30
+ tools: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
31
+ """
32
+ The tools used by the assistant.
33
+ """
34
+
35
+ file_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
36
+ """
37
+ List of file IDs associated with the assistant.
38
+ """
39
+
40
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
41
+ """
42
+ Metadata associated with the assistant.
43
+ """
44
+
45
+ embedding_model: typing.Optional[str] = pydantic.Field(default=None)
46
+ """
47
+ The model to use for the assistant.
48
+ """
49
+
50
+ if IS_PYDANTIC_V2:
51
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
52
+ else:
53
+
54
+ class Config:
55
+ frozen = True
56
+ smart_union = True
57
+ extra = pydantic.Extra.allow