Class: DebugAgent::LLMConfig

Inherits:
Struct
  • Object
show all
Defined in:
lib/debug_agent/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key

Returns:

  • (Object)

    the current value of api_key



2
3
4
# File 'lib/debug_agent/config.rb', line 2

def api_key
  @api_key
end

#base_urlObject

Returns the value of attribute base_url

Returns:

  • (Object)

    the current value of base_url



2
3
4
# File 'lib/debug_agent/config.rb', line 2

def base_url
  @base_url
end

#context_window_tokensObject

Returns the value of attribute context_window_tokens

Returns:

  • (Object)

    the current value of context_window_tokens



2
3
4
# File 'lib/debug_agent/config.rb', line 2

def context_window_tokens
  @context_window_tokens
end

#max_retriesObject

Returns the value of attribute max_retries

Returns:

  • (Object)

    the current value of max_retries



2
3
4
# File 'lib/debug_agent/config.rb', line 2

def max_retries
  @max_retries
end

#max_tokensObject

Returns the value of attribute max_tokens

Returns:

  • (Object)

    the current value of max_tokens



2
3
4
# File 'lib/debug_agent/config.rb', line 2

def max_tokens
  @max_tokens
end

#max_tool_roundsObject

Returns the value of attribute max_tool_rounds

Returns:

  • (Object)

    the current value of max_tool_rounds



2
3
4
# File 'lib/debug_agent/config.rb', line 2

def max_tool_rounds
  @max_tool_rounds
end

#modelObject

Returns the value of attribute model

Returns:

  • (Object)

    the current value of model



2
3
4
# File 'lib/debug_agent/config.rb', line 2

def model
  @model
end

#retry_base_delay_msObject

Returns the value of attribute retry_base_delay_ms

Returns:

  • (Object)

    the current value of retry_base_delay_ms



2
3
4
# File 'lib/debug_agent/config.rb', line 2

def retry_base_delay_ms
  @retry_base_delay_ms
end

#retry_max_delay_msObject

Returns the value of attribute retry_max_delay_ms

Returns:

  • (Object)

    the current value of retry_max_delay_ms



2
3
4
# File 'lib/debug_agent/config.rb', line 2

def retry_max_delay_ms
  @retry_max_delay_ms
end

#temperatureObject

Returns the value of attribute temperature

Returns:

  • (Object)

    the current value of temperature



2
3
4
# File 'lib/debug_agent/config.rb', line 2

def temperature
  @temperature
end

#timeout_secondsObject

Returns the value of attribute timeout_seconds

Returns:

  • (Object)

    the current value of timeout_seconds



2
3
4
# File 'lib/debug_agent/config.rb', line 2

def timeout_seconds
  @timeout_seconds
end

Instance Method Details

#defaults!Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/debug_agent/config.rb', line 8

def defaults!
  self.base_url            ||= ENV.fetch('LLM_BASE_URL', 'https://open.bigmodel.cn/api/coding/paas/v4')
  self.api_key             ||= ENV.fetch('LLM_API_KEY', ENV.fetch('OPENAI_API_KEY', ''))
  self.model               ||= ENV.fetch('LLM_MODEL', 'glm-5.2')
  self.temperature         ||= 0.3
  self.max_tokens          ||= 4096
  self.max_tool_rounds     ||= 25
  self.timeout_seconds     ||= 120
  self.max_retries         ||= 3
  self.retry_base_delay_ms ||= 1000
  self.retry_max_delay_ms  ||= 30000
  self.context_window_tokens ||= 100_000
  self
end