HTTP client behaviour for LLM API calls.
The default implementation is LLM.HTTPClient.Req, which wraps the
Req library. You can swap it out for testing
or to add custom behavior (retries, logging, etc.).
Custom implementation
defmodule MyApp.HTTPClient do
@behaviour LLM.HTTPClient
@impl true
def request(req) do
Req.request(req)
end
endConfiguration
# config/config.exs
config :llm, :http_client, MyApp.HTTPClientTesting with Mox
Mox.defmock(LLM.HTTPClient.Mock, for: LLM.HTTPClient)
# config/test.exs
config :llm, :http_client, LLM.HTTPClient.Mock
Summary
Functions
Make an HTTP request using the configured adapter.
Callbacks
@callback request(Req.Request.t()) :: {:ok, Req.Response.t()} | {:error, term()}
Functions
Make an HTTP request using the configured adapter.
Defaults to LLM.HTTPClient.Req. Override by setting :http_client in
the :llm application config.