Class: Agent::SessionContext::Summarizers::Claude
- Inherits:
-
Object
- Object
- Agent::SessionContext::Summarizers::Claude
- Includes:
- CommandExecutionPolicy
- Defined in:
- lib/agent/session_context/summarizers/claude.rb
Constant Summary collapse
- MAX_OUTPUT_BYTES =
1_048_576
Instance Method Summary collapse
- #call(prompt:, schema:) ⇒ Object
-
#initialize(runner: nil, timeout_seconds: Config::DEFAULT_TIMEOUT_SECONDS) ⇒ Claude
constructor
A new instance of Claude.
- #name ⇒ Object
Constructor Details
#initialize(runner: nil, timeout_seconds: Config::DEFAULT_TIMEOUT_SECONDS) ⇒ Claude
Returns a new instance of Claude.
15 16 17 18 19 20 21 22 |
# File 'lib/agent/session_context/summarizers/claude.rb', line 15 def initialize(runner: nil, timeout_seconds: Config::DEFAULT_TIMEOUT_SECONDS) initialize_command_execution_policy( runner:, timeout_seconds:, max_output_bytes: MAX_OUTPUT_BYTES, provider_env_keys: PROVIDER_ENV_KEYS ) end |
Instance Method Details
#call(prompt:, schema:) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/agent/session_context/summarizers/claude.rb', line 28 def call(prompt:, schema:) stdout, stderr, status = run_command!(prompt:, argv: command_argv(schema)) fail_command!(stdout:, stderr:, status:) unless status.success? if stdout.strip.empty? raise SummarizerFailed, ( "#{name} summarizer produced empty stdout", stdout:, stderr: ) end envelope = parse_envelope!(stdout, stderr:) field_name, value = extract_structured_value!(envelope) normalize_value!(value, field_name:, stdout:, stderr:) end |
#name ⇒ Object
24 25 26 |
# File 'lib/agent/session_context/summarizers/claude.rb', line 24 def name :claude end |