Skip to content

Skill operations

Defines the skill operations for the BaseLMInvoker class.

SkillOperations(invoker)

Handles skill operations for the BaseLMInvoker class.

Examples:

  1. Create a skill:
file = Attachment.from_path("path/to/file.zip")
skill = await lm_invoker.skill.create(file=file, name="My Skill")
  1. List skills:
skills = await lm_invoker.skill.list_skill()
  1. Retrieve a skill:
skill = await lm_invoker.skill.retrieve(skill_id)
  1. Delete a skill:
await lm_invoker.skill.delete(skill_id)
  1. Update a skill:
file = Attachment.from_path("path/to/file.zip")
skill = await lm_invoker.skill.update(skill_id, file=file)
  1. List skill versions:
versions = await lm_invoker.skill.list_versions(skill_id)

Initializes the skill operations.

Parameters:

Name Type Description Default
invoker BaseLMInvoker

The LM invoker to use for the skill operations.

required

__init_subclass__(**kwargs)

Wrap subclass operation methods to normalize errors.

This keeps base-class methods unchanged while ensuring provider-specific overrides raise SkillOperationError for unexpected failures.

Parameters:

Name Type Description Default
**kwargs Any

Additional keyword arguments to initialize the subclass.

{}

create(file, name=None, **kwargs) async

Creates a new skill.

The name must be unique; the provider rejects creation if a skill with the same name already exists.

Parameters:

Name Type Description Default
file Attachment

File attachment of the skill.

required
name str | None

Display name of the skill provided by the user. Defaults to None.

None
**kwargs Any

Additional keyword arguments to create a skill.

{}

Returns:

Name Type Description
Skill Skill

The created skill.

Raises:

Type Description
NotImplementedError

The skill operation is not supported.

delete(skill_id) async

Deletes a skill by ID.

Parameters:

Name Type Description Default
skill_id str

The ID of the skill to delete.

required

Raises:

Type Description
NotImplementedError

The skill operation is not supported.

list_skill() async

Lists the skills.

Returns:

Type Description
list[Skill]

list[Skill]: The list of skills.

Raises:

Type Description
NotImplementedError

The skill operation is not supported.

list_versions(skill_id) async

Lists all versions of a skill by ID.

Parameters:

Name Type Description Default
skill_id str

The ID of the skill.

required

Returns:

Type Description
list[Skill]

list[Skill]: The list of skill versions.

Raises:

Type Description
NotImplementedError

The skill operation is not supported.

retrieve(skill_id) async

Retrieves a skill by ID.

Parameters:

Name Type Description Default
skill_id str

The ID of the skill to retrieve.

required

Returns:

Name Type Description
Skill Skill

The retrieved skill.

Raises:

Type Description
NotImplementedError

The skill operation is not supported.

update(skill_id, file, **kwargs) async

Updates a skill by ID.

Parameters:

Name Type Description Default
skill_id str

The ID of the skill to update.

required
file Attachment

File attachment of the skill (typically a ZIP archive).

required
**kwargs Any

Additional keyword arguments to update a skill.

{}

Returns:

Name Type Description
Skill Skill

The updated skill.

Raises:

Type Description
NotImplementedError

The skill operation is not supported.