Class: Exa::Resources::ContextResult
- Inherits:
-
Struct
- Object
- Struct
- Exa::Resources::ContextResult
- Defined in:
- lib/exa/resources/context_result.rb
Overview
Represents a Context API response from the Exa API
This class wraps the JSON response from the /context endpoint and provides a Ruby-friendly interface for accessing code snippets and metadata.
Instance Attribute Summary collapse
-
#cost_dollars ⇒ Object
Returns the value of attribute cost_dollars.
-
#output_tokens ⇒ Object
Returns the value of attribute output_tokens.
-
#query ⇒ Object
Returns the value of attribute query.
-
#request_id ⇒ Object
Returns the value of attribute request_id.
-
#response ⇒ Object
Returns the value of attribute response.
-
#results_count ⇒ Object
Returns the value of attribute results_count.
-
#search_time ⇒ Object
Returns the value of attribute search_time.
Instance Method Summary collapse
-
#initialize ⇒ ContextResult
constructor
A new instance of ContextResult.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ ContextResult
Returns a new instance of ContextResult.
19 20 21 22 |
# File 'lib/exa/resources/context_result.rb', line 19 def initialize(**) super freeze end |
Instance Attribute Details
#cost_dollars ⇒ Object
Returns the value of attribute cost_dollars
9 10 11 |
# File 'lib/exa/resources/context_result.rb', line 9 def cost_dollars @cost_dollars end |
#output_tokens ⇒ Object
Returns the value of attribute output_tokens
9 10 11 |
# File 'lib/exa/resources/context_result.rb', line 9 def output_tokens @output_tokens end |
#query ⇒ Object
Returns the value of attribute query
9 10 11 |
# File 'lib/exa/resources/context_result.rb', line 9 def query @query end |
#request_id ⇒ Object
Returns the value of attribute request_id
9 10 11 |
# File 'lib/exa/resources/context_result.rb', line 9 def request_id @request_id end |
#response ⇒ Object
Returns the value of attribute response
9 10 11 |
# File 'lib/exa/resources/context_result.rb', line 9 def response @response end |
#results_count ⇒ Object
Returns the value of attribute results_count
9 10 11 |
# File 'lib/exa/resources/context_result.rb', line 9 def results_count @results_count end |
#search_time ⇒ Object
Returns the value of attribute search_time
9 10 11 |
# File 'lib/exa/resources/context_result.rb', line 9 def search_time @search_time end |
Instance Method Details
#to_h ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/exa/resources/context_result.rb', line 24 def to_h { request_id: request_id, query: query, response: response, results_count: results_count, cost_dollars: cost_dollars, search_time: search_time, output_tokens: output_tokens } end |