Class: Exa::Services::Context
- Inherits:
-
Object
- Object
- Exa::Services::Context
- Defined in:
- lib/exa/services/context.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(connection, **params) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(connection, **params) ⇒ Context
Returns a new instance of Context.
6 7 8 9 |
# File 'lib/exa/services/context.rb', line 6 def initialize(connection, **params) @connection = connection @params = params end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/exa/services/context.rb', line 11 def call response = @connection.post("/context", @params) body = response.body Resources::ContextResult.new( request_id: body["requestId"], query: body["query"], response: body["response"], results_count: body["resultsCount"], cost_dollars: body["costDollars"], search_time: body["searchTime"], output_tokens: body["outputTokens"] ) end |