models
Model definitions for AI providers and their models.
This module provides a standardized way to represent and work with AI models from different providers. It includes utilities for parsing model names, validating them, and accessing available models.
Classes:
Name | Description |
---|---|
InvalidFullModelNameError |
Raised when a full model name doesn't follow the 'provider:name' format. |
MissingAPIKeyError |
Raised when a model has no API key environment variable. |
MissingContextWindowSizeError |
Raised when a model has no context window size. |
Model |
Represents an AI model with its provider and name. |
Attributes:
Name | Type | Description |
---|---|---|
AVAILABLE_MODELS |
Frozen set of all available and valid AI models. |
|
AVAILABLE_MODEL_FULL_NAMES |
Frozen set of all available and valid AI model full names. |
AVAILABLE_MODELS
module-attribute
π
AVAILABLE_MODELS = frozenset(_iter_available_models())
Frozen set of all available and valid AI models.
AVAILABLE_MODEL_FULL_NAMES
module-attribute
π
AVAILABLE_MODEL_FULL_NAMES = frozenset(full_name for model in AVAILABLE_MODELS)
Frozen set of all available and valid AI model full names.
InvalidFullModelNameError
π
Bases: ValueError
Raised when a full model name doesn't follow the 'provider:name' format.
Source code in src/brag/models.py
MissingAPIKeyError
π
Bases: ValueError
Raised when a model has no API key environment variable.
Source code in src/brag/models.py
MissingContextWindowSizeError
π
Model
π
Bases: BaseModel
Represents an AI model with its provider and name.
Models are immutable and identified by a combination of provider and name.
Methods:
Name | Description |
---|---|
from_full_name |
Parse a full model name in 'provider:name' format into a Model instance. |
Source code in src/brag/models.py
from_full_name
classmethod
π
from_full_name(full_name: AvailableModelFullName) -> Self
Parse a full model name in 'provider:name' format into a Model instance.