Class: Exa::Resources::Search
- Inherits:
-
Base
- Object
- Base
- Exa::Resources::Search
show all
- Defined in:
- lib/exa/resources/search.rb
Instance Attribute Summary
Attributes inherited from Base
#client
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#answer(params) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/exa/resources/search.rb', line 23
def answer(params)
stream = stream_requested?(params)
normalized = normalize_nested_struct(params, :search_options, Exa::Types::AnswerSearchOptions)
payload = serialize(Exa::Types::AnswerRequest, normalized)
client.request(
method: :post,
path: "answer",
body: payload,
stream: stream,
response_model: stream ? nil : Exa::Responses::AnswerResponse
)
end
|
#contents(params) ⇒ Object
13
14
15
16
|
# File 'lib/exa/resources/search.rb', line 13
def contents(params)
payload = serialize(Exa::Types::ContentsRequest, params)
client.request(method: :post, path: "contents", body: payload, response_model: Exa::Responses::ContentsResponse)
end
|
#find_similar(params) ⇒ Object
18
19
20
21
|
# File 'lib/exa/resources/search.rb', line 18
def find_similar(params)
payload = serialize(Exa::Types::FindSimilarRequest, params)
client.request(method: :post, path: "findSimilar", body: payload, response_model: Exa::Responses::FindSimilarResponse)
end
|
#search(params) ⇒ Object
8
9
10
11
|
# File 'lib/exa/resources/search.rb', line 8
def search(params)
payload = serialize(Exa::Types::SearchRequest, params)
client.request(method: :post, path: "search", body: payload, response_model: Exa::Responses::SearchResponse)
end
|