Package com.tnsai.refinement
Interface StopHook
public interface StopHook
Stop hooks for controlling when the refinement loop should terminate.
Stop hooks provide additional conditions beyond completion criteria for stopping the loop, such as performance thresholds or early exit.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StopHookCombine multiple stop hooks with AND logic.static StopHookCombine multiple stop hooks with OR logic.static StopHookStop based on custom condition.default StringgetName()Gets the name of this stop hook.static StopHookStop when all tests pass.static StopHookStop when the output compiles successfully.static StopHookonCostExceeds(int maxTokens) Stop if cost (tokens) exceeds budget.static StopHookonNoImprovement(int consecutiveIterations) Stop if no improvement for N iterations.static StopHookonScoreAbove(double threshold) Stop when score exceeds threshold.booleanshouldStop(com.tnsai.refinement.IterationResult result) Evaluates whether the loop should stop.
-
Method Details
-
shouldStop
boolean shouldStop(com.tnsai.refinement.IterationResult result) Evaluates whether the loop should stop.- Parameters:
result- The current iteration result- Returns:
- true if the loop should stop
-
getName
Gets the name of this stop hook. -
onAllTestsPass
Stop when all tests pass. -
onCompileSuccess
Stop when the output compiles successfully. -
onScoreAbove
Stop when score exceeds threshold. -
onNoImprovement
Stop if no improvement for N iterations. -
onCostExceeds
Stop if cost (tokens) exceeds budget. -
custom
Stop based on custom condition. -
any
Combine multiple stop hooks with OR logic. -
all
Combine multiple stop hooks with AND logic.
-