Model Templates

model_templates

Methods

Create Model Template ->
post/v4/model-templates

Description

Creates a model template.

Details

Model templates serve 2 purposes. First, they provide common scaffolding that is static across multiple models. Second, they expose several variables that can be injected at model creation time to customize the model.

For example, a model template can define a docker image that contains code to run a HuggingFace or SentenceTransformers model. This docker image code also accepts environment variables that can be set to swap out the model weights or model name.

Two of the most important fields required to create a model template are the model_creation_parameters_schema and model_request_parameters_schema fields.

The model_creation_parameters_schema field defines the schema for parameters that can be injected at model creation time. For example, if the schema contains a model_weights_uri field, which expects a string, when a model is created from this template, the user can provide a URI to a model weights file that can be used to swap out the model weights used by the model.

The model_request_parameters_schema field defines the schema for parameters that can be injected by an end user at model execution time. For example, if the schema contains a model_request_parameters field, which expects a string, when a model is executed, the user can provide a string that will be passed to the model for inference.

Delete Model Template ->
delete/v4/model-templates/{model_template_id}

Description

Deletes a model template

Details

This API can be used to delete a model template by ID. To use this API, pass in the id that was returned from your Create Model Template API call as a path parameter.

List Model Templates -> PageResponse<>
get/v4/model-templates

Description

Lists all model templates accessible to the user.

Details

This API can be used to list model templates. If a user has access to multiple accounts, all model templates from all accounts the user is associated with will be returned.

Get Model Template ->
get/v4/model-templates/{model_template_id}

Description

Gets the details of a model template

Details

This API can be used to get information about a single model template by ID. To use this API, pass in the id that was returned from your Create Model Template API call as a path parameter.

Review the response schema to see the fields that will be returned.

Domain types

ModelTemplate = { id, account_id, created_at, 8 more... }
PaginatedModelTemplates = { current_page, items, items_per_page, 1 more... }
ParameterSchema = { parameters }
ParameterSchemaField = { description, name, required, 1 more... }