yera.models.context.base

Module containing the base class for all model contexts.

Symbols

class BaseModelContext — The abstract base class for all model context classes.

BaseModelContext

Inherits: ABC
Subclasses: LLMContext

The abstract base class for all model context classes.

Implementations must implement a method that gets the current value in a context var. This is used to manage a stack of model contexts.

Methods

__init__ — Initialize a model context before it is entered.
__enter__ — Enter the model context and make it the active one.
__exit__ — Exit the model context and restore the previous context value.

BaseModelContext.__init__

__init__() → None

Initialize a model context before it is entered.

BaseModelContext.__enter__

__enter__() → None

Enter the model context and make it the active one.

BaseModelContext.__exit__

__exit__(
    exc_type: type[BaseException] | None,
    exc_val: BaseException | None,
    exc_tb: TracebackType | None,
)

Exit the model context and restore the previous context value.

Parameters

exc_type
type: type[BaseException] | None

Type of exception leaving the context, if any.

exc_val
type: BaseException | None

Exception leaving the context, if any.

exc_tb
type: TracebackType | None

Traceback associated with the exception, if any.