Class: Prescient::Agent::Result
- Inherits:
-
Object
- Object
- Prescient::Agent::Result
- Defined in:
- lib/prescient/agent/result.rb
Overview
Immutable summary of one agent run.
Instance Attribute Summary collapse
-
#loops_run ⇒ Object
readonly
Returns the value of attribute loops_run.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response:, provider:, model:, loops_run:, success: true, metadata: {}) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
-
#to_h ⇒ Hash
Serialize the result into a safe structured response.
Constructor Details
#initialize(response:, provider:, model:, loops_run:, success: true, metadata: {}) ⇒ Result
Returns a new instance of Result.
9 10 11 12 13 14 15 16 |
# File 'lib/prescient/agent/result.rb', line 9 def initialize(response:, provider:, model:, loops_run:, success: true, metadata: {}) @response = response @provider = provider @model = model @loops_run = loops_run @success = success @metadata = end |
Instance Attribute Details
#loops_run ⇒ Object (readonly)
Returns the value of attribute loops_run.
7 8 9 |
# File 'lib/prescient/agent/result.rb', line 7 def loops_run @loops_run end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
7 8 9 |
# File 'lib/prescient/agent/result.rb', line 7 def @metadata end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
7 8 9 |
# File 'lib/prescient/agent/result.rb', line 7 def model @model end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
7 8 9 |
# File 'lib/prescient/agent/result.rb', line 7 def provider @provider end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/prescient/agent/result.rb', line 7 def response @response end |
Instance Method Details
#success? ⇒ Boolean
18 19 20 |
# File 'lib/prescient/agent/result.rb', line 18 def success? @success end |
#to_h ⇒ Hash
Serialize the result into a safe structured response.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/prescient/agent/result.rb', line 24 def to_h { response: @response, provider: @provider, model: @model, loops_run: @loops_run, success: success?, metadata: @metadata } end |