Module: RubyLLM::Providers::Ollama::Models

Included in:
RubyLLM::Providers::Ollama
Defined in:
lib/ruby_llm/providers/ollama/models.rb

Overview

Models methods for the Ollama API integration

Instance Method Summary collapse

Instance Method Details

#models_urlObject



8
9
10
# File 'lib/ruby_llm/providers/ollama/models.rb', line 8

def models_url
  'models'
end

#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
# File 'lib/ruby_llm/providers/ollama/models.rb', line 12

def parse_list_models_response(response, slug, _capabilities)
  data = response.body['data'] || []
  data.map do |model|
    Model::Info.new(
      id: model['id'],
      name: model['id'],
      provider: slug,
      family: 'ollama',
      created_at: model['created'] ? Time.at(model['created']) : nil,
      modalities: {
        input: %w[text image],
        output: %w[text]
      },
      capabilities: %w[streaming function_calling structured_output vision],
      pricing: {},
      metadata: {
        owned_by: model['owned_by']
      }
    )
  end
end