Class: Anthropic::Resources::Skills

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/skills.rb,
lib/anthropic/resources/skills/versions.rb,
sig/anthropic/resources/skills.rbs,
sig/anthropic/resources/skills/versions.rbs

Defined Under Namespace

Classes: Versions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Skills

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Skills.

Parameters:



117
118
119
120
# File 'lib/anthropic/resources/skills.rb', line 117

def initialize(client:)
  @client = client
  @versions = Anthropic::Resources::Skills::Versions.new(client: client)
end

Instance Attribute Details

#versionsAnthropic::Resources::Skills::Versions (readonly)



7
8
9
# File 'lib/anthropic/resources/skills.rb', line 7

def versions
  @versions
end

Instance Method Details

#create(files:, display_name: nil, request_options: {}) ⇒ Anthropic::Models::Skill

Create Skill

Some parameter documentations has been truncated, see Models::SkillCreateParams for more details.

Parameters:

  • files (Array<Pathname, StringIO, IO, String, Anthropic::FilePart>)

    Files to upload for the skill.

  • display_name (String, nil)

    Human-readable, single-line label for the Skill. Maximum 255 characters.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/anthropic/resources/skills.rb', line 25

def create(params)
  parsed, options = Anthropic::SkillCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/skills",
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: Anthropic::Skill,
    options: options
  )
end

#delete(skill_id, request_options: {}) ⇒ Anthropic::Models::DeletedSkill

Delete Skill

Some parameter documentations has been truncated, see Models::SkillDeleteParams for more details.

Parameters:

  • skill_id (String)

    Unique identifier for the skill.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



105
106
107
108
109
110
111
112
# File 'lib/anthropic/resources/skills.rb', line 105

def delete(skill_id, params = {})
  @client.request(
    method: :delete,
    path: ["v1/skills/%1$s", skill_id],
    model: Anthropic::DeletedSkill,
    options: params[:request_options]
  )
end

#list(limit: nil, page: nil, source: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Skill>

List Skills

Some parameter documentations has been truncated, see Models::SkillListParams for more details.

Parameters:

  • limit (Integer)

    Number of results to return per page.

  • page (String, nil)

    Pagination token for fetching a specific page of results.

  • source (String, nil)

    Filter skills by source.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/anthropic/resources/skills.rb', line 78

def list(params = {})
  parsed, options = Anthropic::SkillListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v1/skills",
    query: query,
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Skill,
    options: options
  )
end

#retrieve(skill_id, request_options: {}) ⇒ Anthropic::Models::Skill

Get Skill

Some parameter documentations has been truncated, see Models::SkillRetrieveParams for more details.

Parameters:

  • skill_id (String)

    Unique identifier for the skill.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



51
52
53
54
55
56
57
58
# File 'lib/anthropic/resources/skills.rb', line 51

def retrieve(skill_id, params = {})
  @client.request(
    method: :get,
    path: ["v1/skills/%1$s", skill_id],
    model: Anthropic::Skill,
    options: params[:request_options]
  )
end