yera.models.context.base
Module containing the base class for all model contexts.
Symbols
BaseModelContext
Inherits:
ABCSubclasses:
LLMContextThe 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
BaseModelContext.__init__
__init__() → NoneInitialize a model context before it is entered.
BaseModelContext.__enter__
__enter__() → NoneEnter 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.