Class: Anthropic::Resources::Beta::Models
- Inherits:
-
Object
- Object
- Anthropic::Resources::Beta::Models
- Defined in:
- lib/anthropic/resources/beta/models.rb,
sig/anthropic/resources/beta/models.rbs
Instance Method Summary collapse
-
#initialize(client:) ⇒ Models
constructor
private
A new instance of Models.
-
#list(after_id: nil, before_id: nil, lifecycle: nil, limit: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Internal::Page<Anthropic::Models::Beta::BetaModelInfo>
List available models.
-
#retrieve(model_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaModelInfo
Get a specific model.
Constructor Details
#initialize(client:) ⇒ Models
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 Models.
101 102 103 |
# File 'lib/anthropic/resources/beta/models.rb', line 101 def initialize(client:) @client = client end |
Instance Method Details
#list(after_id: nil, before_id: nil, lifecycle: nil, limit: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Internal::Page<Anthropic::Models::Beta::BetaModelInfo>
List available models.
The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first.
Some parameter documentations has been truncated, see Models::Beta::ModelListParams for more details.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/anthropic/resources/beta/models.rb', line 76 def list(params = {}) query_params = [:after_id, :before_id, :lifecycle, :limit] parsed, = Anthropic::Beta::ModelListParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( qualifiers: {beta: "true"}, span_name: Anthropic::Internal::Tracing::SpanName::MODELS_LIST, span_route: "/v1/models", span_query: %w[after_id before_id lifecycle limit], method: :get, path: "v1/models", query: query, headers: parsed.except(*query_params).transform_keys( betas: "anthropic-beta", workspace_id: "anthropic-workspace-id" ), page: Anthropic::Internal::Page, model: Anthropic::Beta::BetaModelInfo, options: ) end |
#retrieve(model_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaModelInfo
Get a specific model.
The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID.
Some parameter documentations has been truncated, see Models::Beta::ModelRetrieveParams for more details.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/anthropic/resources/beta/models.rb', line 31 def retrieve(model_id, params = {}) parsed, = Anthropic::Beta::ModelRetrieveParams.dump_request(params) @client.request( qualifiers: {beta: "true"}, span_name: Anthropic::Internal::Tracing::SpanName::MODELS_RETRIEVE, span_attributes: {"anthropic.model.id" => model_id}, span_route: "/v1/models/{model_id}", method: :get, path: ["v1/models/%1$s", model_id], headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"), model: Anthropic::Beta::BetaModelInfo, options: ) end |