Skip to content

Commit 9e52938

Browse files
feat(api): api update (#24)
1 parent 3a2859e commit 9e52938

File tree

6 files changed

+124
-46
lines changed

6 files changed

+124
-46
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 9
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/letta-ai%2Fletta-05e4bbbdb7b6b5f657a8c7417a5325c391dd5ffc6701ef303860b9a9af985dea.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/letta-ai%2Fletta-b255d1730fcaf036db43fc05485c8b8a6e766bb0d15504e41b5c2bb0d8d44e3b.yml

src/letta/types/agent_create_params.py

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Union, Iterable, Optional
5+
from typing import Dict, List, Union, Iterable, Optional
66
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
77

88
from .._utils import PropertyInfo
@@ -17,6 +17,7 @@
1717
"ToolRuleChildToolRule",
1818
"ToolRuleInitToolRule",
1919
"ToolRuleTerminalToolRule",
20+
"ToolRuleConditionalToolRule",
2021
]
2122

2223

@@ -246,24 +247,51 @@ class ToolRuleChildToolRule(TypedDict, total=False):
246247
tool_name: Required[str]
247248
"""The name of the tool. Must exist in the database for the user's organization."""
248249

249-
type: Literal["InitToolRule", "TerminalToolRule", "continue_loop", "ToolRule", "require_parent_tools"]
250+
type: Literal[
251+
"InitToolRule", "TerminalToolRule", "continue_loop", "conditional", "ToolRule", "require_parent_tools"
252+
]
250253
"""Type of tool rule."""
251254

252255

253256
class ToolRuleInitToolRule(TypedDict, total=False):
254257
tool_name: Required[str]
255258
"""The name of the tool. Must exist in the database for the user's organization."""
256259

257-
type: Literal["InitToolRule", "TerminalToolRule", "continue_loop", "ToolRule", "require_parent_tools"]
260+
type: Literal[
261+
"InitToolRule", "TerminalToolRule", "continue_loop", "conditional", "ToolRule", "require_parent_tools"
262+
]
258263
"""Type of tool rule."""
259264

260265

261266
class ToolRuleTerminalToolRule(TypedDict, total=False):
262267
tool_name: Required[str]
263268
"""The name of the tool. Must exist in the database for the user's organization."""
264269

265-
type: Literal["InitToolRule", "TerminalToolRule", "continue_loop", "ToolRule", "require_parent_tools"]
270+
type: Literal[
271+
"InitToolRule", "TerminalToolRule", "continue_loop", "conditional", "ToolRule", "require_parent_tools"
272+
]
273+
"""Type of tool rule."""
274+
275+
276+
class ToolRuleConditionalToolRule(TypedDict, total=False):
277+
child_output_mapping: Required[Dict[str, str]]
278+
"""The output case to check for mapping"""
279+
280+
tool_name: Required[str]
281+
"""The name of the tool. Must exist in the database for the user's organization."""
282+
283+
default_child: Optional[str]
284+
"""The default child tool to be called. If None, any tool can be called."""
285+
286+
require_output_mapping: bool
287+
"""Whether to throw an error when output doesn't match any case"""
288+
289+
type: Literal[
290+
"InitToolRule", "TerminalToolRule", "continue_loop", "conditional", "ToolRule", "require_parent_tools"
291+
]
266292
"""Type of tool rule."""
267293

268294

269-
ToolRule: TypeAlias = Union[ToolRuleChildToolRule, ToolRuleInitToolRule, ToolRuleTerminalToolRule]
295+
ToolRule: TypeAlias = Union[
296+
ToolRuleChildToolRule, ToolRuleInitToolRule, ToolRuleTerminalToolRule, ToolRuleConditionalToolRule
297+
]

src/letta/types/agent_state.py

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List, Union, Optional
3+
from typing import Dict, List, Union, Optional
44
from datetime import datetime
55
from typing_extensions import Literal, TypeAlias
66

@@ -21,6 +21,7 @@
2121
"ToolRuleChildToolRule",
2222
"ToolRuleInitToolRule",
2323
"ToolRuleTerminalToolRule",
24+
"ToolRuleConditionalToolRule",
2425
]
2526

2627

@@ -274,33 +275,54 @@ class ToolRuleChildToolRule(BaseModel):
274275
tool_name: str
275276
"""The name of the tool. Must exist in the database for the user's organization."""
276277

277-
type: Optional[Literal["InitToolRule", "TerminalToolRule", "continue_loop", "ToolRule", "require_parent_tools"]] = (
278-
None
279-
)
278+
type: Optional[
279+
Literal["InitToolRule", "TerminalToolRule", "continue_loop", "conditional", "ToolRule", "require_parent_tools"]
280+
] = None
280281
"""Type of tool rule."""
281282

282283

283284
class ToolRuleInitToolRule(BaseModel):
284285
tool_name: str
285286
"""The name of the tool. Must exist in the database for the user's organization."""
286287

287-
type: Optional[Literal["InitToolRule", "TerminalToolRule", "continue_loop", "ToolRule", "require_parent_tools"]] = (
288-
None
289-
)
288+
type: Optional[
289+
Literal["InitToolRule", "TerminalToolRule", "continue_loop", "conditional", "ToolRule", "require_parent_tools"]
290+
] = None
290291
"""Type of tool rule."""
291292

292293

293294
class ToolRuleTerminalToolRule(BaseModel):
294295
tool_name: str
295296
"""The name of the tool. Must exist in the database for the user's organization."""
296297

297-
type: Optional[Literal["InitToolRule", "TerminalToolRule", "continue_loop", "ToolRule", "require_parent_tools"]] = (
298-
None
299-
)
298+
type: Optional[
299+
Literal["InitToolRule", "TerminalToolRule", "continue_loop", "conditional", "ToolRule", "require_parent_tools"]
300+
] = None
300301
"""Type of tool rule."""
301302

302303

303-
ToolRule: TypeAlias = Union[ToolRuleChildToolRule, ToolRuleInitToolRule, ToolRuleTerminalToolRule]
304+
class ToolRuleConditionalToolRule(BaseModel):
305+
child_output_mapping: Dict[str, str]
306+
"""The output case to check for mapping"""
307+
308+
tool_name: str
309+
"""The name of the tool. Must exist in the database for the user's organization."""
310+
311+
default_child: Optional[str] = None
312+
"""The default child tool to be called. If None, any tool can be called."""
313+
314+
require_output_mapping: Optional[bool] = None
315+
"""Whether to throw an error when output doesn't match any case"""
316+
317+
type: Optional[
318+
Literal["InitToolRule", "TerminalToolRule", "continue_loop", "conditional", "ToolRule", "require_parent_tools"]
319+
] = None
320+
"""Type of tool rule."""
321+
322+
323+
ToolRule: TypeAlias = Union[
324+
ToolRuleChildToolRule, ToolRuleInitToolRule, ToolRuleTerminalToolRule, ToolRuleConditionalToolRule
325+
]
304326

305327

306328
class AgentState(BaseModel):

src/letta/types/agent_update_params.py

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Union, Iterable, Optional
5+
from typing import Dict, List, Union, Iterable, Optional
66
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
77

88
from .._utils import PropertyInfo
@@ -15,6 +15,7 @@
1515
"ToolRuleChildToolRule",
1616
"ToolRuleInitToolRule",
1717
"ToolRuleTerminalToolRule",
18+
"ToolRuleConditionalToolRule",
1819
]
1920

2021

@@ -179,24 +180,51 @@ class ToolRuleChildToolRule(TypedDict, total=False):
179180
tool_name: Required[str]
180181
"""The name of the tool. Must exist in the database for the user's organization."""
181182

182-
type: Literal["InitToolRule", "TerminalToolRule", "continue_loop", "ToolRule", "require_parent_tools"]
183+
type: Literal[
184+
"InitToolRule", "TerminalToolRule", "continue_loop", "conditional", "ToolRule", "require_parent_tools"
185+
]
183186
"""Type of tool rule."""
184187

185188

186189
class ToolRuleInitToolRule(TypedDict, total=False):
187190
tool_name: Required[str]
188191
"""The name of the tool. Must exist in the database for the user's organization."""
189192

190-
type: Literal["InitToolRule", "TerminalToolRule", "continue_loop", "ToolRule", "require_parent_tools"]
193+
type: Literal[
194+
"InitToolRule", "TerminalToolRule", "continue_loop", "conditional", "ToolRule", "require_parent_tools"
195+
]
191196
"""Type of tool rule."""
192197

193198

194199
class ToolRuleTerminalToolRule(TypedDict, total=False):
195200
tool_name: Required[str]
196201
"""The name of the tool. Must exist in the database for the user's organization."""
197202

198-
type: Literal["InitToolRule", "TerminalToolRule", "continue_loop", "ToolRule", "require_parent_tools"]
203+
type: Literal[
204+
"InitToolRule", "TerminalToolRule", "continue_loop", "conditional", "ToolRule", "require_parent_tools"
205+
]
206+
"""Type of tool rule."""
207+
208+
209+
class ToolRuleConditionalToolRule(TypedDict, total=False):
210+
child_output_mapping: Required[Dict[str, str]]
211+
"""The output case to check for mapping"""
212+
213+
tool_name: Required[str]
214+
"""The name of the tool. Must exist in the database for the user's organization."""
215+
216+
default_child: Optional[str]
217+
"""The default child tool to be called. If None, any tool can be called."""
218+
219+
require_output_mapping: bool
220+
"""Whether to throw an error when output doesn't match any case"""
221+
222+
type: Literal[
223+
"InitToolRule", "TerminalToolRule", "continue_loop", "conditional", "ToolRule", "require_parent_tools"
224+
]
199225
"""Type of tool rule."""
200226

201227

202-
ToolRule: TypeAlias = Union[ToolRuleChildToolRule, ToolRuleInitToolRule, ToolRuleTerminalToolRule]
228+
ToolRule: TypeAlias = Union[
229+
ToolRuleChildToolRule, ToolRuleInitToolRule, ToolRuleTerminalToolRule, ToolRuleConditionalToolRule
230+
]

src/letta/types/agents/message_create_response.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
__all__ = [
1212
"MessageCreateResponse",
1313
"AssistantMessage",
14-
"InternalMonologue",
1514
"LettaUsageStatistics",
15+
"ReasoningMessage",
1616
"SystemMessage",
1717
"ToolCall",
1818
"ToolCallDelta",
@@ -35,16 +35,6 @@ class AssistantMessage(BaseModel):
3535
message_type: Optional[Literal["assistant_message"]] = None
3636

3737

38-
class InternalMonologue(BaseModel):
39-
id: str
40-
41-
date: datetime
42-
43-
internal_monologue: str
44-
45-
message_type: Optional[Literal["internal_monologue"]] = None
46-
47-
4838
class LettaUsageStatistics(BaseModel):
4939
completion_tokens: Optional[int] = None
5040
"""The number of tokens generated by the agent."""
@@ -59,6 +49,16 @@ class LettaUsageStatistics(BaseModel):
5949
"""The total number of tokens processed by the agent."""
6050

6151

52+
class ReasoningMessage(BaseModel):
53+
id: str
54+
55+
date: datetime
56+
57+
reasoning: str
58+
59+
message_type: Optional[Literal["reasoning_message"]] = None
60+
61+
6262
class SystemMessage(BaseModel):
6363
id: str
6464

@@ -145,14 +145,6 @@ class UserMessage(BaseModel):
145145
class MessageCreateResponse(BaseModel):
146146
assistant_message: Optional[AssistantMessage] = FieldInfo(alias="AssistantMessage", default=None)
147147

148-
internal_monologue: Optional[InternalMonologue] = FieldInfo(alias="InternalMonologue", default=None)
149-
"""Representation of an agent's internal monologue.
150-
151-
Attributes: internal_monologue (str): The internal monologue of the agent id
152-
(str): The ID of the message date (datetime): The date the message was created
153-
in ISO format
154-
"""
155-
156148
letta_usage_statistics: Optional[LettaUsageStatistics] = FieldInfo(alias="LettaUsageStatistics", default=None)
157149
"""Usage statistics for the agent interaction.
158150
@@ -162,6 +154,14 @@ class MessageCreateResponse(BaseModel):
162154
number of steps taken by the agent.
163155
"""
164156

157+
reasoning_message: Optional[ReasoningMessage] = FieldInfo(alias="ReasoningMessage", default=None)
158+
"""Representation of an agent's internal reasoning.
159+
160+
Attributes: reasoning (str): The internal reasoning of the agent id (str): The
161+
ID of the message date (datetime): The date the message was created in ISO
162+
format
163+
"""
164+
165165
system_message: Optional[SystemMessage] = FieldInfo(alias="SystemMessage", default=None)
166166
"""A message generated by the system.
167167

src/letta/types/agents/message_list_response.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"UnionMember1",
1616
"UnionMember1SystemMessageOutput",
1717
"UnionMember1UserMessageOutput",
18-
"UnionMember1InternalMonologue",
18+
"UnionMember1ReasoningMessage",
1919
"UnionMember1ToolCallMessage",
2020
"UnionMember1ToolCallMessageToolCall",
2121
"UnionMember1ToolCallMessageToolCallLettaSchemasLettaMessageToolCall",
@@ -104,14 +104,14 @@ class UnionMember1UserMessageOutput(BaseModel):
104104
message_type: Optional[Literal["user_message"]] = None
105105

106106

107-
class UnionMember1InternalMonologue(BaseModel):
107+
class UnionMember1ReasoningMessage(BaseModel):
108108
id: str
109109

110110
date: datetime
111111

112-
internal_monologue: str
112+
reasoning: str
113113

114-
message_type: Optional[Literal["internal_monologue"]] = None
114+
message_type: Optional[Literal["reasoning_message"]] = None
115115

116116

117117
class UnionMember1ToolCallMessageToolCallLettaSchemasLettaMessageToolCall(BaseModel):
@@ -178,7 +178,7 @@ class UnionMember1AssistantMessageOutput(BaseModel):
178178
Union[
179179
UnionMember1SystemMessageOutput,
180180
UnionMember1UserMessageOutput,
181-
UnionMember1InternalMonologue,
181+
UnionMember1ReasoningMessage,
182182
UnionMember1ToolCallMessage,
183183
UnionMember1ToolReturnMessage,
184184
UnionMember1AssistantMessageOutput,

0 commit comments

Comments
 (0)