Highlights
- Add
Exa::Internal::Transport::AsyncRequester for fiber-scheduler-friendly HTTP via async/async-http.
- Document optional async setup in the README and keep the synchronous defaults untouched.
- Cover the new transport with integration-style tests and wire optional development/test dependencies.
Async requester example
require "async"
require "exa/internal/transport/async_requester"
require "exa"
Async do
requester = Exa::Internal::Transport::AsyncRequester.new
client = Exa::Client.new(api_key: ENV.fetch("EXA_API_KEY"), requester: requester)
search_task = Async { client.search.search(query: "climate tech", num_results: 3) }
research_task = Async { client.research.create(instructions: "Map top autonomous robotics labs") }
puts "Top result: #{search_task.wait.results.first.title}"
puts "Research ID: #{research_task.wait.id}"
ensure
requester.close
end