yera.models.data_classes

Class representing structured LLM conversation messages.

Symbols

class Message — Represents a single message in an LLM conversation.

Message

Inherits: BaseModel

Represents a single message in an LLM conversation.

Attributes

role
type: Literal['user', 'system', 'assistant']

The speaker role — one of 'user', 'system', or 'assistant'.

content
type: str

The text content of the message.

Methods

user — Create a user-role message.
system — Create a system-role message.
assistant — Create an assistant-role message.

Message.user

user(
    content: str,
) → Message

Create a user-role message.

Parameters

content
type: str

The text content of the user message.

Returns

type: Message

A Message instance with role set to 'user'.

Message.system

system(
    content: str,
) → Message

Create a system-role message.

Parameters

content
type: str

The text content of the system prompt.

Returns

type: Message

A Message instance with role set to 'system'.

Message.assistant

assistant(
    content: str,
) → Message

Create an assistant-role message.

Parameters

content
type: str

The text content of the assistant response.

Returns

type: Message

A Message instance with role set to 'assistant'.