Class: OpenAICompatibleErrors::RetryContext
- Inherits:
-
Object
- Object
- OpenAICompatibleErrors::RetryContext
- Defined in:
- lib/openai_compatible_errors/retry.rb
Instance Attribute Summary collapse
-
#attempt ⇒ Object
readonly
Returns the value of attribute attempt.
-
#elapsed_ms ⇒ Object
readonly
Returns the value of attribute elapsed_ms.
-
#has_stream_output ⇒ Object
readonly
Returns the value of attribute has_stream_output.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#phase ⇒ Object
readonly
Returns the value of attribute phase.
-
#replay_safety ⇒ Object
readonly
Returns the value of attribute replay_safety.
Instance Method Summary collapse
-
#initialize(method:, phase:, replay_safety:, attempt:, elapsed_ms:, has_stream_output: false) ⇒ RetryContext
constructor
A new instance of RetryContext.
Constructor Details
#initialize(method:, phase:, replay_safety:, attempt:, elapsed_ms:, has_stream_output: false) ⇒ RetryContext
Returns a new instance of RetryContext.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/openai_compatible_errors/retry.rb', line 32 def initialize(method:, phase:, replay_safety:, attempt:, elapsed_ms:, has_stream_output: false) @method = method.is_a?(String) ? method.strip.upcase : "" @phase = coerce(phase, REQUEST_PHASES, :unknown) @replay_safety = coerce(replay_safety, REPLAY_SAFETY, :unknown) @attempt = attempt.is_a?(Integer) && attempt.positive? ? attempt : 0 @elapsed_ms = elapsed_ms.is_a?(Integer) && elapsed_ms >= 0 ? elapsed_ms : -1 @has_stream_output = (has_stream_output == true) freeze end |
Instance Attribute Details
#attempt ⇒ Object (readonly)
Returns the value of attribute attempt.
29 30 31 |
# File 'lib/openai_compatible_errors/retry.rb', line 29 def attempt @attempt end |
#elapsed_ms ⇒ Object (readonly)
Returns the value of attribute elapsed_ms.
29 30 31 |
# File 'lib/openai_compatible_errors/retry.rb', line 29 def elapsed_ms @elapsed_ms end |
#has_stream_output ⇒ Object (readonly)
Returns the value of attribute has_stream_output.
29 30 31 |
# File 'lib/openai_compatible_errors/retry.rb', line 29 def has_stream_output @has_stream_output end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
29 30 31 |
# File 'lib/openai_compatible_errors/retry.rb', line 29 def method @method end |
#phase ⇒ Object (readonly)
Returns the value of attribute phase.
29 30 31 |
# File 'lib/openai_compatible_errors/retry.rb', line 29 def phase @phase end |
#replay_safety ⇒ Object (readonly)
Returns the value of attribute replay_safety.
29 30 31 |
# File 'lib/openai_compatible_errors/retry.rb', line 29 def replay_safety @replay_safety end |