Collect optional validation context only when it can fit

This commit is contained in:
2026-11-17 04:25:35 +00:00
parent 44c767f285
commit d26991f0bf
9 changed files with 128 additions and 56 deletions

View File

@@ -133,7 +133,8 @@ func TestValidationContextIncludesEachSharedDefinition(t *testing.T) {
{Collection: "items", ID: "bow", Name: "Bow", Category: "item"},
}
segments := []schema.Segment{{ID: 1, Text: "Shield Shield"}}
_, selected := prepareGlossaryContext(entries).validationContext(segments, 0, "Sword")
context := validationContextFor(Request{WorkingTranscript: &schema.Transcript{Segments: segments}, Glossary: entries})
_, selected := context(LLMValidationItem{CorrectedSegmentText: "Sword"})
if len(selected) != 3 || selected[0].ID != "sword" || selected[1].Category != "spell" || selected[2].ID != "shield" || selected[2].Collection != "items" {
t.Fatalf("selected=%+v", selected)
}