Module: OllamaAgent::ModelEnv

Defined in:
lib/ollama_agent/model_env.rb

Overview

Resolves the default chat model from the environment (after global dotenv reconciliation, these values come from ~/.config/ollama_agent/.env or the shell, not the project tree).

Class Method Summary collapse

Class Method Details

.default_chat_modelString

Returns model id from ENV or ollama-client default (Ollama::Config.new.model).

Returns:

  • (String)

    model id from ENV or ollama-client default (Ollama::Config.new.model).



22
23
24
# File 'lib/ollama_agent/model_env.rb', line 22

def default_chat_model
  resolved_model_from_env || Ollama::Config.new.model
end

.resolved_model_from_envString?

Returns model id from ENV when set (used to sync Ollama::Config for Ollama Cloud).

Returns:

  • (String, nil)

    model id from ENV when set (used to sync Ollama::Config for Ollama Cloud).



12
13
14
15
16
17
18
19
# File 'lib/ollama_agent/model_env.rb', line 12

def resolved_model_from_env
  %w[OLLAMA_AGENT_MODEL OLLAMA_MODEL].each do |name|
    value = ENV[name].to_s.strip
    return value unless value.empty?
  end

  nil
end