Light Logo
Python SDK (v0.16.0)Reference

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.

id : str

name : str

created_at : str

visibility : ModelVisibility

description : str | None

updated_at : str | None

source_url : str | None

license_url : str | None

paper_url : str | None

owner : User

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'

PREDICTION_COUNT = 'prediction_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(owner, name)

Delete a model.

  • Parameters:
    • owner (str) – Username of the model’s owner.
    • name (str) – Name of the model.
  • Return type: None

async async_delete(owner, name)

Delete a model.

  • Parameters:
    • owner (str) – Username of the model’s owner.
    • name (str) – Name of the model.
  • Return type: None

list(pagination_options=None, owner=None)

List models.

  • Parameters:
    • pagination_options (Optional [ModelPaginationOptions ]) – Optional settings to control pagination behavior.
    • owner (Optional[str]) – 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 (Optional[ModelPaginationOptions]) – Optional settings to control pagination behavior.
    • owner (Optional[str]) – 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(owner, name)

Get a model.

  • Parameters:
    • owner (str) – Username of the model’s owner.
    • name (str) – Name of the model.
  • Returns: A model object.
  • Return type: ModelWithDetails

async async_get(owner, name)

Get a model.

  • Parameters:
    • owner (str) – Username of the model’s owner.
    • name (str) – Name of the model.
  • Returns: A model object.
  • Return type: ModelWithDetails

create(params)

Create a model.

async async_create(params)

Create a model.

update(owner, name, params)

Update a model.

  • Parameters:
    • owner (str) – Username of the model’s owner.
    • name (str) – Name of the model.
    • params (UpdateModelParams) – The fields to update.
  • Returns: The updated model.
  • Return type: ModelWithDetails

async async_update(owner, name, params)

Update a model.

  • Parameters:
    • owner (str) – Username of the model’s owner.
    • name (str) – Name of the model.
    • 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 (Optional [PaginationOptions ]) – 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 (Optional [PaginationOptions ]) – Optional settings to control pagintation behavior.
  • Returns: Paginated response containing models : and navigation metadata.
  • Return type: PaginatedResponse[Model]

On this page

models module
class ModelWithDetails
overview : str | None
latest_version :
ModelVersionWithDetails | None
id : str
name : str
created_at : str
visibility :
ModelVisibility
description : str | None
updated_at : str | None
source_url : str | None
license_url : str | None
paper_url : str | None
owner :
User
hardware : Hardware
predictions_count : int
categories : list[
ModelCategory]
class ModelsSortBy(StrEnum)
CREATED_AT = 'created_at'
PREDICTION_COUNT = 'prediction_count'
class ModelPaginationOptions
sort_by : NotRequired[
ModelsSortBy]
sort_direction : NotRequired[
SortDirection]
category_slugs : NotRequired[list[str]]
cursor : NotRequired[str]
page_size : NotRequired[int]
class UpdateModelParams
name : NotRequired[str]
description : NotRequired[str | None]
visibility : NotRequired[
ModelVisibility]
hardware_identifier : NotRequired[str]
source_url : NotRequired[str | None]
license_url : NotRequired[str | None]
paper_url : NotRequired[str | None]
overview : NotRequired[str | None]
category_slugs : NotRequired[list[str]]
class CreateModelParams
name : str
hardware_identifier : str
visibility : NotRequired[
ModelVisibility]
description : NotRequired[str | None]
source_url : NotRequired[str | None]
license_url : NotRequired[str | None]
paper_url : NotRequired[str | None]
overview : NotRequired[str | None]
category_slugs : NotRequired[list[str]]
class ModelsResource(api)
delete(owner, name)
async async_delete(owner, name)
list(pagination_options=None, owner=None)
async async_list(pagination_options=None, owner=None)
get(owner, name)
async async_get(owner, name)
create(params)
async async_create(params)
update(owner, name, params)
async async_update(owner, name, params)
search(q, pagination_options=None)
async async_search(q, pagination_options=None)