[GH-ISSUE #7043] Warn users when input is longer than supported context #30229

Open
opened 2026-04-22 09:45:17 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @fzyzcjy on GitHub (Sep 30, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7043

What is the issue?

Hi thanks for the great library! It would be great if there could be a warning when input is longer than supported context. Otherwise, if the text is silently truncated, the behavior can be confusing.

OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Originally created by @fzyzcjy on GitHub (Sep 30, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7043 ### What is the issue? Hi thanks for the great library! It would be great if there could be a warning when input is longer than supported context. Otherwise, if the text is silently truncated, the behavior can be confusing. ### OS _No response_ ### GPU _No response_ ### CPU _No response_ ### Ollama version _No response_
GiteaMirror added the bug label 2026-04-22 09:45:17 -05:00
Author
Owner

@anhalu commented on GitHub (Dec 17, 2024):

Any updated ?

<!-- gh-comment-id:2547763481 --> @anhalu commented on GitHub (Dec 17, 2024): Any updated ?
Author
Owner

@pacien commented on GitHub (Jan 7, 2025):

There is a warning in the ollama serve logs when this happens:

level=WARN source=runner.go:129 msg="truncating input prompt" limit=2048 prompt=10983 keep=5 new=2048

Sadly, this is not reported back to the user in the ollama run console.
The user can only see some weird behaviour from the LLM's answers. Not ideal.

<!-- gh-comment-id:2575974418 --> @pacien commented on GitHub (Jan 7, 2025): There is a warning in the `ollama serve` logs when this happens: ``` level=WARN source=runner.go:129 msg="truncating input prompt" limit=2048 prompt=10983 keep=5 new=2048 ``` Sadly, this is not reported back to the user in the `ollama run` console. The user can only see some weird behaviour from the LLM's answers. Not ideal.
Author
Owner

@hillar commented on GitHub (Jun 20, 2025):

87b7af6cee/runner/ollamarunner/runner.go (L157C14-L157C37)

please consider to add to the final response:

  • prompt_input_count : len(inputs)
  • prompt_truncated : true if input is truncated
<!-- gh-comment-id:2989972092 --> @hillar commented on GitHub (Jun 20, 2025): https://github.com/ollama/ollama/blob/87b7af6ceef2b4d96374dbff5070b41b17d3f138/runner/ollamarunner/runner.go#L157C14-L157C37 please consider to add to the final response: * `prompt_input_count` : len(inputs) * `prompt_truncated` : true if input is truncated
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#30229