Class: Agentic::ExpectedAnswerFormat
- Inherits:
-
Object
- Object
- Agentic::ExpectedAnswerFormat
- Defined in:
- lib/agentic/expected_answer_format.rb
Overview
Value object representing expected answer format
Instance Attribute Summary collapse
-
#format ⇒ String
readonly
The format of the expected answer.
-
#length ⇒ String
readonly
The expected length of the answer.
-
#sections ⇒ Array<String>
readonly
The sections expected in the answer.
Class Method Summary collapse
-
.from_hash(hash) ⇒ ExpectedAnswerFormat
Creates an ExpectedAnswerFormat from a hash.
Instance Method Summary collapse
-
#initialize(format:, sections:, length:) ⇒ ExpectedAnswerFormat
constructor
Initializes a new expected answer format.
-
#to_h ⇒ Hash
Returns a serializable representation of the expected answer format.
Constructor Details
#initialize(format:, sections:, length:) ⇒ ExpectedAnswerFormat
Initializes a new expected answer format
19 20 21 22 23 |
# File 'lib/agentic/expected_answer_format.rb', line 19 def initialize(format:, sections:, length:) @format = format @sections = sections @length = length end |
Instance Attribute Details
#format ⇒ String (readonly)
Returns The format of the expected answer.
7 8 9 |
# File 'lib/agentic/expected_answer_format.rb', line 7 def format @format end |
#length ⇒ String (readonly)
Returns The expected length of the answer.
13 14 15 |
# File 'lib/agentic/expected_answer_format.rb', line 13 def length @length end |
#sections ⇒ Array<String> (readonly)
Returns The sections expected in the answer.
10 11 12 |
# File 'lib/agentic/expected_answer_format.rb', line 10 def sections @sections end |
Class Method Details
.from_hash(hash) ⇒ ExpectedAnswerFormat
Creates an ExpectedAnswerFormat from a hash
38 39 40 41 42 43 44 |
# File 'lib/agentic/expected_answer_format.rb', line 38 def self.from_hash(hash) new( format: hash["format"], sections: hash["sections"], length: hash["length"] ) end |
Instance Method Details
#to_h ⇒ Hash
Returns a serializable representation of the expected answer format
27 28 29 30 31 32 33 |
# File 'lib/agentic/expected_answer_format.rb', line 27 def to_h { "format" => @format, "sections" => @sections, "length" => @length } end |