Skip to content

Refuse max_tokens above the real 4096 Ollama cap - #23

Merged
jmjava merged 1 commit into
mainfrom
cursor/refuse-max-tokens-above-cap
Sep 11, 2026
Merged

jmjava merged 1 commit into
mainfrom
cursor/refuse-max-tokens-above-cap

Conversation

@jmjava

@jmjava jmjava commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Summary

Test plan

  • test_chat_num_predict_equals_requested captures POST options.num_predict and asserts it equals the requested value
  • test_chat_max_tokens_above_cap_raises_without_post asserts max_tokens=8192 raises max_tokens_too_large and does not POST
  • test_max_tokens_8192_is_too_large asserts the payload gate refuses 8192 and accepts 4096
  • CI tests job green

Made with Cursor

8192 used to pass inspect_payload and then be silently clamped in chat();
the POST now sends the requested num_predict or raises max_tokens_too_large.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jmjava
jmjava merged commit 75e81e3 into main Sep 11, 2026
3 checks passed
@jmjava
jmjava deleted the cursor/refuse-max-tokens-above-cap branch September 11, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant