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. |
Model |
Represents an AI model with its provider and name. |
Functions:
| Name | Description |
|---|---|
iter_pydantic_ai_model_full_names |
Iterate over all available models from pydantic-ai's known models. |
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
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 into a Model instance. |
get_default_context_window_size |
Get the default context window size for the model. |
Source code in src/brag/models.py
get_default_context_window_size
π
Get the default context window size for the model.
Returns:
| Type | Description |
|---|---|
TokenCount | None
|
The default context window size for the model, or None if not found. |