Module: Aireview::ConfigLimits

Included in:
Config
Defined in:
lib/aireview/config_limits.rb

Overview

Context limits in characters: there is no exact local tokenizer for the providers, and the Ollama window is set on the server, invisible to the client. The defaults are generous; a specific model gets its own in .aireview.yml.

Constant Summary collapse

DEFAULT_MAX_PROMPT_CHARS =
400_000
CONTEXT_DEFAULTS =
{
  'max_diff_chars' => 120_000,
  'max_mr_description_chars' => 8_000,
  'max_jira_description_chars' => 8_000,
  'max_jira_comment_chars' => 2_000
}.freeze

Instance Method Summary collapse

Instance Method Details

#max_diff_chars ⇒ Object



30
31
32
# File 'lib/aireview/config_limits.rb', line 30

def max_diff_chars
  context_limit('max_diff_chars')
end

#max_jira_comment_chars ⇒ Object



42
43
44
# File 'lib/aireview/config_limits.rb', line 42

def max_jira_comment_chars
  context_limit('max_jira_comment_chars')
end

#max_jira_description_chars ⇒ Object



38
39
40
# File 'lib/aireview/config_limits.rb', line 38

def max_jira_description_chars
  context_limit('max_jira_description_chars')
end

#max_mr_description_chars ⇒ Object



34
35
36
# File 'lib/aireview/config_limits.rb', line 34

def max_mr_description_chars
  context_limit('max_mr_description_chars')
end

#max_prompt_chars(stage) ⇒ Object

The limit of the whole stage request in characters: the system prompt plus the context (plus the candidates for Critique). Inherited from llm like model/temperature.

Raises:

  • (ArgumentError)


20
21
22
23
24
25
26
27
28
# File 'lib/aireview/config_limits.rb', line 20

def max_prompt_chars(stage)
  stage = stage.to_s
  raise ArgumentError, "unknown LLM stage #{stage.inspect}" unless STAGES.include?(stage)

  positive_integer!(
    stage_setting(stage, 'max_prompt_chars') || DEFAULT_MAX_PROMPT_CHARS,
    "llm.#{stage}.max_prompt_chars"
  )
end