Module: Legion::LLM::Inventory
- Extended by:
- Legion::Logging::Helper
- Defined in:
- lib/legion/llm/inventory.rb
Constant Summary collapse
- DEFAULT_PROVIDER_TIERS =
{ ollama: :local, vllm: :fleet, mlx: :local, bedrock: :cloud, azure: :cloud, gemini: :cloud, anthropic: :frontier, openai: :frontier }.freeze
- DEFAULT_PROVIDER_TRANSPORTS =
{ ollama: :http, vllm: :http, mlx: :http, bedrock: :sdk, azure: :http, gemini: :http, anthropic: :http, openai: :http }.freeze
- DEFAULT_CAPABILITIES =
{ embed: %i[embed], inference: %i[chat completion tools json_schema], chat: %i[chat completion tools json_schema] }.freeze
Class Method Summary collapse
Class Method Details
.offerings(filters = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/legion/llm/inventory.rb', line 39 def offerings(filters = {}) normalized_filters = normalize_filter_hash(filters) list = [] providers_config.each do |provider_family, config| next unless enabled_config?(config) list.concat(provider_offerings(provider_family.to_sym, config)) end list.concat(discovery_offerings) list.concat(native_provider_offerings) list = dedupe_offerings(list) filter_offerings(list, normalized_filters) rescue NameError, ArgumentError, TypeError => e handle_exception(e, level: :error, handled: false, operation: 'llm.inventory.offerings') raise rescue StandardError => e handle_exception(e, level: :warn, handled: true, operation: 'llm.inventory.offerings') [] end |
.providers ⇒ Object
60 61 62 |
# File 'lib/legion/llm/inventory.rb', line 60 def providers offerings.group_by { |offering| offering[:provider_family] } end |