14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/ruby_llm/providers/gemini/models.rb', line 14
def parse_list_models_response(response, slug, capabilities)
Array(response.body['models']).map do |model_data|
model_id = model_data['name'].gsub('models/', '')
Model::Info.new(
id: model_id,
name: model_data['displayName'],
provider: slug,
family: capabilities.model_family(model_id),
created_at: nil,
context_window: model_data['inputTokenLimit'] || capabilities.context_window_for(model_id),
max_output_tokens: model_data['outputTokenLimit'] || 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: {
version: model_data['version'],
description: model_data['description'],
supported_generation_methods: model_data['supportedGenerationMethods']
}
)
end
end
|