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

@@ -14,7 +14,7 @@ type LLMValidationBatch struct {
TokenCount int `json:"token_count"`
}
func prepareValidationBatches(items []LLMValidationItem, budget int, estimator chunking.TokenEstimator) ([]LLMValidationBatch, []Decision, error) {
func prepareValidationBatches(items []LLMValidationItem, budget int, estimator chunking.TokenEstimator, context optionalValidationContext) ([]LLMValidationBatch, []Decision, error) {
if estimator == nil {
estimator = chunking.NewSimpleTokenEstimator()
}
@@ -24,7 +24,7 @@ func prepareValidationBatches(items []LLMValidationItem, budget int, estimator c
var sizes []int
var oversized []Decision
for _, item := range items {
fitted, err := fitValidationContext(item, budget, estimator)
fitted, err := fitValidationContext(item, budget, estimator, context)
if err != nil {
return nil, oversized, err
}