Skip to main content

custom_models

Creates, updates, deletes, gets or lists a custom_models resource.

Overview

Namecustom_models
TypeResource
Iddigitalocean.genai.custom_models

Fields

The following fields are returned by SELECT queries:

A successful response.

NameDatatypeDescription
namestringName of the custom model (example: example name)
team_idstring (uint64)Team that owns the model (example: 12345)
active_deploymentsarrayList of active deployments using this model
architecturestringModel architecture type (free-form string from config.json) (example: example string)
config_jsonstringRaw config.json contents from the model repository (opaque JSON object)
context_lengthinteger (int64)Maximum context length supported by the model
cost_estimate_per_monthinteger (int64)Estimated monthly cost in dollars for hosting
created_atstring (date-time)Timestamp when the model was created (example: 2023-01-01T00:00:00Z)
descriptionstringDescription of the custom model (example: example string)
error_messagestringUser-facing reason the most recent import failed; empty otherwise. (example: example string)
file_countinteger (int64)Number of files in the model
input_modalitiesarrayInput modalities supported (e.g., text, image)
licensestringLicense under which the model is distributed (example: example string)
output_modalitiesarrayOutput modalities supported (e.g., text, image)
parametersstring (uint64)Number of parameters in the model (example: 12345)
source_refobjectReference to the original source of the model
source_typestringSource from which the model was imported (SOURCE_TYPE_UNSPECIFIED, SOURCE_TYPE_HUGGINGFACE, SOURCE_TYPE_SPACES_BUCKET, SOURCE_TYPE_SDK_UPLOAD, SOURCE_TYPE_FINE_TUNING) (default: SOURCE_TYPE_UNSPECIFIED, example: SOURCE_TYPE_UNSPECIFIED)
statusstringImport and deployment status of the custom model (STATUS_UNSPECIFIED, STATUS_IMPORTING, STATUS_READY, STATUS_FAILED, STATUS_DELETED) (default: STATUS_UNSPECIFIED, example: STATUS_UNSPECIFIED)
storage_regionstringRegion of the Spaces bucket where model files are stored (example: example string)
tagsobjectUser-defined tags for organizing models
total_size_bytesstring (uint64)Total size of model files in bytes (example: 12345)
updated_atstring (date-time)Timestamp when the model was last updated (example: 2023-01-01T00:00:00Z)
uuidstringUnique identifier for the custom model (example: 123e4567-e89b-12d3-a456-426614174000)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
genai_get_custom_modelselectuuidTo retrieve details of a custom model, send a GET request to /v2/gen-ai/custom_models/{uuid}.
genai_list_custom_modelsselectpage, per_page, statusTo list custom models, send a GET request to /v2/gen-ai/custom_models.
genai_import_custom_modelinsertTo import a custom model, send a POST request to /v2/gen-ai/custom_models/import.
genai_update_custom_model_metadataupdateuuidTo update custom model metadata, send a PATCH request to /v2/gen-ai/custom_models/{uuid}/metadata.
genai_delete_custom_modeldeleteuuidTo delete a custom model, send a DELETE request to /v2/genai/custom_models/{uuid}.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
uuidstringUUID of the custom model to delete (example: "123e4567-e89b-12d3-a456-426614174000")
pageintegerPage number for pagination. (example: 1)
per_pageintegerNumber of items per page. (example: 1)
statusstringFilter by model status. (example: STATUS_UNSPECIFIED)

SELECT examples

To retrieve details of a custom model, send a GET request to /v2/gen-ai/custom_models/{uuid}.

SELECT
name,
team_id,
active_deployments,
architecture,
config_json,
context_length,
cost_estimate_per_month,
created_at,
description,
error_message,
file_count,
input_modalities,
license,
output_modalities,
parameters,
source_ref,
source_type,
status,
storage_region,
tags,
total_size_bytes,
updated_at,
uuid
FROM digitalocean.genai.custom_models
WHERE uuid = '{{ uuid }}' -- required
;

INSERT examples

To import a custom model, send a POST request to /v2/gen-ai/custom_models/import.

INSERT INTO digitalocean.genai.custom_models (
accept_hf_token_storage,
accept_terms_and_conditions,
description,
name,
preferred_gpu_region,
source_ref,
source_type,
tags
)
SELECT
{{ accept_hf_token_storage }},
{{ accept_terms_and_conditions }},
'{{ description }}',
'{{ name }}',
'{{ preferred_gpu_region }}',
'{{ source_ref }}',
'{{ source_type }}',
'{{ tags }}'
RETURNING
error,
import_job,
model,
validation_steps
;

UPDATE examples

To update custom model metadata, send a PATCH request to /v2/gen-ai/custom_models/{uuid}/metadata.

UPDATE digitalocean.genai.custom_models
SET
description = '{{ description }}',
input_modalities = '{{ input_modalities }}',
license = '{{ license }}',
name = '{{ name }}',
output_modalities = '{{ output_modalities }}',
parameters = '{{ parameters }}',
tags = '{{ tags }}',
uuid = '{{ uuid }}'
WHERE
uuid = '{{ uuid }}' --required
RETURNING
model;

DELETE examples

To delete a custom model, send a DELETE request to /v2/genai/custom_models/{uuid}.

DELETE FROM digitalocean.genai.custom_models
WHERE uuid = '{{ uuid }}' --required
;