GuidesRecipesAPI ReferenceChangelogDiscussions
Log In

client.models.get_models

Retrieve models

client.models.get_models(model_id=None, author=None, created_by_email=None, name=None, description=None, is_active=None, is_expired=None, is_recommended=None, last_active_date_time=None, expiration_date_time=None, sort_by=None, direction=None, page=None, per_page=1000)

Returns a list of models. The list includes each model’s model_id, versions, and latest_version.

Parameters

ParameterTypeDescriptionExample
model_idstrFilters models by identifier. Separate multiple values with ;.'ed542963de'
authorstrFilters models by the organization that created them. Separate multiple values with ;.'Open Source'
created_by_emailstrFilters models by creator’s email. Separate multiple values with ;.'[email protected]'
namestrFilters models by name. Separate multiple values with ;.'Sentiment Analysis'
descriptionstrFilters models by description.'Sentiment Analysis'
is_activebooleanFilters models by status.True
is_recommendedbooleanFilters models recommended by Modzy.False
last_active_date_timedatetime
str
Filters models by the latest use date. It requires ISO8601 formated string (YYYY-MM-DDThh:mm:ss.sTZD) or a datetime object (https://docs.python.org/3/library/datetime.html).datetime.now()
'2021-08-13T07:28:03.831'
expiration_date_timedatetime
str
Filters models by the expiration date. It requires ISO8601 formated string (YYYY-MM-DDThh:mm:ss.sTZD) or a datetime object (https://docs.python.org/3/library/datetime.html).datetime.now()
'2021-08-13T07:28:03.831'
sort_bystrModels can be sorted by modelId, author, submittedByEmail, name, isExpired, isActive, latestVersion, isRecommended, lastActiveDateTime, expirationDateTime.'name'
directionstrOrders the records in ascending (ASC) or descending (DESC) order. It defaults to ASC.'DESC'
pageintThe page number to be returned. Defaults to 0.1
per_pageintThe number of records returned per page. Defaults to 10.15

Returns

A JSON object with a list of any models the meet the criteria specified by the parameters supplied.

[
  {
    "model_id": "string",
    "latest_version": "string",
    "versions": ["string"]
  }
]

Examples

>>># Search by author:
>>>params = {'author': 'Open Source'}
>>>models = client.models.get_models(**params)
>>>len(models)
14

Search for active models:

>>>params = {'is_active': True}
>>>models = client.models.get_models(**params)
>>>len(models)
150

Search by name (and paginate the results):

>>>params = {'name': "Image", 'per_page':5}
>>>models = client.models.get_models(**params)
>>>len(models)
5

Combined search

>>>params = {'name': "Image", 'author': 'Open Source', 'is_active': True}
>>>models = client.models.get_models(**params)
>>>len(models)
2