yera.models.context_factory.base

Module containing the base class for all module factories.

Symbols

class BaseModelContextFactory — The base model context factory class.

BaseModelContextFactory

Inherits: ABC, Generic[C, N]
Subclasses: LLMContextFactory

The base model context factory class.

Model context factories build model contexts based on the information in a model config object and a provider connection config object.

Inheritors must implement call which will return a model context of some model type. This will also allow keyword arguments that override the model's inference and other parameters.

Methods

__init__ — Initialize a factory from model and provider connection configuration.
__call__ — Build a model context with optional inference overrides.

BaseModelContextFactory.__init__

__init__(
    config: C,
    connection: N,
)

Initialize a factory from model and provider connection configuration.

Parameters

config
type: C

Model configuration supplied to each context the factory builds.

connection
type: N

Provider connection used by the model interface.

BaseModelContextFactory.__call__

__call__(
    **kwargs,
) → BaseModelContext

Build a model context with optional inference overrides.

Parameters

**kwargs
type: str | int | float | bool

Per-context inference overrides.

Returns

type: BaseModelContext

A context configured for this factory's model and connection.