Module: RubyLLM::Agents::Providers::Inception::Models

Included in:
RubyLLM::Agents::Providers::Inception
Defined in:
lib/ruby_llm/agents/providers/inception/models.rb

Overview

Parses model metadata from the Inception /models API endpoint. Response format is OpenAI-compatible.

Class Method Summary collapse

Class Method Details

.parse_list_models_response(response, slug, capabilities) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ruby_llm/agents/providers/inception/models.rb', line 12

def parse_list_models_response(response, slug, capabilities)
  Array(response.body["data"]).map do |model_data|
    model_id = model_data["id"]

    ::RubyLLM::Model::Info.new(
      id: model_id,
      name: capabilities.format_display_name(model_id),
      provider: slug,
      family: "mercury",
      created_at: model_data["created"] ? Time.at(model_data["created"]) : nil,
      context_window: capabilities.context_window_for(model_id),
      max_output_tokens: capabilities.max_tokens_for(model_id),
      modalities: capabilities.modalities_for(model_id),
      capabilities: capabilities.capabilities_for(model_id),
      pricing: capabilities.pricing_for(model_id),
      metadata: {
        object: model_data["object"],
        owned_by: model_data["owned_by"]
      }.compact
    )
  end
end