Module: CodeToQuery::BackCompat
- Defined in:
- lib/code_to_query.rb
Overview
Backward compatibility for new configuration accessors in older environments/tests
Class Method Summary collapse
Class Method Details
.ensure_extended_config!(config) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/code_to_query.rb', line 39 def ensure_extended_config!(config) # Logger unless config.respond_to?(:logger) class << config attr_accessor :logger end config.logger = if defined?(Rails) && Rails.respond_to?(:logger) Rails.logger else Logger.new($stdout) end end # LLM knobs and prompt template return if config.respond_to?(:system_prompt_template) class << config attr_accessor :system_prompt_template, :llm_api_base, :llm_timeout, :llm_temperature, :provider_options end config.system_prompt_template = nil config.llm_api_base = ENV['CODE_TO_QUERY_LLM_API_BASE'] || 'https://api.openai.com/v1' config.llm_timeout = Integer(ENV['CODE_TO_QUERY_LLM_TIMEOUT'] || 30) config.llm_temperature = Float(ENV['CODE_TO_QUERY_LLM_TEMPERATURE'] || 0.1) config. = {} end |