diff --git a/server/routes.go b/server/routes.go index f0762416..1a049cbd 100644 --- a/server/routes.go +++ b/server/routes.go @@ -117,12 +117,13 @@ func load(ctx context.Context, model *Model, reqOpts map[string]interface{}, ses if err != nil { return err } + tokensNoSystem, err := llmModel.Encode(ctx, promptNoSystem) if err != nil { return err } - opts.NumKeep = len(tokensWithSystem) - len(tokensNoSystem) + 1 + opts.NumKeep = len(tokensWithSystem) - len(tokensNoSystem) llmModel.SetOptions(opts) }