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
Parameter | Type | Description | Example |
---|---|---|---|
model_id | str | Filters models by identifier. Separate multiple values with ; . | 'ed542963de' |
author | str | Filters models by the organization that created them. Separate multiple values with ; . | 'Open Source' |
created_by_email | str | Filters models by creator’s email. Separate multiple values with ; . | '[email protected]' |
name | str | Filters models by name. Separate multiple values with ; . | 'Sentiment Analysis' |
description | str | Filters models by description. | 'Sentiment Analysis' |
is_active | boolean | Filters models by status. | True |
is_recommended | boolean | Filters models recommended by Modzy. | False |
last_active_date_time | datetime 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_time | datetime 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_by | str | Models can be sorted by modelId , author , submittedByEmail , name , isExpired , isActive , latestVersion , isRecommended , lastActiveDateTime , expirationDateTime . | 'name' |
direction | str | Orders the records in ascending (ASC ) or descending (DESC ) order. It defaults to ASC . | 'DESC' |
page | int | The page number to be returned. Defaults to 0. | 1 |
per_page | int | The 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
Updated almost 2 years ago