Repeat Until Acceptable
data class RepeatUntilAcceptable(val maxIterations: Int = 3, val scoreThreshold: <Error class: unknown class> = 0.9)
Primitive for building repeat until acceptable workflows. See https://www.anthropic.com/engineering/building-effective-agents This is the Evaluator Optimizer pattern
Functions
Link copied to clipboard
inline fun <RESULT : Any, FEEDBACK : Feedback> build(noinline task: (TransformationActionContext<AttemptHistory<RESULT, FEEDBACK>, RESULT>) -> RESULT, noinline evaluator: (TransformationActionContext<AttemptHistory<RESULT, FEEDBACK>, FEEDBACK>) -> FEEDBACK, noinline acceptanceCriteria: (FEEDBACK) -> Boolean = { it.score >= scoreThreshold }): AgentScopeBuilder<RESULT>
fun <RESULT : Any, FEEDBACK : Feedback> build(task: (TransformationActionContext<AttemptHistory<RESULT, FEEDBACK>, RESULT>) -> RESULT, evaluator: (TransformationActionContext<AttemptHistory<RESULT, FEEDBACK>, FEEDBACK>) -> FEEDBACK, acceptanceCriteria: (FEEDBACK) -> Boolean, resultClass: Class<RESULT>, feedbackClass: Class<FEEDBACK>): AgentScopeBuilder<RESULT>