Class: Omen::Conversation
- Inherits:
-
Object
- Object
- Omen::Conversation
- Defined in:
- app/models/omen/conversation.rb
Overview
The one place Claude is spoken to, so everything above it is ours to read and to test.
Constant Summary collapse
- MAX_TOKENS =
How many tokens one reply may run to. Thinking is on by default and spends from the same budget, so this is sized well past the JSON it has to leave room for.
16_000- SENDABLE =
What each kind of block may carry back in, since a reply handed back whole is a 400.
{ 'text' => %w[ type text ], 'thinking' => %w[ type thinking signature ], 'redacted_thinking' => %w[ type data ], 'tool_use' => %w[ type id name input ], 'tool_result' => %w[ type tool_use_id content is_error ], }
Instance Method Summary collapse
-
#advance ⇒ Hash
No tools are sent, by design: a tool_result block would be rows travelling back to Claude.
-
#initialize(questions) ⇒ Conversation
constructor
A new instance of Conversation.
Constructor Details
#initialize(questions) ⇒ Conversation
Returns a new instance of Conversation.
18 19 20 |
# File 'app/models/omen/conversation.rb', line 18 def initialize(questions) @questions = questions end |
Instance Method Details
#advance ⇒ Hash
No tools are sent, by design: a tool_result block would be rows travelling back to Claude.
24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/omen/conversation.rb', line 24 def advance said = client..create model: Omen.config.claude_model, max_tokens: MAX_TOKENS, system_: Omen::Instructions.block, messages: , output_config: Omen::Instructions.output_config { content: said.content.map { |block| block.to_h.deep_stringify_keys }, stop_reason: said.stop_reason, input_usage: said.usage.input_tokens, output_usage: said.usage.output_tokens, } end |