feat: Add conversation_id filtering to message endpoints (#8324)
* feat: Add conversation_id filtering to message list and search endpoints Add optional conversation_id parameter to filter messages by conversation: - client.agents.messages.list - client.messages.list - client.messages.search Changes: - Added conversation_id field to MessageSearchRequest and SearchAllMessagesRequest schemas - Added conversation_id filtering to list_messages in message_manager.py - Updated get_agent_recall_async and get_all_messages_recall_async in server.py - Added conversation_id query parameter to router endpoints - Updated Turbopuffer client to support conversation_id filtering in searches Fixes #8320 🤖 Generated with [Letta Code](https://letta.com) Co-Authored-By: Charles Packer <cpacker@users.noreply.github.com> * add conversation_id to message and tpuf * default messages filter for backward compatibility * add test and auto gen * fix integration test * fix test * update test --------- Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com> Co-authored-by: Charles Packer <cpacker@users.noreply.github.com> Co-authored-by: christinatong01 <christina@letta.com>
This commit is contained in:
committed by
Caren Thomas
parent
737d6e2550
commit
ed6284cedb
@@ -211,6 +211,7 @@ class Message(BaseMessage):
|
||||
tool_returns (List[ToolReturn]): The list of tool returns requested.
|
||||
group_id (str): The multi-agent group that the message was sent in.
|
||||
sender_id (str): The id of the sender of the message, can be an identity id or agent id.
|
||||
conversation_id (str): The conversation this message belongs to.
|
||||
t
|
||||
"""
|
||||
|
||||
@@ -237,6 +238,7 @@ class Message(BaseMessage):
|
||||
group_id: Optional[str] = Field(default=None, description="The multi-agent group that the message was sent in")
|
||||
sender_id: Optional[str] = Field(default=None, description="The id of the sender of the message, can be an identity id or agent id")
|
||||
batch_item_id: Optional[str] = Field(default=None, description="The id of the LLMBatchItem that this message is associated with")
|
||||
conversation_id: Optional[str] = Field(default=None, description="The conversation this message belongs to")
|
||||
is_err: Optional[bool] = Field(
|
||||
default=None, description="Whether this message is part of an error step. Used only for debugging purposes."
|
||||
)
|
||||
@@ -2302,6 +2304,7 @@ class MessageSearchRequest(BaseModel):
|
||||
agent_id: Optional[str] = Field(None, description="Filter messages by agent ID")
|
||||
project_id: Optional[str] = Field(None, description="Filter messages by project ID")
|
||||
template_id: Optional[str] = Field(None, description="Filter messages by template ID")
|
||||
conversation_id: Optional[str] = Field(None, description="Filter messages by conversation ID")
|
||||
limit: int = Field(50, description="Maximum number of results to return", ge=1, le=100)
|
||||
start_date: Optional[datetime] = Field(None, description="Filter messages created after this date")
|
||||
end_date: Optional[datetime] = Field(None, description="Filter messages created on or before this date")
|
||||
@@ -2311,6 +2314,7 @@ class SearchAllMessagesRequest(BaseModel):
|
||||
query: str = Field(..., description="Text query for full-text search")
|
||||
search_mode: Literal["vector", "fts", "hybrid"] = Field("hybrid", description="Search mode to use")
|
||||
agent_id: Optional[str] = Field(None, description="Filter messages by agent ID")
|
||||
conversation_id: Optional[str] = Field(None, description="Filter messages by conversation ID")
|
||||
limit: int = Field(50, description="Maximum number of results to return", ge=1, le=100)
|
||||
start_date: Optional[datetime] = Field(None, description="Filter messages created after this date")
|
||||
end_date: Optional[datetime] = Field(None, description="Filter messages created on or before this date")
|
||||
|
||||
Reference in New Issue
Block a user