Class: ActiveGenie::Comparator::Debate
- Inherits:
-
BaseModule
- Object
- BaseModule
- ActiveGenie::Comparator::Debate
- Defined in:
- lib/active_genie/comparator/debate.rb
Overview
The Debate class provides a foundation for evaluating comparators between two players using AI-powered evaluation. It determines a winner based on specified criteria, analyzing how well each player meets the requirements.
The comparator evaluation process compares two players’ content against given criteria and returns detailed feedback including the winner and reasoning for the decision.
Direct Known Subclasses
Constant Summary collapse
- PROMPT =
File.read(File.join(__dir__, 'debate.prompt.md'))
- FUNCTION =
JSON.parse(File.read(File.join(__dir__, 'debate.json')), symbolize_names: true)
Instance Method Summary collapse
-
#call ⇒ ComparatorResponse
The evaluation result containing the winner and reasoning.
-
#initialize(player_a, player_b, criteria, config: {}) ⇒ ComparatorResponse
constructor
The evaluation result containing the winner and reasoning.
Methods inherited from BaseModule
Constructor Details
#initialize(player_a, player_b, criteria, config: {}) ⇒ ComparatorResponse
Returns The evaluation result containing the winner and reasoning @return [String] :winner The winner, either player_a or player_b @return [String] :reasoning Detailed explanation of why the winner was chosen @return [String] :what_could_be_changed_to_avoid_draw A suggestion on how to avoid a draw.
26 27 28 29 30 31 |
# File 'lib/active_genie/comparator/debate.rb', line 26 def initialize(player_a, player_b, criteria, config: {}) @player_a = player_a @player_b = player_b @criteria = criteria super(config:) end |
Instance Method Details
#call ⇒ ComparatorResponse
Returns The evaluation result containing the winner and reasoning.
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/active_genie/comparator/debate.rb', line 34 def call = [ { role: 'system', content: PROMPT }, { role: 'user', content: "player_a: #{@player_a}" }, { role: 'user', content: "player_b: #{@player_b}" }, { role: 'user', content: "criteria: #{@criteria}" } ] provider_response = ::ActiveGenie::Providers::UnifiedProvider.function_calling(, FUNCTION, config:) response_formatted(provider_response) end |