Class ParallelValidationExecutor
java.lang.Object
com.tnsai.quality.validation.parallel.ParallelValidationExecutor
Executes the same task across multiple agents for validation and comparison.
Parallel validation allows running the same prompt through different LLM models to validate responses, find consensus, identify divergences, and select the best solution based on various aggregation strategies.
Use Cases
- Code review validation: 3 models review → common issues = high confidence
- Critical refactoring: Compare different approaches from different models
- Decision validation: Ensure consensus on important decisions
Usage
ParallelValidationExecutor executor = ParallelValidationExecutor.builder()
.addAgent(claudeAgent)
.addAgent(geminiAgent)
.addAgent(ollamaAgent)
.aggregationStrategy(AggregationStrategy.CONSENSUS)
.timeout(Duration.ofSeconds(60))
.build();
ValidationResult result = executor.execute("Review this code for security issues");
// Access results
result.getBestSolution(); // Best response based on strategy
result.getConsensusPoints(); // Points all agents agree on
result.getDivergences(); // Points where agents disagree
result.getMetrics(); // Execution metrics
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Executes the prompt across all configured agents/LLMs.executeAsync(String prompt) Executes asynchronously.intGets the number of participants.Gets the configured aggregation strategy.
-
Method Details
-
builder
-
execute
Executes the prompt across all configured agents/LLMs.- Parameters:
prompt- the prompt to execute- Returns:
- validation result with aggregated response and metrics
-
executeAsync
Executes asynchronously. -
getStrategy
Gets the configured aggregation strategy. -
getParticipantCount
public int getParticipantCount()Gets the number of participants.
-