Module: Phronomy::Agent::Concerns::BeforeCompletion::ClassMethods
- Defined in:
- lib/phronomy/agent/concerns/before_completion.rb
Overview
Class-level DSL methods mixed into the including agent class.
Instance Method Summary collapse
- #_before_completion ⇒ #call?
-
#before_completion(callable = nil) ⇒ #call?
Sets or reads the class-level before_completion hook.
Instance Method Details
#_before_completion ⇒ #call?
38 39 40 |
# File 'lib/phronomy/agent/concerns/before_completion.rb', line 38 def _before_completion @before_completion end |
#before_completion(callable = nil) ⇒ #call?
Sets or reads the class-level before_completion hook. The hook is called before every LLM request for instances of this class. Receives a BeforeCompletionContext; must return a Hash of params to merge into the LLM call, or nil to pass through unchanged.
29 30 31 32 33 34 35 |
# File 'lib/phronomy/agent/concerns/before_completion.rb', line 29 def before_completion(callable = nil) if callable.nil? && !block_given? @before_completion else @before_completion = callable end end |