Skip to content

Latest commit

 

History

History
170 lines (107 loc) · 7.53 KB

README.md

File metadata and controls

170 lines (107 loc) · 7.53 KB

Models

(models)

Overview

Available Operations

create_model

This endpoint will train a new custom model

Example Usage

from leonardo_ai_sdk import LeonardoAiSDK

with LeonardoAiSDK(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as leonardo_ai_sdk:

    res = leonardo_ai_sdk.models.create_model(request={
        "dataset_id": "<value>",
        "instance_prompt": "<value>",
        "name": "<value>",
    })

    assert res.object is not None

    # Handle response
    print(res.object)

Parameters

Parameter Type Required Description
request operations.CreateModelRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

operations.CreateModelResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

delete_model_by_id

This endpoint will delete a specific custom model

Example Usage

from leonardo_ai_sdk import LeonardoAiSDK

with LeonardoAiSDK(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as leonardo_ai_sdk:

    res = leonardo_ai_sdk.models.delete_model_by_id(id="<id>")

    assert res.object is not None

    # Handle response
    print(res.object)

Parameters

Parameter Type Required Description
id str ✔️ The ID of the model to delete.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

operations.DeleteModelByIDResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

get_model_by_id

This endpoint gets the specific custom model

Example Usage

from leonardo_ai_sdk import LeonardoAiSDK

with LeonardoAiSDK(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as leonardo_ai_sdk:

    res = leonardo_ai_sdk.models.get_model_by_id(id="<id>")

    assert res.object is not None

    # Handle response
    print(res.object)

Parameters

Parameter Type Required Description
id str ✔️ The ID of the custom model to return.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

operations.GetModelByIDResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

list_platform_models

Get a list of public Platform Models available for use with generations.

Example Usage

from leonardo_ai_sdk import LeonardoAiSDK

with LeonardoAiSDK(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as leonardo_ai_sdk:

    res = leonardo_ai_sdk.models.list_platform_models()

    assert res.object is not None

    # Handle response
    print(res.object)

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

operations.ListPlatformModelsResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*