Exception: SavvyOpenrouter::StructuredOutputError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/savvy_openrouter/structured_output_error.rb

Overview

Raised when json_object/json_schema was requested but the successful response body does not contain usable JSON in assistant/output text. Optional require “savvy_openrouter/patterns”.

reason: :empty_content, :invalid_json, :no_choices

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, reason:, response_body: nil) ⇒ StructuredOutputError

Returns a new instance of StructuredOutputError.



11
12
13
14
15
# File 'lib/savvy_openrouter/structured_output_error.rb', line 11

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

Instance Attribute Details

#reasonObject (readonly)

Returns the value of attribute reason.



9
10
11
# File 'lib/savvy_openrouter/structured_output_error.rb', line 9

def reason
  @reason
end

#response_bodyObject (readonly)

Returns the value of attribute response_body.



9
10
11
# File 'lib/savvy_openrouter/structured_output_error.rb', line 9

def response_body
  @response_body
end