yera.models.workspace

Workspace module for managing conversation state and message history.

This module provides the Workspace class which serves as a container for managing message sequences and variables in an app execution context.

Symbols

class Workspace — Manages message history and variable state for app execution.

Workspace

Manages message history and variable state for app execution.

The Workspace maintains a list of messages exchanged during app execution and provides a dictionary for storing arbitrary variables and context needed during execution. It provides convenience methods for adding messages of different roles (user, system, assistant).

Attributes

messages
type: list[Message]

A list of Message objects representing the conversation history.

variables
type: dict

A dictionary for storing execution context and variables.

Methods

add_user_message — Add a user message to the workspace.
add_sys_message — Add a system message to the workspace.
add_assistant_message — Add a user message to the workspace.

Workspace.add_user_message

add_user_message(
    content: str,
) → None

Add a user message to the workspace.

Workspace.add_sys_message

add_sys_message(
    content: str,
) → None

Add a system message to the workspace.

Workspace.add_assistant_message

add_assistant_message(
    content: str,
) → None

Add a user message to the workspace.