Class: Exa::Resources::FindSimilarResult
- Inherits:
-
Struct
- Object
- Struct
- Exa::Resources::FindSimilarResult
- Defined in:
- lib/exa/resources/find_similar_result.rb
Overview
Represents a find similar response from the Exa API
This class wraps the JSON response from the /findSimilar endpoint and provides a Ruby-friendly interface for accessing similar results and metadata.
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#cost_dollars ⇒ Object
Returns the value of attribute cost_dollars.
-
#request_id ⇒ Object
Returns the value of attribute request_id.
-
#results ⇒ Object
Returns the value of attribute results.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #first ⇒ Object
-
#initialize(results:, request_id: nil, context: nil, cost_dollars: nil) ⇒ FindSimilarResult
constructor
A new instance of FindSimilarResult.
Constructor Details
#initialize(results:, request_id: nil, context: nil, cost_dollars: nil) ⇒ FindSimilarResult
14 15 16 17 |
# File 'lib/exa/resources/find_similar_result.rb', line 14 def initialize(results:, request_id: nil, context: nil, cost_dollars: nil) super freeze end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context
7 8 9 |
# File 'lib/exa/resources/find_similar_result.rb', line 7 def context @context end |
#cost_dollars ⇒ Object
Returns the value of attribute cost_dollars
7 8 9 |
# File 'lib/exa/resources/find_similar_result.rb', line 7 def cost_dollars @cost_dollars end |
#request_id ⇒ Object
Returns the value of attribute request_id
7 8 9 |
# File 'lib/exa/resources/find_similar_result.rb', line 7 def request_id @request_id end |
#results ⇒ Object
Returns the value of attribute results
7 8 9 |
# File 'lib/exa/resources/find_similar_result.rb', line 7 def results @results end |
Instance Method Details
#empty? ⇒ Boolean
19 20 21 |
# File 'lib/exa/resources/find_similar_result.rb', line 19 def empty? results.empty? end |
#first ⇒ Object
23 24 25 |
# File 'lib/exa/resources/find_similar_result.rb', line 23 def first results.first end |