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



45
46
47
48
49
50
51
52
53
# File 'lib/exa/responses/search_response.rb', line 45

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: sym[:costDollars]&.to_f
  )
end