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
89 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 89 def chat?(model) = !(model) |
.critical_capabilities_for(model) ⇒ Object
95 96 97 98 99 100 101 102 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 95 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
93 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 93 def (model) = usage_type(model) == :embedding || model_id(model).match?(/embed/i) |
.functions?(model) ⇒ Boolean
91 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 91 def functions?(model) = chat?(model) |
.hash_model_id(model) ⇒ Object
110 111 112 113 114 115 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 110 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
104 105 106 107 108 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 104 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
90 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 90 def streaming?(model) = chat?(model) |
.usage_type(model) ⇒ Object
117 118 119 120 121 122 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 117 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
92 |
# File 'lib/legion/extensions/llm/azure_foundry/provider.rb', line 92 def vision?(model) = chat?(model) && model_id(model).match?(/(gpt-4|gpt-5|llava|vision|phi-3.5)/i) |