Refactor validators into built-in registry chains
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/contracts"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/proposal_generation"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/proposals"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/validators"
|
||||
builtinvalidators "gitea.maximumdirect.net/eric/audita/internal/validators"
|
||||
)
|
||||
|
||||
type Module struct {
|
||||
@@ -16,25 +16,12 @@ type Module struct {
|
||||
}
|
||||
|
||||
func New() (*Module, error) {
|
||||
spokenWordReview, err := validators.NewLLMBackedValidator("spoken_word_review", validators.LLMValidatorTypeSpokenWordReview, "")
|
||||
chain, err := builtinvalidators.ResolveBuiltInChain("spoken_word", builtinvalidators.NewBuiltInRegistry())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
meaningReversal, err := validators.NewLLMBackedValidator("meaning_reversal_review", validators.LLMValidatorTypeMeaningReversal, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Module{
|
||||
validators: []contracts.Validator{
|
||||
validators.NoEffectValidator{},
|
||||
validators.OriginalTextPresenceValidator{},
|
||||
validators.ConfidenceThresholdValidator{},
|
||||
validators.ProtectedGlossaryTermValidator{},
|
||||
validators.NonEmptyCorrectionValidator{},
|
||||
spokenWordReview,
|
||||
meaningReversal,
|
||||
},
|
||||
validators: chain,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -136,8 +136,8 @@ func TestSpokenWordModuleValidatorChain(t *testing.T) {
|
||||
"no_effect",
|
||||
"original_text_presence",
|
||||
"confidence_threshold",
|
||||
"protected_glossary_terms",
|
||||
"non_empty_correction",
|
||||
"protected_terms",
|
||||
"non_empty_corrected_text",
|
||||
"spoken_word_review",
|
||||
"meaning_reversal_review",
|
||||
}
|
||||
@@ -264,13 +264,13 @@ func TestSpokenWordProtectedGlossaryTermBehaviorRejectsUnsafeCorrection(t *testi
|
||||
}
|
||||
var protectedValidator contracts.Validator
|
||||
for _, v := range module.Validators() {
|
||||
if v.Name() == "protected_glossary_terms" {
|
||||
if v.Name() == "protected_terms" {
|
||||
protectedValidator = v
|
||||
break
|
||||
}
|
||||
}
|
||||
if protectedValidator == nil {
|
||||
t.Fatal("expected protected_glossary_terms validator")
|
||||
t.Fatal("expected protected_terms validator")
|
||||
}
|
||||
|
||||
working := &schema.Transcript{Segments: []schema.Segment{
|
||||
|
||||
Reference in New Issue
Block a user