From f929d53cfe6c93e43feebb8b63f9e4a7d55c7c84 Mon Sep 17 00:00:00 2001 From: Christina Tong Date: Wed, 17 Dec 2025 10:18:11 -0800 Subject: [PATCH] add msg id to search endpoint response [LET-6582] (#7236) * add msg id to search endpoint response * rename --- fern/openapi.json | 36 ++++++++++++++++++++++++++-------- letta/schemas/letta_message.py | 24 +++++++++++++++++++---- letta/schemas/message.py | 4 ++++ 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/fern/openapi.json b/fern/openapi.json index 62e31a06..da7d6854 100644 --- a/fern/openapi.json +++ b/fern/openapi.json @@ -21952,6 +21952,11 @@ "title": "Content", "description": "The message content sent by the assistant (can be a string or an array of content parts)" }, + "message_id": { + "type": "string", + "title": "Message Id", + "description": "The unique identifier of the message." + }, "agent_id": { "anyOf": [ { @@ -21972,9 +21977,9 @@ } }, "type": "object", - "required": ["content", "created_at"], + "required": ["content", "message_id", "created_at"], "title": "AssistantMessageListResult", - "description": "Assistant message list result with agent context.\n\nShape is identical to UpdateAssistantMessage but includes the owning agent_id." + "description": "Assistant message list result with agent context.\n\nShape is identical to UpdateAssistantMessage but includes the owning agent_id and message id." }, "Audio": { "properties": { @@ -34376,6 +34381,11 @@ "title": "Message Type", "default": "reasoning_message" }, + "message_id": { + "type": "string", + "title": "Message Id", + "description": "The unique identifier of the message." + }, "agent_id": { "anyOf": [ { @@ -34396,9 +34406,9 @@ } }, "type": "object", - "required": ["reasoning", "created_at"], + "required": ["reasoning", "message_id", "created_at"], "title": "ReasoningMessageListResult", - "description": "Reasoning message list result with agent context.\n\nShape is identical to UpdateReasoningMessage but includes the owning agent_id." + "description": "Reasoning message list result with agent context.\n\nShape is identical to UpdateReasoningMessage but includes the owning agent_id and message id." }, "RedactedReasoningContent": { "properties": { @@ -36870,6 +36880,11 @@ "title": "Content", "description": "The message content sent by the system (can be a string or an array of multi-modal content parts)" }, + "message_id": { + "type": "string", + "title": "Message Id", + "description": "The unique identifier of the message." + }, "agent_id": { "anyOf": [ { @@ -36890,9 +36905,9 @@ } }, "type": "object", - "required": ["content", "created_at"], + "required": ["content", "message_id", "created_at"], "title": "SystemMessageListResult", - "description": "System message list result with agent context.\n\nShape is identical to UpdateSystemMessage but includes the owning agent_id." + "description": "System message list result with agent context.\n\nShape is identical to UpdateSystemMessage but includes the owning agent_id and message id." }, "TagSchema": { "properties": { @@ -39541,6 +39556,11 @@ "title": "Content", "description": "The message content sent by the user (can be a string or an array of multi-modal content parts)" }, + "message_id": { + "type": "string", + "title": "Message Id", + "description": "The unique identifier of the message." + }, "agent_id": { "anyOf": [ { @@ -39561,9 +39581,9 @@ } }, "type": "object", - "required": ["content", "created_at"], + "required": ["content", "message_id", "created_at"], "title": "UserMessageListResult", - "description": "User message list result with agent context.\n\nShape is identical to UpdateUserMessage but includes the owning agent_id." + "description": "User message list result with agent context.\n\nShape is identical to UpdateUserMessage but includes the owning agent_id and message id." }, "UserUpdate": { "properties": { diff --git a/letta/schemas/letta_message.py b/letta/schemas/letta_message.py index ac26bce5..63b459e0 100644 --- a/letta/schemas/letta_message.py +++ b/letta/schemas/letta_message.py @@ -563,9 +563,13 @@ LettaMessageUpdateUnion = Annotated[ class SystemMessageListResult(UpdateSystemMessage): """System message list result with agent context. - Shape is identical to UpdateSystemMessage but includes the owning agent_id. + Shape is identical to UpdateSystemMessage but includes the owning agent_id and message id. """ + message_id: str = Field( + ..., + description="The unique identifier of the message.", + ) agent_id: str | None = Field( default=None, description="The unique identifier of the agent that owns the message.", @@ -577,9 +581,13 @@ class SystemMessageListResult(UpdateSystemMessage): class UserMessageListResult(UpdateUserMessage): """User message list result with agent context. - Shape is identical to UpdateUserMessage but includes the owning agent_id. + Shape is identical to UpdateUserMessage but includes the owning agent_id and message id. """ + message_id: str = Field( + ..., + description="The unique identifier of the message.", + ) agent_id: str | None = Field( default=None, description="The unique identifier of the agent that owns the message.", @@ -591,9 +599,13 @@ class UserMessageListResult(UpdateUserMessage): class ReasoningMessageListResult(UpdateReasoningMessage): """Reasoning message list result with agent context. - Shape is identical to UpdateReasoningMessage but includes the owning agent_id. + Shape is identical to UpdateReasoningMessage but includes the owning agent_id and message id. """ + message_id: str = Field( + ..., + description="The unique identifier of the message.", + ) agent_id: str | None = Field( default=None, description="The unique identifier of the agent that owns the message.", @@ -605,9 +617,13 @@ class ReasoningMessageListResult(UpdateReasoningMessage): class AssistantMessageListResult(UpdateAssistantMessage): """Assistant message list result with agent context. - Shape is identical to UpdateAssistantMessage but includes the owning agent_id. + Shape is identical to UpdateAssistantMessage but includes the owning agent_id and message id. """ + message_id: str = Field( + ..., + description="The unique identifier of the message.", + ) agent_id: str | None = Field( default=None, description="The unique identifier of the agent that owns the message.", diff --git a/letta/schemas/message.py b/letta/schemas/message.py index 9fc4a580..904b64a0 100644 --- a/letta/schemas/message.py +++ b/letta/schemas/message.py @@ -360,6 +360,7 @@ class Message(BaseMessage): if isinstance(lm, SystemMessage): letta_search_results.append( SystemMessageListResult( + message_id=message.id, message_type=lm.message_type, content=lm.content, agent_id=message.agent_id, @@ -369,6 +370,7 @@ class Message(BaseMessage): elif isinstance(lm, UserMessage): letta_search_results.append( UserMessageListResult( + message_id=message.id, message_type=lm.message_type, content=lm.content, agent_id=message.agent_id, @@ -378,6 +380,7 @@ class Message(BaseMessage): elif isinstance(lm, ReasoningMessage): letta_search_results.append( ReasoningMessageListResult( + message_id=message.id, message_type=lm.message_type, reasoning=lm.reasoning, agent_id=message.agent_id, @@ -387,6 +390,7 @@ class Message(BaseMessage): elif isinstance(lm, AssistantMessage): letta_search_results.append( AssistantMessageListResult( + message_id=message.id, message_type=lm.message_type, content=lm.content, agent_id=message.agent_id,