Class: Anthropic::Resources::Beta::Skills

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/skills.rb,
lib/anthropic/resources/beta/skills/versions.rb,
sig/anthropic/resources/beta/skills.rbs,
sig/anthropic/resources/beta/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:



149
150
151
152
# File 'lib/anthropic/resources/beta/skills.rb', line 149

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

Instance Attribute Details

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



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

def versions
  @versions
end

Instance Method Details

#create(files:, display_name: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaSkill

Create Skill

Some parameter documentations has been truncated, see Models::Beta::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

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • 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:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/anthropic/resources/beta/skills.rb', line 30

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

#delete(skill_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDeletedSkill

Delete Skill

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

Parameters:

  • skill_id (String)

    Unique identifier for the skill.

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Optional header to specify the beta version(s) you want to use.

  • 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:



135
136
137
138
139
140
141
142
143
144
# File 'lib/anthropic/resources/beta/skills.rb', line 135

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

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

List Skills

Some parameter documentations has been truncated, see Models::Beta::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.

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • 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:



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/anthropic/resources/beta/skills.rb', line 99

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

#retrieve(skill_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaSkill

Get Skill

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

Parameters:

  • skill_id (String)

    Unique identifier for the skill.

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Optional header to specify the beta version(s) you want to use.

  • 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:



66
67
68
69
70
71
72
73
74
75
# File 'lib/anthropic/resources/beta/skills.rb', line 66

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