Class: OpenAI::RetryEvent
- Inherits:
-
Object
- Object
- OpenAI::RetryEvent
- Defined in:
- lib/openai/http_client.rb,
sig/openai/http_client.rbs
Overview
Details about an API request retry that is about to run.
Instance Attribute Summary collapse
-
#attempt ⇒ Integer
readonly
The one-based number of the attempt that will run after the delay.
-
#delay ⇒ Float
readonly
The number of seconds the SDK will wait before the next attempt.
-
#error ⇒ OpenAI::Errors::APIConnectionError?
readonly
The connection error that caused the retry, if the request failed before an HTTP response was received.
-
#max_attempts ⇒ Integer
readonly
The maximum number of attempts, including the initial request.
-
#response ⇒ OpenAI::ResponseMetadata?
readonly
Metadata from the retryable HTTP response, if one was received.
Instance Method Summary collapse
-
#initialize(attempt:, max_attempts:, delay:, response:, error:) ⇒ RetryEvent
constructor
private
A new instance of RetryEvent.
-
#request_id ⇒ String?
The request ID of the retryable response, if one was received.
-
#status ⇒ Integer?
The status of the retryable response, if one was received.
Constructor Details
#initialize(attempt:, max_attempts:, delay:, response:, error:) ⇒ RetryEvent
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.
Returns a new instance of RetryEvent.
73 74 75 76 77 78 79 80 |
# File 'lib/openai/http_client.rb', line 73 def initialize(attempt:, max_attempts:, delay:, response:, error:) @attempt = Integer(attempt) @max_attempts = Integer(max_attempts) @delay = Float(delay) @response = response @error = error freeze end |
Instance Attribute Details
#attempt ⇒ Integer (readonly)
The one-based number of the attempt that will run after the delay.
43 44 45 |
# File 'lib/openai/http_client.rb', line 43 def attempt @attempt end |
#delay ⇒ Float (readonly)
The number of seconds the SDK will wait before the next attempt.
53 54 55 |
# File 'lib/openai/http_client.rb', line 53 def delay @delay end |
#error ⇒ OpenAI::Errors::APIConnectionError? (readonly)
The connection error that caused the retry, if the request failed before an HTTP response was received.
64 65 66 |
# File 'lib/openai/http_client.rb', line 64 def error @error end |
#max_attempts ⇒ Integer (readonly)
The maximum number of attempts, including the initial request.
48 49 50 |
# File 'lib/openai/http_client.rb', line 48 def max_attempts @max_attempts end |
#response ⇒ OpenAI::ResponseMetadata? (readonly)
Metadata from the retryable HTTP response, if one was received.
58 59 60 |
# File 'lib/openai/http_client.rb', line 58 def response @response end |
Instance Method Details
#request_id ⇒ String?
The request ID of the retryable response, if one was received.
90 |
# File 'lib/openai/http_client.rb', line 90 def request_id = @response&.request_id |
#status ⇒ Integer?
The status of the retryable response, if one was received.
85 |
# File 'lib/openai/http_client.rb', line 85 def status = @response&.status |