letta-client 0.1.17__py3-none-any.whl → 0.1.21__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 (107) hide show
  1. letta_client/__init__.py +44 -116
  2. letta_client/agents/__init__.py +18 -42
  3. letta_client/agents/archival_memory/client.py +6 -6
  4. letta_client/agents/client.py +28 -18
  5. letta_client/agents/context/client.py +6 -4
  6. letta_client/agents/core_memory/client.py +152 -227
  7. letta_client/agents/memory_variables/__init__.py +2 -2
  8. letta_client/agents/memory_variables/client.py +15 -15
  9. letta_client/agents/memory_variables/types/__init__.py +2 -2
  10. letta_client/agents/memory_variables/types/{memory_variables_get_response.py → memory_variables_list_response.py} +1 -1
  11. letta_client/agents/messages/__init__.py +2 -22
  12. letta_client/agents/messages/client.py +39 -40
  13. letta_client/agents/messages/types/__init__.py +3 -21
  14. letta_client/agents/messages/types/letta_streaming_response.py +16 -139
  15. letta_client/agents/messages/types/message_update_content.py +6 -0
  16. letta_client/agents/messages/types/messages_list_response.py +2 -2
  17. letta_client/agents/sources/client.py +266 -5
  18. letta_client/agents/tools/client.py +25 -27
  19. letta_client/agents/types/__init__.py +15 -25
  20. letta_client/agents/types/agents_search_request_search_item.py +10 -78
  21. letta_client/agents/types/{agents_search_request_search_item_order_by.py → agents_search_request_search_item_direction.py} +7 -6
  22. letta_client/agents/types/agents_search_request_search_item_direction_direction.py +5 -0
  23. letta_client/agents/types/agents_search_request_search_item_direction_value.py +5 -0
  24. letta_client/agents/types/{agents_search_request_search_item_name.py → agents_search_request_search_item_one.py} +5 -4
  25. letta_client/agents/types/agents_search_request_search_item_one_operator.py +5 -0
  26. letta_client/agents/types/{agents_search_request_search_item_tags.py → agents_search_request_search_item_two.py} +2 -1
  27. letta_client/agents/types/{agents_search_request_search_item_version.py → agents_search_request_search_item_zero.py} +3 -2
  28. letta_client/blocks/client.py +45 -166
  29. letta_client/client.py +3 -3
  30. letta_client/core/client_wrapper.py +1 -1
  31. letta_client/jobs/client.py +4 -4
  32. letta_client/providers/client.py +10 -10
  33. letta_client/runs/client.py +44 -30
  34. letta_client/sources/client.py +12 -288
  35. letta_client/sources/files/client.py +6 -6
  36. letta_client/tag/client.py +6 -6
  37. letta_client/tools/client.py +69 -75
  38. letta_client/types/__init__.py +31 -99
  39. letta_client/types/agent_state.py +3 -7
  40. letta_client/types/{letta_schemas_openai_chat_completion_response_tool_call.py → assistant_message.py} +6 -4
  41. letta_client/types/assistant_message_content.py +6 -0
  42. letta_client/types/block.py +2 -6
  43. letta_client/types/block_update.py +1 -5
  44. letta_client/types/{assistant_message_output.py → chat_completion_message_tool_call.py} +5 -5
  45. letta_client/types/context_window_overview.py +4 -6
  46. letta_client/types/create_block.py +1 -5
  47. letta_client/types/{function_call_output.py → function.py} +1 -1
  48. letta_client/types/{function_schema.py → function_definition.py} +2 -1
  49. letta_client/types/{function_call_input.py → function_tool.py} +5 -3
  50. letta_client/types/job.py +1 -5
  51. letta_client/types/letta_message_union.py +9 -121
  52. letta_client/types/letta_usage_statistics.py +1 -0
  53. letta_client/types/llm_config.py +6 -0
  54. letta_client/types/{letta_schemas_message_message.py → message.py} +7 -8
  55. letta_client/types/message_create.py +3 -2
  56. letta_client/types/message_create_content.py +6 -0
  57. letta_client/types/passage.py +1 -5
  58. letta_client/types/reasoning_message.py +2 -1
  59. letta_client/types/run.py +1 -5
  60. letta_client/types/source.py +2 -6
  61. letta_client/types/{system_message_output.py → system_message.py} +6 -4
  62. letta_client/types/system_message_content.py +6 -0
  63. letta_client/types/{create_assistant_file_request.py → text_content.py} +5 -4
  64. letta_client/types/{letta_schemas_tool_tool.py → tool.py} +1 -1
  65. letta_client/types/{letta_schemas_letta_message_tool_call.py → tool_call.py} +1 -1
  66. letta_client/types/tool_call_message.py +2 -1
  67. letta_client/types/tool_call_message_tool_call.py +2 -2
  68. letta_client/types/tool_return_message.py +2 -1
  69. letta_client/types/tool_type.py +2 -1
  70. letta_client/types/{user_message_output.py → user_message.py} +6 -4
  71. letta_client/types/user_message_content.py +6 -0
  72. {letta_client-0.1.17.dist-info → letta_client-0.1.21.dist-info}/METADATA +2 -2
  73. {letta_client-0.1.17.dist-info → letta_client-0.1.21.dist-info}/RECORD +74 -99
  74. letta_client/agents/types/agents_search_request_search_item_name_operator.py +0 -5
  75. letta_client/agents/types/agents_search_request_search_item_order_by_direction.py +0 -5
  76. letta_client/agents/types/agents_search_request_search_item_order_by_value.py +0 -5
  77. letta_client/types/assistant_file.py +0 -33
  78. letta_client/types/assistant_message_input.py +0 -23
  79. letta_client/types/chat_completion_request.py +0 -49
  80. letta_client/types/chat_completion_request_function_call.py +0 -6
  81. letta_client/types/chat_completion_request_messages_item.py +0 -11
  82. letta_client/types/chat_completion_request_stop.py +0 -5
  83. letta_client/types/chat_completion_request_tool_choice.py +0 -8
  84. letta_client/types/chat_completion_response.py +0 -32
  85. letta_client/types/choice.py +0 -25
  86. letta_client/types/create_assistant_request.py +0 -57
  87. letta_client/types/delete_assistant_file_response.py +0 -28
  88. letta_client/types/delete_assistant_response.py +0 -28
  89. letta_client/types/letta_schemas_openai_chat_completion_request_tool.py +0 -21
  90. letta_client/types/letta_schemas_openai_chat_completion_request_tool_call.py +0 -24
  91. letta_client/types/letta_schemas_openai_chat_completion_request_tool_call_function.py +0 -20
  92. letta_client/types/letta_schemas_openai_chat_completion_response_message.py +0 -24
  93. letta_client/types/letta_schemas_openai_chat_completions_tool_call_function.py +0 -27
  94. letta_client/types/letta_schemas_openai_chat_completions_tool_call_input.py +0 -29
  95. letta_client/types/letta_schemas_openai_chat_completions_tool_call_output.py +0 -29
  96. letta_client/types/log_prob_token.py +0 -21
  97. letta_client/types/message_content_log_prob.py +0 -23
  98. letta_client/types/open_ai_assistant.py +0 -67
  99. letta_client/types/response_format.py +0 -19
  100. letta_client/types/system_message_input.py +0 -21
  101. letta_client/types/tool_call_function_output.py +0 -27
  102. letta_client/types/tool_function_choice.py +0 -21
  103. letta_client/types/tool_input.py +0 -21
  104. letta_client/types/tool_message.py +0 -21
  105. letta_client/types/user_message_input.py +0 -22
  106. letta_client/types/user_message_input_content.py +0 -5
  107. {letta_client-0.1.17.dist-info → letta_client-0.1.21.dist-info}/WHEEL +0 -0
@@ -18,6 +18,7 @@ class LlmConfig(UncheckedBaseModel):
18
18
  model_wrapper (str): The wrapper for the model. This is used to wrap additional text around the input/output of the model. This is useful for text-to-text completions, such as the Completions API in OpenAI.
19
19
  context_window (int): The context window size for the model.
20
20
  put_inner_thoughts_in_kwargs (bool): Puts `inner_thoughts` as a kwarg in the function call if this is set to True. This helps with function calling performance and also the generation of inner thoughts.
21
+ temperature (float): The temperature to use when generating text with the model. A higher temperature will result in more random text.
21
22
  """
22
23
 
23
24
  model: str = pydantic.Field()
@@ -55,6 +56,11 @@ class LlmConfig(UncheckedBaseModel):
55
56
  The handle for this config, in the format provider/model-name.
56
57
  """
57
58
 
59
+ temperature: typing.Optional[float] = pydantic.Field(default=None)
60
+ """
61
+ The temperature to use when generating text with the model. A higher temperature will result in more random text.
62
+ """
63
+
58
64
  if IS_PYDANTIC_V2:
59
65
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
60
66
  else:
@@ -5,11 +5,12 @@ import typing
5
5
  import pydantic
6
6
  import datetime as dt
7
7
  from .message_role import MessageRole
8
- from .letta_schemas_openai_chat_completions_tool_call_output import LettaSchemasOpenaiChatCompletionsToolCallOutput
8
+ from .text_content import TextContent
9
+ from .chat_completion_message_tool_call import ChatCompletionMessageToolCall
9
10
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
10
11
 
11
12
 
12
- class LettaSchemasMessageMessage(UncheckedBaseModel):
13
+ class Message(UncheckedBaseModel):
13
14
  """
14
15
  Letta's internal representation of a message. Includes methods to convert to/from LLM provider formats.
15
16
 
@@ -22,7 +23,7 @@ class LettaSchemasMessageMessage(UncheckedBaseModel):
22
23
  model (str): The model used to make the function call.
23
24
  name (str): The name of the participant.
24
25
  created_at (datetime): The time the message was created.
25
- tool_calls (List[ToolCall]): The list of tool calls requested.
26
+ tool_calls (List[OpenAIToolCall,]): The list of tool calls requested.
26
27
  tool_call_id (str): The id of the tool call.
27
28
  """
28
29
 
@@ -56,9 +57,9 @@ class LettaSchemasMessageMessage(UncheckedBaseModel):
56
57
  The role of the participant.
57
58
  """
58
59
 
59
- text: typing.Optional[str] = pydantic.Field(default=None)
60
+ content: typing.Optional[typing.List[TextContent]] = pydantic.Field(default=None)
60
61
  """
61
- The text of the message.
62
+ The content of the message.
62
63
  """
63
64
 
64
65
  agent_id: typing.Optional[str] = pydantic.Field(default=None)
@@ -76,9 +77,7 @@ class LettaSchemasMessageMessage(UncheckedBaseModel):
76
77
  The name of the participant.
77
78
  """
78
79
 
79
- tool_calls: typing.Optional[typing.List[LettaSchemasOpenaiChatCompletionsToolCallOutput]] = pydantic.Field(
80
- default=None
81
- )
80
+ tool_calls: typing.Optional[typing.List[ChatCompletionMessageToolCall]] = pydantic.Field(default=None)
82
81
  """
83
82
  The list of tool calls requested.
84
83
  """
@@ -3,6 +3,7 @@
3
3
  from ..core.unchecked_base_model import UncheckedBaseModel
4
4
  from .message_create_role import MessageCreateRole
5
5
  import pydantic
6
+ from .message_create_content import MessageCreateContent
6
7
  import typing
7
8
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
9
 
@@ -17,9 +18,9 @@ class MessageCreate(UncheckedBaseModel):
17
18
  The role of the participant.
18
19
  """
19
20
 
20
- text: str = pydantic.Field()
21
+ content: MessageCreateContent = pydantic.Field()
21
22
  """
22
- The text of the message.
23
+ The content of the message.
23
24
  """
24
25
 
25
26
  name: typing.Optional[str] = pydantic.Field(default=None)
@@ -0,0 +1,6 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from .text_content import TextContent
5
+
6
+ MessageCreateContent = typing.Union[str, typing.List[TextContent]]
@@ -4,8 +4,6 @@ from ..core.unchecked_base_model import UncheckedBaseModel
4
4
  import typing
5
5
  import pydantic
6
6
  import datetime as dt
7
- import typing_extensions
8
- from ..core.serialization import FieldMetadata
9
7
  from .embedding_config import EmbeddingConfig
10
8
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
11
9
 
@@ -65,9 +63,7 @@ class Passage(UncheckedBaseModel):
65
63
  The unique identifier of the file associated with the passage.
66
64
  """
67
65
 
68
- metadata: typing_extensions.Annotated[
69
- typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="metadata_")
70
- ] = pydantic.Field(default=None)
66
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
71
67
  """
72
68
  The metadata of the passage.
73
69
  """
@@ -2,8 +2,8 @@
2
2
 
3
3
  from ..core.unchecked_base_model import UncheckedBaseModel
4
4
  import datetime as dt
5
- from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
5
  import typing
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
7
  import pydantic
8
8
 
9
9
 
@@ -19,6 +19,7 @@ class ReasoningMessage(UncheckedBaseModel):
19
19
 
20
20
  id: str
21
21
  date: dt.datetime
22
+ message_type: typing.Literal["reasoning_message"] = "reasoning_message"
22
23
  reasoning: str
23
24
 
24
25
  if IS_PYDANTIC_V2:
letta_client/types/run.py CHANGED
@@ -5,8 +5,6 @@ import typing
5
5
  import pydantic
6
6
  import datetime as dt
7
7
  from .job_status import JobStatus
8
- import typing_extensions
9
- from ..core.serialization import FieldMetadata
10
8
  from .job_type import JobType
11
9
  from .letta_request_config import LettaRequestConfig
12
10
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
@@ -55,9 +53,7 @@ class Run(UncheckedBaseModel):
55
53
  The unix timestamp of when the job was completed.
56
54
  """
57
55
 
58
- metadata: typing_extensions.Annotated[
59
- typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="metadata_")
60
- ] = pydantic.Field(default=None)
56
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
61
57
  """
62
58
  The metadata of the job.
63
59
  """
@@ -4,8 +4,6 @@ from ..core.unchecked_base_model import UncheckedBaseModel
4
4
  import typing
5
5
  import pydantic
6
6
  from .embedding_config import EmbeddingConfig
7
- import typing_extensions
8
- from ..core.serialization import FieldMetadata
9
7
  import datetime as dt
10
8
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
11
9
 
@@ -19,7 +17,7 @@ class Source(UncheckedBaseModel):
19
17
  name (str): The name of the source.
20
18
  embedding_config (EmbeddingConfig): The embedding configuration used by the source.
21
19
  user_id (str): The ID of the user that created the source.
22
- metadata_ (dict): Metadata associated with the source.
20
+ metadata (dict): Metadata associated with the source.
23
21
  description (str): The description of the source.
24
22
  """
25
23
 
@@ -43,9 +41,7 @@ class Source(UncheckedBaseModel):
43
41
  The embedding configuration used by the source.
44
42
  """
45
43
 
46
- metadata: typing_extensions.Annotated[
47
- typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="metadata_")
48
- ] = pydantic.Field(default=None)
44
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
49
45
  """
50
46
  Metadata associated with the source.
51
47
  """
@@ -2,24 +2,26 @@
2
2
 
3
3
  from ..core.unchecked_base_model import UncheckedBaseModel
4
4
  import datetime as dt
5
- from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
5
  import typing
6
+ from .system_message_content import SystemMessageContent
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
8
  import pydantic
8
9
 
9
10
 
10
- class SystemMessageOutput(UncheckedBaseModel):
11
+ class SystemMessage(UncheckedBaseModel):
11
12
  """
12
13
  A message generated by the system. Never streamed back on a response, only used for cursor pagination.
13
14
 
14
15
  Attributes:
15
- message (str): The message sent by the system
16
+ content (Union[str, List[MessageContentUnion]]): The message content sent by the user (can be a string or an array of content parts)
16
17
  id (str): The ID of the message
17
18
  date (datetime): The date the message was created in ISO format
18
19
  """
19
20
 
20
21
  id: str
21
22
  date: dt.datetime
22
- message: str
23
+ message_type: typing.Literal["system_message"] = "system_message"
24
+ content: SystemMessageContent
23
25
 
24
26
  if IS_PYDANTIC_V2:
25
27
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -0,0 +1,6 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from .text_content import TextContent
5
+
6
+ SystemMessageContent = typing.Union[str, typing.List[TextContent]]
@@ -1,15 +1,16 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  from ..core.unchecked_base_model import UncheckedBaseModel
4
+ import typing
4
5
  import pydantic
5
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
- import typing
7
7
 
8
8
 
9
- class CreateAssistantFileRequest(UncheckedBaseModel):
10
- file_id: str = pydantic.Field()
9
+ class TextContent(UncheckedBaseModel):
10
+ type: typing.Literal["text"] = "text"
11
+ text: str = pydantic.Field()
11
12
  """
12
- The unique identifier of the file.
13
+ The text content of the message.
13
14
  """
14
15
 
15
16
  if IS_PYDANTIC_V2:
@@ -7,7 +7,7 @@ from .tool_type import ToolType
7
7
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
8
 
9
9
 
10
- class LettaSchemasToolTool(UncheckedBaseModel):
10
+ class Tool(UncheckedBaseModel):
11
11
  """
12
12
  Representation of a tool, which is a function that can be called by the agent.
13
13
 
@@ -6,7 +6,7 @@ import typing
6
6
  import pydantic
7
7
 
8
8
 
9
- class LettaSchemasLettaMessageToolCall(UncheckedBaseModel):
9
+ class ToolCall(UncheckedBaseModel):
10
10
  name: str
11
11
  arguments: str
12
12
  tool_call_id: str
@@ -2,9 +2,9 @@
2
2
 
3
3
  from ..core.unchecked_base_model import UncheckedBaseModel
4
4
  import datetime as dt
5
+ import typing
5
6
  from .tool_call_message_tool_call import ToolCallMessageToolCall
6
7
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
- import typing
8
8
  import pydantic
9
9
 
10
10
 
@@ -20,6 +20,7 @@ class ToolCallMessage(UncheckedBaseModel):
20
20
 
21
21
  id: str
22
22
  date: dt.datetime
23
+ message_type: typing.Literal["tool_call_message"] = "tool_call_message"
23
24
  tool_call: ToolCallMessageToolCall
24
25
 
25
26
  if IS_PYDANTIC_V2:
@@ -1,7 +1,7 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  import typing
4
- from .letta_schemas_letta_message_tool_call import LettaSchemasLettaMessageToolCall
4
+ from .tool_call import ToolCall
5
5
  from .tool_call_delta import ToolCallDelta
6
6
 
7
- ToolCallMessageToolCall = typing.Union[LettaSchemasLettaMessageToolCall, ToolCallDelta]
7
+ ToolCallMessageToolCall = typing.Union[ToolCall, ToolCallDelta]
@@ -2,8 +2,8 @@
2
2
 
3
3
  from ..core.unchecked_base_model import UncheckedBaseModel
4
4
  import datetime as dt
5
- from .tool_return_message_status import ToolReturnMessageStatus
6
5
  import typing
6
+ from .tool_return_message_status import ToolReturnMessageStatus
7
7
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
8
  import pydantic
9
9
 
@@ -24,6 +24,7 @@ class ToolReturnMessage(UncheckedBaseModel):
24
24
 
25
25
  id: str
26
26
  date: dt.datetime
27
+ message_type: typing.Literal["tool_return_message"] = "tool_return_message"
27
28
  tool_return: str
28
29
  status: ToolReturnMessageStatus
29
30
  tool_call_id: str
@@ -3,5 +3,6 @@
3
3
  import typing
4
4
 
5
5
  ToolType = typing.Union[
6
- typing.Literal["custom", "letta_core", "letta_memory_core", "letta_multi_agent_core"], typing.Any
6
+ typing.Literal["custom", "letta_core", "letta_memory_core", "letta_multi_agent_core", "external_composio"],
7
+ typing.Any,
7
8
  ]
@@ -2,24 +2,26 @@
2
2
 
3
3
  from ..core.unchecked_base_model import UncheckedBaseModel
4
4
  import datetime as dt
5
- from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
5
  import typing
6
+ from .user_message_content import UserMessageContent
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
8
  import pydantic
8
9
 
9
10
 
10
- class UserMessageOutput(UncheckedBaseModel):
11
+ class UserMessage(UncheckedBaseModel):
11
12
  """
12
13
  A message sent by the user. Never streamed back on a response, only used for cursor pagination.
13
14
 
14
15
  Attributes:
15
- message (str): The message sent by the user
16
+ content (Union[str, List[MessageContentUnion]]): The message content sent by the user (can be a string or an array of content parts)
16
17
  id (str): The ID of the message
17
18
  date (datetime): The date the message was created in ISO format
18
19
  """
19
20
 
20
21
  id: str
21
22
  date: dt.datetime
22
- message: str
23
+ message_type: typing.Literal["user_message"] = "user_message"
24
+ content: UserMessageContent
23
25
 
24
26
  if IS_PYDANTIC_V2:
25
27
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -0,0 +1,6 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from .text_content import TextContent
5
+
6
+ UserMessageContent = typing.Union[str, typing.List[TextContent]]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-client
3
- Version: 0.1.17
3
+ Version: 0.1.21
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Intended Audience :: Developers
@@ -110,7 +110,7 @@ response = client.agents.messages.create_stream(
110
110
  messages=[
111
111
  MessageCreate(
112
112
  role="user",
113
- text="text",
113
+ content="content",
114
114
  )
115
115
  ],
116
116
  )