Class: OpenAI::HTTPClient

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/http_client.rb,
sig/openai/http_client.rbs

Overview

The transport boundary used by Client.

Implement #execute to replace the SDK's HTTP transport. Subclassing this class is optional; any object that implements the same method is accepted. Most applications should use NetHTTPClient.

Direct Known Subclasses

NetHTTPClient

Defined Under Namespace

Classes: Request, Response

Instance Method Summary collapse

Instance Method Details

#execute(request) ⇒ OpenAI::HTTPClient::Response

Executes one SDK-prepared HTTP request.

Implementations must return an Response. Connection pooling and transport-specific retries belong to the implementation; the SDK remains responsible for API-level retries and redirects. Transport failures should be raised as Errors::APIConnectionError or Errors::APITimeoutError so the SDK can apply its retry policy; other exceptions propagate without an SDK retry.

Parameters:

Returns:

Raises:

  • (NotImplementedError)


236
237
238
# File 'lib/openai/http_client.rb', line 236

def execute(request)
  raise NotImplementedError, "#{self.class} must implement #execute for #{request.class}"
end