Class: OmniAI::Google::StreamError

Inherits:
Error
  • Object
show all
Defined in:
lib/omniai/google/stream_error.rb

Overview

Raised when a streamed generation does not complete.

Deliberately has no #response: the request returned 200 and the failure arrived inside the stream. Consumers branch on that to decide whether to retry.

Direct Known Subclasses

IncompleteStreamError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, provider_message: nil) ⇒ StreamError

Returns a new instance of StreamError.

Parameters:

  • message (String, nil) (defaults to: nil)
  • provider_message (String, nil) (defaults to: nil)


22
23
24
25
# File 'lib/omniai/google/stream_error.rb', line 22

def initialize(message = nil, provider_message: nil)
  @provider_message = provider_message
  super(message)
end

Instance Attribute Details

#provider_messageString? (readonly)

Google's own explanation of the failure, verbatim.

Named for what it holds rather than borrowing value from FinishReason, which is a provider enum rather than prose. Kept off #message because consumers log that and this text can echo request content -- a deliberate departure from HTTPError, which puts the whole response body into its message.

Returns:

  • (String, nil)


18
19
20
# File 'lib/omniai/google/stream_error.rb', line 18

def provider_message
  @provider_message
end