From 681f3c4c42a645fb3e9cbc4311ae6662d838a684 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Sun, 3 Sep 2023 17:36:14 -0400 Subject: [PATCH] fix num_keep --- server/routes.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) }