Class: Phronomy::Agent::BeforeCompletionContext
- Inherits:
-
Object
- Object
- Phronomy::Agent::BeforeCompletionContext
- Defined in:
- lib/phronomy/agent/before_completion_context.rb
Overview
Passed to every before_completion hook callable. Provides read access to the agent, assembled messages, and invocation config. Hooks may inspect these and return a Hash of params to merge into the LLM request.
Instance Attribute Summary collapse
-
#agent ⇒ Phronomy::Agent::Base
readonly
The agent instance making the LLM call.
-
#config ⇒ Hash
readonly
Runtime config hash passed to invoke/stream (e.g. thread_id, memory).
-
#messages ⇒ Array
readonly
Messages currently assembled for this invocation (read-only snapshot).
-
#params ⇒ Hash
readonly
Current LLM params being built (model, temperature, etc.).
Instance Method Summary collapse
-
#initialize(agent:, messages:, config:, params: {}) ⇒ BeforeCompletionContext
constructor
A new instance of BeforeCompletionContext.
Constructor Details
#initialize(agent:, messages:, config:, params: {}) ⇒ BeforeCompletionContext
Returns a new instance of BeforeCompletionContext.
38 39 40 41 42 43 |
# File 'lib/phronomy/agent/before_completion_context.rb', line 38 def initialize(agent:, messages:, config:, params: {}) @agent = agent @messages = .dup.freeze @config = config @params = params.dup.freeze end |
Instance Attribute Details
#agent ⇒ Phronomy::Agent::Base (readonly)
The agent instance making the LLM call.
19 20 21 |
# File 'lib/phronomy/agent/before_completion_context.rb', line 19 def agent @agent end |
#config ⇒ Hash (readonly)
Runtime config hash passed to invoke/stream (e.g. thread_id, memory).
27 28 29 |
# File 'lib/phronomy/agent/before_completion_context.rb', line 27 def config @config end |
#messages ⇒ Array (readonly)
Messages currently assembled for this invocation (read-only snapshot).
23 24 25 |
# File 'lib/phronomy/agent/before_completion_context.rb', line 23 def @messages end |
#params ⇒ Hash (readonly)
Current LLM params being built (model, temperature, etc.). Read-only; return a Hash from the hook to merge overrides.
32 33 34 |
# File 'lib/phronomy/agent/before_completion_context.rb', line 32 def params @params end |