Skip to content

Latest commit

 

History

History
402 lines (263 loc) · 34.6 KB

README.md

File metadata and controls

402 lines (263 loc) · 34.6 KB

Beta.Skills

Overview

Available Operations

list

ListSkills

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.skills.list()

    while res is not None:
        # Handle items

        res = res.next()

Parameters

Parameter Type Required Description
page_size Optional[int] ➖ N/A
page_token Optional[str] ➖ N/A
alias Optional[str] ➖ N/A
fields List[str] ➖ Projection over each listed Skill. definition.description is the only definition path a list accepts; body and assets are read one skill at a time with GetSkill.
sort_field Optional[models.ListSortField] ➖ Defaults to created_at when omitted.
sort_direction_query_parameter Optional[models.ListSortDirection] ➖ Defaults to descending for timestamp fields and ascending for text fields.
sort_by Optional[str] ➖ REST-friendly alias for sort.field. Supported values: created_at, last_modified_at, name, title.
sort_direction_query_parameter1 Optional[str] ➖ REST-friendly alias for sort.direction. Supported values: asc, desc.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SkillsListResponse

Errors

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

create

CreateSkill

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.skills.create(name="<value>", definition={})

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
name str ✔️ Stable object name.
definition models.SkillDefinition ✔️ Versioned skill content.
notes OptionalNullable[str] ➖ Notes for this version.
sharing_scope Optional[models.RegistrySharingScope] ➖ N/A
aliases List[str] ➖ Aliases pointing to this version.
workspace_relation Optional[models.ShareRelation] ➖ Relation a subject holds on a shared registry object.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.Skill

Errors

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

get

GetSkill

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.skills.get(skill_id="<id>", version=1)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
skill_id str ✔️ N/A
version Optional[int] ➖ N/A 1
alias Optional[str] ➖ N/A
fields List[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.Skill

Errors

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

delete

DeleteSkill

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.skills.delete(skill_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
skill_id str ✔️ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.DeleteSkillResponse

Errors

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

update_metadata

UpdateSkill

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.skills.update_metadata(skill_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
skill_id str ✔️ N/A
sharing_scope Optional[models.RegistrySharingScope] ➖ N/A
workspace_relation Optional[models.ShareRelation] ➖ Relation a subject holds on a shared registry object.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.Skill

Errors

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

list_versions

ListSkillVersions

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.skills.list_versions(skill_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
skill_id str ✔️ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ListSkillVersionsResponse

Errors

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

create_version

CreateSkillVersion

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.skills.create_version(skill_id="<id>", definition={})

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
skill_id str ✔️ N/A
definition models.SkillDefinition ✔️ Versioned skill content.
notes OptionalNullable[str] ➖ Notes for this version.
aliases List[str] ➖ Aliases pointing to this version.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.CreateSkillVersionResponse

Errors

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

get_version

GetSkillVersion

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.skills.get_version(skill_id="<id>", version=1)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
skill_id str ✔️ N/A
version int ✔️ N/A 1
fields List[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.Skill

Errors

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

update_version_metadata

UpdateSkillVersionMetadata

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:

    res = mistral.beta.skills.update_version_metadata(skill_id="<id>", version=1)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
skill_id str ✔️ N/A
version int ✔️ N/A 1
notes OptionalNullable[str] ➖ Notes for this version.
aliases Optional[models.AliasList] ➖ Presence wrapper for a set of alias labels on update RPCs. As a message field it carries presence, so callers can distinguish "leave aliases unchanged" (field omitted) from "clear all aliases" (field set, empty values).
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.Skill

Errors

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