Class: Exa::Resources::Answer
- Inherits:
-
Struct
- Object
- Struct
- Exa::Resources::Answer
- Defined in:
- lib/exa/resources/answer.rb
Overview
Represents an answer response from the Exa API
This class wraps the JSON response from the /answer endpoint and provides a Ruby-friendly interface for accessing the generated answer and citations.
Instance Attribute Summary collapse
-
#answer ⇒ Object
Returns the value of attribute answer.
-
#citations ⇒ Object
Returns the value of attribute citations.
-
#cost_dollars ⇒ Object
Returns the value of attribute cost_dollars.
Instance Method Summary collapse
-
#initialize(answer:, citations: [], cost_dollars: nil) ⇒ Answer
constructor
A new instance of Answer.
- #to_h ⇒ Object
Constructor Details
#initialize(answer:, citations: [], cost_dollars: nil) ⇒ Answer
Returns a new instance of Answer.
10 11 12 13 |
# File 'lib/exa/resources/answer.rb', line 10 def initialize(answer:, citations: [], cost_dollars: nil) super freeze end |
Instance Attribute Details
#answer ⇒ Object
Returns the value of attribute answer
9 10 11 |
# File 'lib/exa/resources/answer.rb', line 9 def answer @answer end |
#citations ⇒ Object
Returns the value of attribute citations
9 10 11 |
# File 'lib/exa/resources/answer.rb', line 9 def citations @citations end |
#cost_dollars ⇒ Object
Returns the value of attribute cost_dollars
9 10 11 |
# File 'lib/exa/resources/answer.rb', line 9 def cost_dollars @cost_dollars end |
Instance Method Details
#to_h ⇒ Object
15 16 17 |
# File 'lib/exa/resources/answer.rb', line 15 def to_h { answer: answer, citations: citations, cost_dollars: cost_dollars } end |