code.container/lib/config.rb

28 lines
669 B
Ruby

# lib/config.rb
require 'yaml'
require 'fileutils'
class AgentConfig
DEFAULT_PATH = 'config/agent.yml'
# Carrega o arquivo de configuração ou usa um fallback padrão se não existir
def self.load(path = DEFAULT_PATH)
if File.exist?(path)
YAML.load_file(path) rescue {}
else
{
'backends' => {
'text' => {
'default' => 'llama',
'providers' => {
'llama' => {
'endpoint' => ENV.fetch('LLAMA_CPP_ENDPOINT', 'http://127.0.0.1:8080/v1/chat/completions'),
'model' => 'local-model'
}
}
}
}
}
end
end
end