roboto.ai.chat.record#

Module Contents#

type roboto.ai.chat.record.ChatContent = ChatTextContent | ChatToolUseContent | ChatToolResultContent#

Type alias for all possible content types within chat messages.

class roboto.ai.chat.record.ChatContentType#

Bases: str, enum.Enum

Enumeration of different types of content within chat messages.

Defines the various content types that can be included in chat messages.

TEXT = 'text'#

Plain text content from users or AI responses.

TOOL_RESULT = 'tool_result'#

Results returned from tool executions.

TOOL_USE = 'tool_use'#

Tool invocation requests from the AI assistant.

class roboto.ai.chat.record.ChatMessage(/, **data)#

Bases: pydantic.BaseModel

A single message within a chat conversation.

Represents one message in the conversation, containing the sender role, content blocks, and generation status. Messages can contain multiple content blocks of different types (text, tool use, tool results).

Parameters:

data (Any)

content: list[ChatContent]#

List of content blocks that make up this message.

is_complete()#

Check if message generation is complete.

Returns:

True if the message status is COMPLETED, False otherwise.

Return type:

bool

role: ChatRole#

The role of the message sender (user, assistant, or roboto).

status: ChatMessageStatus#

Current generation status of this message.

classmethod text(text, role=ChatRole.USER)#

Create a simple text message.

Convenience method for creating a message containing only text content.

Parameters:
  • text (str) – The text content for the message.

  • role (ChatRole) – The role of the message sender. Defaults to USER.

Returns:

ChatMessage instance containing the text content.

Return type:

ChatMessage

class roboto.ai.chat.record.ChatMessageStatus#

Bases: str, enum.Enum

Enumeration of possible message generation states.

Tracks the lifecycle of message generation from initiation to completion.

COMPLETED = 'completed'#

Message generation has finished and content is complete.

GENERATING = 'generating'#

Message content is currently being generated.

NOT_STARTED = 'not_started'#

Message has been queued but generation has not begun.

class roboto.ai.chat.record.ChatRecord(/, **data)#

Bases: pydantic.BaseModel

Complete record of a chat session.

Contains all the persistent data for a chat session including metadata, message history, and synchronization state.

Parameters:

data (Any)

chat_id: str#

Unique identifier for this chat session.

continuation_token: str#

Token used for incremental updates and synchronization.

created: datetime.datetime#

Timestamp when the chat session was created.

created_by: str#

User ID of the person who created this chat session.

messages: list[ChatMessage] = None#

Complete list of messages in the conversation.

org_id: str#

Organization ID that owns this chat session.

class roboto.ai.chat.record.ChatRecordDelta(/, **data)#

Bases: pydantic.BaseModel

Incremental update to a chat session.

Contains only the changes since the last synchronization, used for efficient real-time updates without transferring the entire chat history.

Parameters:

data (Any)

continuation_token: str#

Updated token for the next incremental synchronization.

messages_by_idx: dict[int, ChatMessage]#

New or updated messages indexed by their position in the conversation.

class roboto.ai.chat.record.ChatRole#

Bases: str, enum.Enum

Enumeration of possible roles in a chat conversation.

Defines the different participants that can send messages in a chat session.

ASSISTANT = 'assistant'#

AI assistant responding to user queries and requests.

ROBOTO = 'roboto'#

Roboto system providing tool results and system information.

USER = 'user'#

Human user sending messages to the AI assistant.

class roboto.ai.chat.record.ChatTextContent(/, **data)#

Bases: pydantic.BaseModel

Text content within a chat message.

Parameters:

data (Any)

text: str#

The actual text content of the message.

class roboto.ai.chat.record.ChatToolResultContent(/, **data)#

Bases: pydantic.BaseModel

Tool execution result content within a chat message.

Parameters:

data (Any)

tool_result: dict[str, Any]#

Results returned from tool execution including output data and status.

class roboto.ai.chat.record.ChatToolUseContent(/, **data)#

Bases: pydantic.BaseModel

Tool usage request content within a chat message.

Parameters:

data (Any)

tool_use: dict[str, Any]#

Tool invocation details including tool name and parameters.

class roboto.ai.chat.record.StartChatRequest(/, **data)#

Bases: pydantic.BaseModel

Request payload for starting a new chat session.

Contains the initial messages and configuration for creating a new chat conversation.

Parameters:

data (Any)

messages: list[ChatMessage]#

Initial messages to start the conversation with.

system_prompt: str | None = None#

Optional system prompt to customize AI assistant behavior.