feat: add repetition detection fallback to orchestrator pipeline
Se añade un mecanismo de detección de repetición para cortar conversaciones circulares entre agentes cuando hablan sin parar. - Nuevo campo RepetitionThreshold en OrchestrationCfg (schema.go). - Función detectRepetition() compara cada nueva respuesta con las anteriores usando similitud de bigramas (Dice coefficient). - Si la similitud supera el umbral (default 0.6), el pipeline se detiene inmediatamente con un log de warning, antes de gastar una llamada LLM en la evaluación de calidad. - Funciones auxiliares: similarity() y makeBigrams() para el cálculo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -418,10 +418,11 @@ type SpecialMeta struct {
|
||||
|
||||
// OrchestrationCfg configures the multi-bot orchestrator.
|
||||
type OrchestrationCfg struct {
|
||||
MaxIterations int `yaml:"max_iterations"`
|
||||
QualityThreshold float64 `yaml:"quality_threshold"`
|
||||
DelegationTimeout time.Duration `yaml:"delegation_timeout"`
|
||||
Rooms []OrchestratedRoomCfg `yaml:"rooms"`
|
||||
MaxIterations int `yaml:"max_iterations"`
|
||||
QualityThreshold float64 `yaml:"quality_threshold"`
|
||||
DelegationTimeout time.Duration `yaml:"delegation_timeout"`
|
||||
RepetitionThreshold float64 `yaml:"repetition_threshold"` // 0-1: similarity ratio to detect circular conversations
|
||||
Rooms []OrchestratedRoomCfg `yaml:"rooms"`
|
||||
}
|
||||
|
||||
// OrchestratedRoomCfg defines a room managed by the orchestrator.
|
||||
|
||||
Reference in New Issue
Block a user