Module: Legion::Extensions::Llm::AzureFoundry::Provider::Capabilities
- Defined in:
- lib/legion/extensions/llm/azure_foundry/provider.rb
Overview
Capability predicates inferred from deployment metadata and model naming.
Class Method Summary collapse
- .chat?(model) ⇒ Boolean
- .critical_capabilities_for(model) ⇒ Object
- .embeddings?(model) ⇒ Boolean
- .functions?(model) ⇒ Boolean
- .hash_model_id(model) ⇒ Object
- .model_id(model) ⇒ Object
- .streaming?(model) ⇒ Boolean
- .usage_type(model) ⇒ Object
- .vision?(model) ⇒ Boolean
Class Method Details
.chat?(model) ⇒ Boolean
87 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 87 def chat?(model) = !(model) |
.critical_capabilities_for(model) ⇒ Object
93 94 95 96 97 98 99 100 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 93 def critical_capabilities_for(model) [ ('streaming' if streaming?(model)), ('function_calling' if functions?(model)), ('vision' if vision?(model)), ('embeddings' if (model)) ].compact end |
.embeddings?(model) ⇒ Boolean
91 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 91 def (model) = usage_type(model) == :embedding || model_id(model).match?(/embed/i) |
.functions?(model) ⇒ Boolean
89 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 89 def functions?(model) = chat?(model) |
.hash_model_id(model) ⇒ Object
108 109 110 111 112 113 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 108 def hash_model_id(model) %i[canonical_model_alias model deployment].each do |key| value = model[key] || model[key.to_s] return value.to_s if value end end |
.model_id(model) ⇒ Object
102 103 104 105 106 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 102 def model_id(model) return hash_model_id(model) if model.is_a?(Hash) model.respond_to?(:id) ? model.id.to_s : model.to_s end |
.streaming?(model) ⇒ Boolean
88 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 88 def streaming?(model) = chat?(model) |
.usage_type(model) ⇒ Object
115 116 117 118 119 120 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 115 def usage_type(model) return nil unless model.is_a?(Hash) value = model[:usage_type] || model['usage_type'] || model[:type] || model['type'] value&.to_sym end |
.vision?(model) ⇒ Boolean
90 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 90 def vision?(model) = chat?(model) && model_id(model).match?(/(gpt-4|gpt-5|llava|vision|phi-3.5)/i) |