fix num_keep

This commit is contained in:
Michael Yang 2023-09-03 17:36:14 -04:00
parent 5d3f314b0b
commit 681f3c4c42

View file

@ -117,12 +117,13 @@ func load(ctx context.Context, model *Model, reqOpts map[string]interface{}, ses
if err != nil { if err != nil {
return err return err
} }
tokensNoSystem, err := llmModel.Encode(ctx, promptNoSystem) tokensNoSystem, err := llmModel.Encode(ctx, promptNoSystem)
if err != nil { if err != nil {
return err return err
} }
opts.NumKeep = len(tokensWithSystem) - len(tokensNoSystem) + 1 opts.NumKeep = len(tokensWithSystem) - len(tokensNoSystem)
llmModel.SetOptions(opts) llmModel.SetOptions(opts)
} }