Module: Legion::Extensions::Llm::Ollama
- Extended by:
- Core, AutoRegistration, Logging::Helper
- Defined in:
- lib/legion/extensions/llm/ollama.rb,
lib/legion/extensions/llm/ollama/version.rb,
lib/legion/extensions/llm/ollama/provider.rb
Overview
Ollama provider extension namespace.
Defined Under Namespace
Classes: Provider
Constant Summary collapse
- PROVIDER_FAMILY =
:ollama- VERSION =
'0.2.0'
Class Method Summary collapse
- .default_settings ⇒ Object
- .discover_instances ⇒ Object
- .provider_class ⇒ Object
- .registry_publisher ⇒ Object
Class Method Details
.default_settings ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/legion/extensions/llm/ollama.rb', line 18 def self.default_settings { enabled: false, base_url: '127.0.0.1:11434', default_model: 'qwen3.5:latest', model_whitelist: [], model_blacklist: [], model_cache_ttl: 60, tls: { enabled: false, verify: :peer }, instances: {} } end |
.discover_instances ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/legion/extensions/llm/ollama.rb', line 39 def self.discover_instances instances = {} if CredentialSources.socket_open?('127.0.0.1', 11_434, timeout: 0.1) instances[:local] = { base_url: 'http://127.0.0.1:11434', tier: :local, capabilities: %i[completion embedding vision] } end configured = CredentialSources.setting(:extensions, :llm, :ollama, :instances) if configured.is_a?(Hash) configured.each do |name, config| instances[name.to_sym] = config.merge( tier: :direct, capabilities: %i[completion embedding vision] ) end end instances end |
.provider_class ⇒ Object
31 32 33 |
# File 'lib/legion/extensions/llm/ollama.rb', line 31 def self.provider_class Provider end |
.registry_publisher ⇒ Object
35 36 37 |
# File 'lib/legion/extensions/llm/ollama.rb', line 35 def self.registry_publisher @registry_publisher ||= Legion::Extensions::Llm::RegistryPublisher.new(provider_family: PROVIDER_FAMILY) end |