modzyClient.getModels

Get some

modzyClient.getModels(modelId = null, author = null, createdByEmail = null, name = null, description = null, isActive = null, isExpired = null, isRecommended = null, lastActiveDateTime = null, expirationDateTime = null, page = null, perPage = 1000, direction = null, sortBy = null)

Returns a list of models. The list includes each model’s modelId, versions, and latestVersion.

Parameters

Parameter

Type

Description

Example

modelId

string

Filters models by identifier. Separaete multuple values with ;.

'ed542963de'

author

string

Filters models by the organization that created them. Separate multiple values with ;.

'Open Source'

createdByEmail

string

Filters models by creator’s email. Separate multiple values with ;.

'[email protected]'

name

string

Filters models by name. Separate multiple values with ;.

'Sentiment Analysis'

description

string

Filters models by description.

'Sentiment Analysis'

isActive

string
boolean

Filters models by status.

true

isExpired

string
boolean

Filters models by expired status.

false

isRecommended

string
boolean

Filters models recommended by Modzy.

false

lastActiveDateTime

string
Date

Filters models by the latest use date. It requires ISO8601 formated string (YYYY-MM-DDThh:mm:ss.sTZD) or a date object.

new Date()
'2021-08-13T07:28:03.831'

expirationDateTime

string
Date

Filters models by the expiration date. It requires ISO8601 formated string (YYYY-MM-DDThh:mm:ss.sTZD) or a date object.

new Date()
'2021-08-13T07:28:03.831'

page

number

The page number to be returned. Defaults to 0.

10

perPage

number

The number of records returned per page. Defaults to 10.

5

direction

string

Orders the records in ascending (ASC) or descending (DESC) order. It defaults to ASC.

ASC

sortBy

string

Models can be sorted by modelId, author, submittedByEmail, name, isExpired, isActive, latestVersion, isRecommended, lastActiveDateTime, expirationDateTime.

name

Returns

{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "type": "array",
    "items": {
        "$ref": "#/definitions/ModelItem"
    },
    "definitions": {
        "ModelItem": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "modelId": {
                    "type": "string"
                },
                "latestVersion": {
                    "type": "string"
                },
                "versions": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "latestVersion",
                "modelId",
                "versions"
            ]
        }
    }
}

Examples

Search by author

models = await modzyClient.getModels(
         /*modelId*/null, /*author*/'Open Source', /*createdByEmail*/null, /*name*/null, /*description*/null, 
         /*isActive*/null, /*isExpired*/null, /*isRecommended*/null, /*lastActiveDateTime*/null, /*expirationDateTime*/null,
         /*page*/null, /*perPage*/100, /*direction*/null, /*sortBy*/null);
console.log( `Open Source models ${models.length}` );

Active models

models = await modzyClient.getModels(
        /*modelId*/null, /*author*/null, /*createdByEmail*/null, /*name*/null, /*description*/null, 
        /*isActive*/true, /*isExpired*/null, /*isRecommended*/null, /*lastActiveDateTime*/null, /*expirationDateTime*/null,
        /*page*/null, /*perPage*/100, /*direction*/null, /*sortBy*/null);
console.log( `Active models ${models.length}` );

Search by name

models = await modzyClient.getModels(
        /*modelId*/null, /*author*/null, /*createdByEmail*/null, /*name*/'Image', /*description*/null, 
        /*isActive*/true, /*isExpired*/null, /*isRecommended*/null, /*lastActiveDateTime*/null, /*expirationDateTime*/null,
        /*page*/null, /*perPage*/5, /*direction*/null, /*sortBy*/null);
 console.log( `Models with name start with 'Image' ${models.length}` );

Combined search

models = await modzyClient.getModels(
         /*modelId*/null, /*author*/'Open Source', /*createdByEmail*/null, /*name*/'Image', /*description*/null, 
         /*isActive*/true, /*isExpired*/null, /*isRecommended*/null, /*lastActiveDateTime*/null, /*expirationDateTime*/null,
         /*page*/null, /*perPage*/1, /*direction*/null, /*sortBy*/null);
console.log( `Active open source models which name starts with 'Image' ${models.length}` );

Did this page help you?