Class: RSpec::LLM::Matchers::MatchLlmIntent
- Inherits:
-
PassLlmJudge
- Object
- PassLlmJudge
- RSpec::LLM::Matchers::MatchLlmIntent
- Defined in:
- lib/rspec/llm/matchers/match_llm_intent.rb
Overview
Variant of PassLlmJudge that frames the criterion as an intent the response should satisfy. Sugar — the heavy lifting is identical.
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(intent) ⇒ MatchLlmIntent
constructor
A new instance of MatchLlmIntent.
Methods inherited from PassLlmJudge
Constructor Details
#initialize(intent) ⇒ MatchLlmIntent
Returns a new instance of MatchLlmIntent.
9 10 11 12 |
# File 'lib/rspec/llm/matchers/match_llm_intent.rb', line 9 def initialize(intent) super("The response matches the following intent: #{intent}") @intent = intent end |
Instance Method Details
#description ⇒ Object
14 15 16 |
# File 'lib/rspec/llm/matchers/match_llm_intent.rb', line 14 def description "match LLM intent: #{@intent.inspect}" end |
#failure_message ⇒ Object
18 19 20 21 |
# File 'lib/rspec/llm/matchers/match_llm_intent.rb', line 18 def "expected response to match intent #{@intent.inspect}, " \ "but judge said: #{format_reason}\n\nResponse:\n#{@actual}" end |
#failure_message_when_negated ⇒ Object
23 24 25 26 |
# File 'lib/rspec/llm/matchers/match_llm_intent.rb', line 23 def "expected response NOT to match intent #{@intent.inspect}, " \ "but judge said: #{format_reason}\n\nResponse:\n#{@actual}" end |