Remove confidence scoring and refine correction prompts
This commit is contained in:
@@ -74,7 +74,6 @@ func TestGlossaryModuleValidatorChain(t *testing.T) {
|
||||
"proposal_shape",
|
||||
"no_effect",
|
||||
"original_text_presence",
|
||||
"confidence_threshold",
|
||||
"protected_terms",
|
||||
"non_empty_resulting_segment",
|
||||
"spoken_form_plausibility",
|
||||
@@ -91,7 +90,7 @@ func TestGlossaryModuleProposeMapsCorrectionsAndWritesDiagnostics(t *testing.T)
|
||||
responses: []proposal_generation.StructuredCorrectionSet{
|
||||
{
|
||||
Corrections: []proposal_generation.StructuredCorrectionProposal{
|
||||
{SegmentReference: 1, OriginalText: "gestures", CorrectedText: "Jesters", Confidence: 0.94},
|
||||
{SegmentReference: 1, OriginalText: "gestures", CorrectedText: "Jesters"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -44,7 +44,6 @@ func (f *fakeLLMClient) CompleteStructured(ctx context.Context, req contracts.St
|
||||
SegmentReference: item["id"].(int),
|
||||
OriginalText: item["original_text"].(string),
|
||||
CorrectedText: item["corrected_text"].(string),
|
||||
Confidence: item["confidence"].(float64),
|
||||
})
|
||||
}
|
||||
return contracts.StructuredCompletionResponse{}, nil
|
||||
@@ -84,7 +83,6 @@ func TestGrammarModuleValidatorChain(t *testing.T) {
|
||||
"proposal_shape",
|
||||
"no_effect",
|
||||
"original_text_presence",
|
||||
"confidence_threshold",
|
||||
"protected_terms",
|
||||
"non_empty_resulting_segment",
|
||||
"editorial_review",
|
||||
@@ -101,7 +99,7 @@ func TestGrammarModuleProposeMapsCorrectionsAndWritesDiagnostics(t *testing.T) {
|
||||
responses: []map[string]any{
|
||||
{
|
||||
"corrections": []map[string]any{
|
||||
{"id": 1, "original_text": "hello ,world", "corrected_text": "Hello, world", "confidence": 0.93},
|
||||
{"id": 1, "original_text": "hello ,world", "corrected_text": "Hello, world"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/config"
|
||||
domain "gitea.maximumdirect.net/eric/audita/v3/internal/core/glossary"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/schema"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/contracts"
|
||||
@@ -76,7 +75,6 @@ func TestHomophonesModuleValidatorChain(t *testing.T) {
|
||||
"proposal_shape",
|
||||
"no_effect",
|
||||
"original_text_presence",
|
||||
"confidence_threshold",
|
||||
"protected_terms",
|
||||
"non_empty_resulting_segment",
|
||||
"spoken_form_plausibility",
|
||||
@@ -93,7 +91,7 @@ func TestHomophonesModuleProposeMapsCorrectionsAndWritesDiagnostics(t *testing.T
|
||||
responses: []proposal_generation.StructuredCorrectionSet{
|
||||
{
|
||||
Corrections: []proposal_generation.StructuredCorrectionProposal{
|
||||
{SegmentReference: 1, OriginalText: "gestures", CorrectedText: "Jesters", Confidence: 0.94},
|
||||
{SegmentReference: 1, OriginalText: "gestures", CorrectedText: "Jesters"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -150,51 +148,6 @@ func TestHomophonesModuleProposeMapsCorrectionsAndWritesDiagnostics(t *testing.T
|
||||
}
|
||||
}
|
||||
|
||||
func TestHomophonesConfidenceThresholdIsUsed(t *testing.T) {
|
||||
module, err := New()
|
||||
if err != nil {
|
||||
t.Fatalf("New error: %v", err)
|
||||
}
|
||||
var thresholdValidator contracts.Validator
|
||||
for _, v := range module.Validators() {
|
||||
if v.Name() == "confidence_threshold" {
|
||||
thresholdValidator = v
|
||||
break
|
||||
}
|
||||
}
|
||||
if thresholdValidator == nil {
|
||||
t.Fatal("expected confidence_threshold validator")
|
||||
}
|
||||
|
||||
result, err := thresholdValidator.Validate(context.Background(), validators.Request{
|
||||
Settings: config.Stage{ConfidenceThreshold: 0.95},
|
||||
ModuleKey: "homophones",
|
||||
CandidateProposal: []proposals.EnrichedCorrectionProposal{
|
||||
{
|
||||
CorrectionProposal: proposals.CorrectionProposal{
|
||||
TargetSegmentID: 1,
|
||||
OriginalText: "gestures",
|
||||
CorrectedText: "Jesters",
|
||||
Confidence: 0.94,
|
||||
},
|
||||
ProposalMetadata: proposals.ProposalMetadata{ProposalIndex: 0, ModuleKey: "homophones", ModuleInstance: "homophones"},
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("validate error: %v", err)
|
||||
}
|
||||
if len(result.Decisions) != 1 {
|
||||
t.Fatalf("expected one decision, got %+v", result.Decisions)
|
||||
}
|
||||
if result.Decisions[0].Approved {
|
||||
t.Fatalf("expected rejection under homophones threshold, got %+v", result.Decisions[0])
|
||||
}
|
||||
if result.Decisions[0].ReasonCode != validators.ReasonLowConfidence {
|
||||
t.Fatalf("expected low confidence reason, got %+v", result.Decisions[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestHomophonesProtectedGlossaryTermBehaviorRejectsUnsafeCorrection(t *testing.T) {
|
||||
module, err := New()
|
||||
if err != nil {
|
||||
@@ -226,7 +179,6 @@ func TestHomophonesProtectedGlossaryTermBehaviorRejectsUnsafeCorrection(t *testi
|
||||
TargetSegmentID: 1,
|
||||
OriginalText: "Jesters",
|
||||
CorrectedText: "gestures",
|
||||
Confidence: 0.99,
|
||||
},
|
||||
ProposalMetadata: proposals.ProposalMetadata{ProposalIndex: 0, ModuleKey: "homophones", ModuleInstance: "homophones"},
|
||||
},
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/config"
|
||||
domain "gitea.maximumdirect.net/eric/audita/v3/internal/core/glossary"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/schema"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/contracts"
|
||||
@@ -76,7 +75,6 @@ func TestSpokenWordModuleValidatorChain(t *testing.T) {
|
||||
"proposal_shape",
|
||||
"no_effect",
|
||||
"original_text_presence",
|
||||
"confidence_threshold",
|
||||
"protected_terms",
|
||||
"non_empty_resulting_segment",
|
||||
"editorial_review",
|
||||
@@ -93,7 +91,7 @@ func TestSpokenWordModuleProposeMapsCorrectionsAndWritesDiagnostics(t *testing.T
|
||||
responses: []proposal_generation.StructuredCorrectionSet{
|
||||
{
|
||||
Corrections: []proposal_generation.StructuredCorrectionProposal{
|
||||
{SegmentReference: 1, OriginalText: "I I think", CorrectedText: "I think", Confidence: 0.94},
|
||||
{SegmentReference: 1, OriginalText: "I I think", CorrectedText: "I think"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -150,51 +148,6 @@ func TestSpokenWordModuleProposeMapsCorrectionsAndWritesDiagnostics(t *testing.T
|
||||
}
|
||||
}
|
||||
|
||||
func TestSpokenWordConfidenceThresholdIsUsed(t *testing.T) {
|
||||
module, err := New()
|
||||
if err != nil {
|
||||
t.Fatalf("New error: %v", err)
|
||||
}
|
||||
var thresholdValidator contracts.Validator
|
||||
for _, v := range module.Validators() {
|
||||
if v.Name() == "confidence_threshold" {
|
||||
thresholdValidator = v
|
||||
break
|
||||
}
|
||||
}
|
||||
if thresholdValidator == nil {
|
||||
t.Fatal("expected confidence_threshold validator")
|
||||
}
|
||||
|
||||
result, err := thresholdValidator.Validate(context.Background(), validators.Request{
|
||||
Settings: config.Stage{ConfidenceThreshold: 0.95},
|
||||
ModuleKey: "spoken_word",
|
||||
CandidateProposal: []proposals.EnrichedCorrectionProposal{
|
||||
{
|
||||
CorrectionProposal: proposals.CorrectionProposal{
|
||||
TargetSegmentID: 1,
|
||||
OriginalText: "I I think",
|
||||
CorrectedText: "I think",
|
||||
Confidence: 0.94,
|
||||
},
|
||||
ProposalMetadata: proposals.ProposalMetadata{ProposalIndex: 0, ModuleKey: "spoken_word", ModuleInstance: "spoken_word"},
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("validate error: %v", err)
|
||||
}
|
||||
if len(result.Decisions) != 1 {
|
||||
t.Fatalf("expected one decision, got %+v", result.Decisions)
|
||||
}
|
||||
if result.Decisions[0].Approved {
|
||||
t.Fatalf("expected rejection under spoken_word threshold, got %+v", result.Decisions[0])
|
||||
}
|
||||
if result.Decisions[0].ReasonCode != validators.ReasonLowConfidence {
|
||||
t.Fatalf("expected low confidence reason, got %+v", result.Decisions[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestSpokenWordProtectedGlossaryTermBehaviorRejectsUnsafeCorrection(t *testing.T) {
|
||||
module, err := New()
|
||||
if err != nil {
|
||||
@@ -226,7 +179,6 @@ func TestSpokenWordProtectedGlossaryTermBehaviorRejectsUnsafeCorrection(t *testi
|
||||
TargetSegmentID: 1,
|
||||
OriginalText: "Jesters",
|
||||
CorrectedText: "gestures",
|
||||
Confidence: 0.99,
|
||||
},
|
||||
ProposalMetadata: proposals.ProposalMetadata{ProposalIndex: 0, ModuleKey: "spoken_word", ModuleInstance: "spoken_word"},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user