Exception: Agentic::Errors::LlmRefusalError
- Defined in:
- lib/agentic/errors/llm_error.rb
Overview
Error raised when the LLM refuses to respond
Instance Attribute Summary collapse
-
#refusal_category ⇒ Symbol
readonly
The category of refusal.
-
#refusal_message ⇒ String
readonly
The refusal message from the LLM.
Attributes inherited from LlmError
Instance Method Summary collapse
-
#initialize(refusal_message, refusal_category: nil, response: nil, context: nil) ⇒ LlmRefusalError
constructor
A new instance of LlmRefusalError.
-
#retryable_with_modifications? ⇒ Boolean
Determines whether this refusal is retryable with modifications.
Constructor Details
#initialize(refusal_message, refusal_category: nil, response: nil, context: nil) ⇒ LlmRefusalError
35 36 37 38 39 |
# File 'lib/agentic/errors/llm_error.rb', line 35 def initialize(, refusal_category: nil, response: nil, context: nil) super("LLM refused to respond: #{}", response: response, context: context) @refusal_message = @refusal_category = refusal_category || determine_refusal_category() end |
Instance Attribute Details
#refusal_category ⇒ Symbol (readonly)
29 30 31 |
# File 'lib/agentic/errors/llm_error.rb', line 29 def refusal_category @refusal_category end |
#refusal_message ⇒ String (readonly)
26 27 28 |
# File 'lib/agentic/errors/llm_error.rb', line 26 def @refusal_message end |
Instance Method Details
#retryable_with_modifications? ⇒ Boolean
Determines whether this refusal is retryable with modifications
43 44 45 |
# File 'lib/agentic/errors/llm_error.rb', line 43 def retryable_with_modifications? [:unclear_instructions, :needs_clarification, :ambiguous_request, :format_error].include?(@refusal_category) end |