You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bbb40a0
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: llm/llama_server.go
+8-21Lines changed: 8 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -273,28 +273,15 @@ func (s *llamaServerRunner) completionPromptForRequest(ctx context.Context, req
273
273
returnnil, err
274
274
}
275
275
276
-
// llama-server rejects prompts that fill the entire slot context, while the
277
-
// old runner could accept exactly num_ctx prompt tokens. Keep one token of
278
-
// headroom so token-level truncation preserves old behavior as closely as
279
-
// llama-server allows.
280
-
limit:=s.options.NumCtx-1
281
-
iflen(tokens) <=limit {
282
-
returnprompt, nil
283
-
}
284
-
285
-
nKeep:=req.Options.NumKeep
286
-
ifnKeep<0 {
287
-
nKeep=len(tokens)
276
+
// s.options.NumCtx is the runner's effective per-slot context length. It
277
+
// has already been capped by the model's training context during launch.
278
+
iflen(tokens) >=s.options.NumCtx {
279
+
returnnil, api.StatusError{
280
+
StatusCode: http.StatusBadRequest,
281
+
ErrorMessage: "the prompt is longer than the context length currently available to the model; shorten the prompt or adjust the context length in settings",
constwantError="the prompt is longer than the context length currently available to the model; shorten the prompt or adjust the context length in settings"
0 commit comments