Align prompts and strengthen validation context
This commit is contained in:
@@ -75,6 +75,9 @@ func (v *LLMBackedValidator) Validate(ctx context.Context, req Request) (Result,
|
||||
maxTokens = req.Config.Validation.MaxPromptTokens
|
||||
}
|
||||
|
||||
for i := range validationReq.Items {
|
||||
validationReq.Items[i] = fitValidationContext(validationReq.Items[i], maxTokens, v.estimator)
|
||||
}
|
||||
oversized := oversizedValidationDecisions(validationReq.Items, maxTokens, v.estimator)
|
||||
operations := make([]outcomes.Operation, 0)
|
||||
sectionIndex := 0
|
||||
@@ -232,10 +235,6 @@ func validatorPromptMetadata(validatorType LLMValidatorType) prompts.Metadata {
|
||||
return prompts.MustLookupMetadata(prompts.PromptIDValidatorMeaningReversalReview)
|
||||
case LLMValidatorTypeEditorialReview:
|
||||
return prompts.MustLookupMetadata(prompts.PromptIDValidatorEditorialReview)
|
||||
case LLMValidatorTypeGrammarReview:
|
||||
return prompts.MustLookupMetadata(prompts.PromptIDValidatorGrammarReview)
|
||||
case LLMValidatorTypeSpokenWordReview:
|
||||
return prompts.MustLookupMetadata(prompts.PromptIDValidatorSpokenWordReview)
|
||||
default:
|
||||
return prompts.Metadata{}
|
||||
}
|
||||
@@ -272,6 +271,7 @@ func BuildLLMValidationRequest(validatorName string, validatorType LLMValidatorT
|
||||
continue
|
||||
}
|
||||
|
||||
neighbors, glossaryEntries := validationContext(req, seg.ID, preview.CorrectedSegmentText)
|
||||
items = append(items, LLMValidationItem{
|
||||
CorrectionIndex: p.ProposalIndex,
|
||||
SegmentID: p.TargetSegmentID,
|
||||
@@ -280,6 +280,8 @@ func BuildLLMValidationRequest(validatorName string, validatorType LLMValidatorT
|
||||
OriginalSegmentText: seg.Text,
|
||||
CorrectedSegmentText: preview.CorrectedSegmentText,
|
||||
Categories: append([]string(nil), seg.Categories...),
|
||||
NeighboringSegments: neighbors,
|
||||
GlossaryEntries: glossaryEntries,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user