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: roboto.compat.StrEnum

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: roboto.compat.StrEnum

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)

calculate_new_status()#

Calculate the new status of the chat session based on the latest message.

Return type:

ChatStatus

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.

status: ChatStatus#

Current status of the chat session.

title: str | None = None#

Title of the 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)

calculate_new_status()#

Calculate the new status of the chat session based on the latest message.

Return type:

ChatStatus | None

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.

status: ChatStatus | None = None#

Updated status of the chat session.

title: str | None = None#

Updated title of the chat session.

class roboto.ai.chat.record.ChatRole#

Bases: roboto.compat.StrEnum

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.ChatStatus#

Bases: roboto.compat.StrEnum

Enumeration of possible chat session states.

Tracks the overall status of a chat session from creation to termination.

NOT_STARTED = 'not_started'#

Chat session has been created but no messages have been sent.

ROBOTO_TURN = 'roboto_turn'#

Roboto is generating a message.

USER_TURN = 'user_turn'#

User has the turn to send a message.

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)

content_type: Literal[ChatContentType]#
raw_response: dict[str, Any] | None = None#
runtime_ms: int#
status: str#
tool_name: str#
tool_use_id: str#
class roboto.ai.chat.record.ChatToolUseContent(/, **data)#

Bases: pydantic.BaseModel

Tool usage request content within a chat message.

Parameters:

data (Any)

content_type: Literal[ChatContentType]#
raw_request: dict[str, Any] | None = None#
tool_name: str#
tool_use_id: str#
class roboto.ai.chat.record.SendMessageRequest(/, **data)#

Bases: pydantic.BaseModel

Request payload for sending a message to a chat session.

Contains the message content and optional context for the AI assistant.

Parameters:

data (Any)

context: roboto.ai.core.RobotoLLMContext | None = None#

Optional context to include with the message.

message: ChatMessage#

Message content to send.

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)

context: roboto.ai.core.RobotoLLMContext | None = None#

Optional context to include with the message.

messages: list[ChatMessage]#

Initial messages to start the conversation with.

system_prompt: str | None = None#

Optional system prompt to customize AI assistant behavior.