Module: LLM::HTTPClient

Included in:
Provider
Defined in:
lib/llm/http_client.rb

Instance Method Summary collapse

Instance Method Details

#request(http, req, &b) ⇒ Net::HTTPResponse

Initiates a HTTP request

Parameters:

  • http (Net::HTTP)

    The HTTP object to use for the request

  • req (Net::HTTPRequest)

    The request to send

  • b (Proc)

    A block to yield the response to (optional)

Returns:

  • (Net::HTTPResponse)

    The response from the server

Raises:



26
27
28
29
30
31
32
# File 'lib/llm/http_client.rb', line 26

def request(http, req, &b)
  res = http.request(req, &b)
  case res
  when Net::HTTPOK then res
  else error_handler.new(res).raise_error!
  end
end