Class: Exa::Responses::FindSimilarResponse

Inherits:
T::Struct
  • Object
show all
Defined in:
lib/exa/responses/search_response.rb

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/exa/responses/search_response.rb', line 32

def self.from_hash(hash)
  sym = Helpers.symbolize_keys(hash)
  new(
    request_id: sym[:requestId],
    results: Array(sym[:results]).map { ResultWithContent.from_hash(_1) },
    context: sym[:context],
    cost_dollars: CostDollars.from_hash(sym[:costDollars])
  )
end