aixplain.factories.model_factory.mixins.model_getter
ModelGetterMixin Objects
class ModelGetterMixin()
Mixin class providing model retrieval functionality.
This mixin provides methods for retrieving model instances from the backend, with support for caching to improve performance.
get
@classmethod
def get(cls,
model_id: Text,
api_key: Optional[Text] = None,
use_cache: bool = False) -> Model
Retrieve a model instance by its ID.
This method attempts to retrieve a model from the cache if enabled, falling back to fetching from the backend if necessary.
Arguments:
model_id
Text - ID of the model to retrieve.api_key
Optional[Text], optional - API key for authentication. Defaults to None, using the configured TEAM_API_KEY.use_cache
bool, optional - Whether to attempt retrieving from cache. Defaults to False.
Returns:
Model
- Retrieved model instance.
Raises:
Exception
- If the model cannot be retrieved or doesn't exist.