Class: LLM::Anthropic::Models
- Inherits:
-
Object
- Object
- LLM::Anthropic::Models
- Defined in:
- lib/llm/providers/anthropic/models.rb
Overview
The LLM::Anthropic::Models class provides a model object for interacting with Anthropic’s models API. The models API allows a client to query Anthropic for a list of models that are available for use with the Anthropic API.
Instance Method Summary collapse
-
#initialize(provider) ⇒ LLM::Anthropic::Files
constructor
Returns a new Models object.
-
#all(**params) ⇒ LLM::Response::FileList
List all models.
Constructor Details
#initialize(provider) ⇒ LLM::Anthropic::Files
Returns a new Models object
24 25 26 |
# File 'lib/llm/providers/anthropic/models.rb', line 24 def initialize(provider) @provider = provider end |
Instance Method Details
#all(**params) ⇒ LLM::Response::FileList
List all models
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/llm/providers/anthropic/models.rb', line 40 def all(**params) query = URI.encode_www_form(params) req = Net::HTTP::Get.new("/v1/models?#{query}", headers) res = request(http, req) LLM::Response::ModelList.new(res).tap { |modellist| models = modellist.body["data"].map do |model| LLM::Model.from_hash(model).tap { _1.provider = @provider } end modellist.models = models } end |