Skip to content

Commit 174e3f3

Browse files
feat(api): api update (#2)
1 parent 9e52938 commit 174e3f3

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
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-b255d1730fcaf036db43fc05485c8b8a6e766bb0d15504e41b5c2bb0d8d44e3b.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/letta-ai%2Fletta-d32ce280dce8bf09416f5114194c4b05870757f2a9768902b9ccf66fb1ca6919.yml

src/letta/types/agents/message_create_response.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
"ToolCallMessageToolCallToolCall",
2222
"ToolCallMessageToolCallToolCallDelta",
2323
"ToolReturnMessage",
24+
"UsageMessage",
25+
"UsageMessageUsage",
2426
"UserMessage",
2527
]
2628

@@ -132,6 +134,37 @@ class ToolReturnMessage(BaseModel):
132134
stdout: Optional[List[str]] = None
133135

134136

137+
class UsageMessageUsage(BaseModel):
138+
completion_tokens: Optional[int] = None
139+
"""The number of tokens generated by the agent."""
140+
141+
prompt_tokens: Optional[int] = None
142+
"""The number of tokens in the prompt."""
143+
144+
step_count: Optional[int] = None
145+
"""The number of steps taken by the agent."""
146+
147+
total_tokens: Optional[int] = None
148+
"""The total number of tokens processed by the agent."""
149+
150+
151+
class UsageMessage(BaseModel):
152+
id: str
153+
154+
date: datetime
155+
156+
usage: UsageMessageUsage
157+
"""Usage statistics for the agent interaction.
158+
159+
Attributes: completion_tokens (int): The number of tokens generated by the
160+
agent. prompt_tokens (int): The number of tokens in the prompt. total_tokens
161+
(int): The total number of tokens processed by the agent. step_count (int): The
162+
number of steps taken by the agent.
163+
"""
164+
165+
message_type: Optional[Literal["usage_message"]] = None
166+
167+
135168
class UserMessage(BaseModel):
136169
id: str
137170

@@ -199,6 +232,13 @@ class MessageCreateResponse(BaseModel):
199232
invocation
200233
"""
201234

235+
usage_message: Optional[UsageMessage] = FieldInfo(alias="UsageMessage", default=None)
236+
"""A message representint the usage statistics for the agent interaction.
237+
238+
Attributes: usage (LettaUsageStatistics): Usage statistics for the agent
239+
interaction.
240+
"""
241+
202242
user_message: Optional[UserMessage] = FieldInfo(alias="UserMessage", default=None)
203243
"""A message sent by the user.
204244

0 commit comments

Comments
 (0)