Class: RailVerdict::Intelligence::AIFailure
- Inherits:
-
Object
- Object
- RailVerdict::Intelligence::AIFailure
- Defined in:
- lib/rail_verdict/intelligence/ai_failure.rb
Constant Summary collapse
- CODES =
%w[ disabled provider_unavailable authentication_failed rate_limited timed_out budget_exhausted context_rejected secret_detected response_invalid schema_invalid context_too_large manifest_invalid ].freeze
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(code:, message:) ⇒ AIFailure
constructor
A new instance of AIFailure.
- #to_h ⇒ Object
Constructor Details
#initialize(code:, message:) ⇒ AIFailure
Returns a new instance of AIFailure.
23 24 25 26 27 28 29 |
# File 'lib/rail_verdict/intelligence/ai_failure.rb', line 23 def initialize(code:, message:) raise ArgumentError, "invalid code" unless CODES.include?(code.to_s) @code = code.to_s.freeze @message = sanitize(.to_s).freeze freeze end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
21 22 23 |
# File 'lib/rail_verdict/intelligence/ai_failure.rb', line 21 def code @code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
21 22 23 |
# File 'lib/rail_verdict/intelligence/ai_failure.rb', line 21 def @message end |
Instance Method Details
#to_h ⇒ Object
31 32 33 |
# File 'lib/rail_verdict/intelligence/ai_failure.rb', line 31 def to_h { "code" => code, "message" => } end |