Module: RubyLLM::Providers::GPUStack::Models

Included in:
RubyLLM::Providers::GPUStack
Defined in:
lib/ruby_llm/providers/gpustack/models.rb

Overview

Models methods of the GPUStack API integration

Class Method Summary collapse

Class Method Details

.models_urlObject



10
11
12
# File 'lib/ruby_llm/providers/gpustack/models.rb', line 10

def models_url
  'models'
end

.parse_list_models_response(response, slug, _capabilities) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ruby_llm/providers/gpustack/models.rb', line 14

def parse_list_models_response(response, slug, _capabilities)
  items = response.body['items'] || []
  items.map do |model|
    Model::Info.new(
      id: model['name'],
      name: model['name'],
      created_at: model['created_at'] ? Time.parse(model['created_at']) : nil,
      provider: slug,
      family: 'gpustack',
      metadata: {
        description: model['description'],
        source: model['source'],
        huggingface_repo_id: model['huggingface_repo_id'],
        ollama_library_model_name: model['ollama_library_model_name'],
        backend: model['backend'],
        meta: model['meta'],
        categories: model['categories']
      },
      context_window: model.dig('meta', 'n_ctx'),
      max_output_tokens: model.dig('meta', 'n_ctx'),
      capabilities: build_capabilities(model),
      modalities: build_modalities(model),
      pricing: {}
    )
  end
end