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:



137
138
139
140
# File 'lib/anthropic/resources/skills.rb', line 137

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, workspace_id: 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>)

    Body param: Files to upload for the skill.

  • display_name (String, nil)

    Body param: Human-readable, single-line label for the Skill. Maximum 255 charact

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

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

Returns:

See Also:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/anthropic/resources/skills.rb', line 27

def create(params)
  parsed, options = Anthropic::SkillCreateParams.dump_request(params)
  header_params = {workspace_id: "anthropic-workspace-id"}
  @client.request(
    method: :post,
    path: "v1/skills",
    headers: {
      "content-type" => "multipart/form-data",
      **parsed.slice(*header_params.keys)
    }.transform_keys(
      header_params
    ),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Skill,
    options: options
  )
end

#delete(skill_id, workspace_id: nil, 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.

  • workspace_id (String)

    Optional header to select the Workspace for this request. The value is a Workspa

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

Returns:

See Also:



123
124
125
126
127
128
129
130
131
132
# File 'lib/anthropic/resources/skills.rb', line 123

def delete(skill_id, params = {})
  parsed, options = Anthropic::SkillDeleteParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["v1/skills/%1$s", skill_id],
    headers: parsed.transform_keys(workspace_id: "anthropic-workspace-id"),
    model: Anthropic::DeletedSkill,
    options: options
  )
end

#list(limit: nil, page: nil, source: nil, workspace_id: 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)

    Query param: Number of results to return per page.

  • page (String, nil)

    Query param: Pagination token for fetching a specific page of results.

  • source (String, nil)

    Query param: Filter skills by source.

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

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

Returns:

See Also:



92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/anthropic/resources/skills.rb', line 92

def list(params = {})
  query_params = [:limit, :page, :source]
  parsed, options = Anthropic::SkillListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "v1/skills",
    query: query,
    headers: parsed.except(*query_params).transform_keys(workspace_id: "anthropic-workspace-id"),
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Skill,
    options: options
  )
end

#retrieve(skill_id, workspace_id: nil, 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.

  • workspace_id (String)

    Optional header to select the Workspace for this request. The value is a Workspa

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

Returns:

See Also:



61
62
63
64
65
66
67
68
69
70
# File 'lib/anthropic/resources/skills.rb', line 61

def retrieve(skill_id, params = {})
  parsed, options = Anthropic::SkillRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/skills/%1$s", skill_id],
    headers: parsed.transform_keys(workspace_id: "anthropic-workspace-id"),
    model: Anthropic::Skill,
    options: options
  )
end