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 0f047fe
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: llm/llama_server.go
+21-5Lines changed: 21 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -273,15 +273,31 @@ func (s *llamaServerRunner) completionPromptForRequest(ctx context.Context, req
273
273
returnnil, err
274
274
}
275
275
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 {
276
+
limit:=s.options.NumCtx-1
277
+
iflen(tokens) <=limit {
278
+
returnprompt, nil
279
+
}
280
+
281
+
if!s.launch.config.ContextShift {
279
282
returnnil, api.StatusError{
280
283
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",
284
+
ErrorMessage: "the prompt is longer than the context length currently available to the model; shorten the prompt, adjust the context length in settings, or use a model with a longer context length",
constwantError="the prompt is longer than the context length currently available to the model; shorten the prompt or adjust the context length in settings"
492
+
constwantError="the prompt is longer than the context length currently available to the model; shorten the prompt, adjust the context length in settings, or use a model with a longer context length"
0 commit comments