models
Models module.
models module
Models module.
class ModelWithDetails
Bases: Model
Represents a model with details.
overview : str | None
The overview of the model.
latest_version : ModelVersionWithDetails | None
The details of the latest version of the model.
source_url : str | None
Source url from where the model’s code can be referenced.
license_url : str | None
License url where the model’s usage is specified.
paper_url : str | None
Paper url from where research info on the model can be found.
id : str
name : str
created_at : str
visibility : ModelVisibility
description : str | None
updated_at : str | None
owner : BaseUser
hardware : Hardware
predictions_count : int
categories : list[ModelCategory]
class ModelsSortBy(StrEnum)
Bases: StrEnum
Enumeration of possible sorting options for querying models.
CREATED_AT = 'created_at'
PREDICTIONS_COUNT = 'predictions_count'
class ModelPaginationOptions
Bases: PaginationOptions
Pagination options for querying models.
sort_by : NotRequired[ModelsSortBy]
The sorting criteria.
sort_direction : NotRequired[SortDirection]
The sorting direction.
category_slugs : NotRequired[list[str]]
The list of category slugs to filter models.
cursor : NotRequired[str]
page_size : NotRequired[int]
class UpdateModelParams
Bases: TypedDict
Parameters for updating a model.
name : NotRequired[str]
The name of the model.
description : NotRequired[str | None]
Description of the model.
visibility : NotRequired[ModelVisibility]
The visibility of the model.
hardware_identifier : NotRequired[str]
The identifier of the hardware used by the model.
source_url : NotRequired[str | None]
Source url from where the model’s code can be referenced.
license_url : NotRequired[str | None]
License url where the model’s usage is specified.
paper_url : NotRequired[str | None]
Paper url from where research info on the model can be found.
overview : NotRequired[str | None]
The overview of the model.
category_slugs : NotRequired[list[str]]
List of model category slugs.
class CreateModelParams
Bases: TypedDict
Parameters for creating a model.
name : str
The name of the model.
hardware_identifier : str
The identifier of the hardware used by the model.
visibility : NotRequired[ModelVisibility]
The visibility of the model.
description : NotRequired[str | None]
Description of the model.
source_url : NotRequired[str | None]
Source url from where the model’s code can be referenced.
license_url : NotRequired[str | None]
License url where the model’s usage is specified.
paper_url : NotRequired[str | None]
Paper url from where research info on the model can be found.
overview : NotRequired[str | None]
The overview of the model.
category_slugs : NotRequired[list[str]]
List of model category slugs.
class ModelsResource(api)
Bases: Resource
Initializes the Resource with an API instance.
- Parameters: api (API) – An instance of the API class.
delete(identifier)
Delete a model.
- Parameters: identifier (str) – The model identifier in owner/name format (for example: deepseek-ai/deepseek-r1).
- Return type: None
async async_delete(identifier)
Delete a model.
- Parameters: identifier (str) – The model identifier in owner/name format (for example: deepseek-ai/deepseek-r1).
- Return type: None
list(pagination_options=None, owner=None)
List models.
- Parameters:
- pagination_options (ModelPaginationOptions | None) – Optional settings to control pagination behavior.
- owner (str | None) – Username of the model’s owner to fetch models for. If None, all models are fetched.
- Returns: Paginated response containing models and navigation metadata.
- Return type: PaginatedResponse[Model]
async async_list(pagination_options=None, owner=None)
List models.
- Parameters:
- pagination_options (ModelPaginationOptions | None) – Optional settings to control pagination behavior.
- owner (str | None) – Username of the model’s owner to fetch models for. If None, all models are fetched.
- Returns: Paginated response containing models and navigation metadata.
- Return type: PaginatedResponse[Model]
get(identifier)
Get a model.
- Parameters: identifier (str) – The model identifier in owner/name format (for example: deepseek-ai/deepseek-r1).
- Returns: A model object.
- Return type: ModelWithDetails
async async_get(identifier)
Get a model.
- Parameters: identifier (str) – The model identifier in owner/name format (for example: deepseek-ai/deepseek-r1).
- Returns: A model object.
- Return type: ModelWithDetails
create(params)
Create a model.
- Parameters: params (CreateModelParams) – Model creation parameters.
- Returns: The new model.
- Return type: ModelWithDetails
async async_create(params)
Create a model.
- Parameters: params (CreateModelParams) – Model creation parameters.
- Returns: The new model.
- Return type: ModelWithDetails
update(identifier, params)
Update a model.
- Parameters:
- identifier (str) – The model identifier in owner/name format (for example: deepseek-ai/deepseek-r1).
- params (UpdateModelParams) – The fields to update.
- Returns: The updated model.
- Return type: ModelWithDetails
async async_update(identifier, params)
Update a model.
- Parameters:
- identifier (str) – The model identifier in owner/name format (for example: deepseek-ai/deepseek-r1).
- params (UpdateModelParams) – The fields to update.
- Returns: The updated model.
- Return type: ModelWithDetails
search(q, pagination_options=None)
Search models.
- Parameters:
- q (str) – The search query.
- pagination_options (PaginationOptions | None) – Optional settings to control pagination behavior.
- Returns: Paginated response containing models and navigation metadata.
- Return type: PaginatedResponse[Model]
async async_search(q, pagination_options=None)
Search models.
- Parameters:
- q (str) – The search query.
- pagination_options (PaginationOptions | None) – Optional settings to control pagintation behavior.
- Returns: Paginated response containing models and navigation metadata.
- Return type: PaginatedResponse[Model]