Module: OpenAI::ResponseCarrier

Defined in:
lib/openai/response_carrier.rb,
sig/openai/response_carrier.rbs

Overview

Shared response metadata interface for SDK values that are not model objects, such as binary StringIO responses.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#last_responseOpenAI::ResponseMetadata? (readonly)

Metadata from the HTTP response that produced this value.

Returns:



21
22
23
# File 'lib/openai/response_carrier.rb', line 21

def last_response
  @last_response
end

Instance Method Details

#_request_idString?

The ID of the API request, returned via the x-request-id response header. This is only populated on top-level response objects returned by the client.

Returns:

  • (String, nil)


14
# File 'lib/openai/response_carrier.rb', line 14

def _request_id = last_response&.request_id

#_set_last_response(response) ⇒ self

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Returns:

  • (self)


27
28
29
30
# File 'lib/openai/response_carrier.rb', line 27

def _set_last_response(response)
  @last_response = response
  self
end

#encode_with(_coder) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Keep transport metadata outside Psych's object serialization path.

Parameters:

  • _coder (Psych::Coder)
  • coder (top)


38
39
40
# File 'lib/openai/response_carrier.rb', line 38

def encode_with(_coder)
  nil
end