[BUG]: Recognize LiteLLM model's max context and remove max_tokens #2226

Open
opened 2026-02-28 06:00:20 -05:00 by deekerman · 0 comments
Owner

Originally created by @ringge on GitHub (Mar 8, 2025).

Originally assigned to: @angelplusultra on GitHub.

How are you running AnythingLLM?

AnythingLLM desktop app

What happened?

I'm using document pinning for my workspace.
If using the model directly, for example I used Gemini 2.0, or any other model, the document pinning works as expected.
However, if using the same model (like Gemini 2.0) through LiteLLM, anythingLLM seems not being able to detect the max context through LiteLLM so it automatically truncate the document

Are there known steps to reproduce?

  1. Upload a document, enable document pinning
  2. Set model used as Gemini 2.0, it works
  3. Switch model to LiteLLM, still using Gemini 2.0, the prompt is truncated
Originally created by @ringge on GitHub (Mar 8, 2025). Originally assigned to: @angelplusultra on GitHub. ### How are you running AnythingLLM? AnythingLLM desktop app ### What happened? I'm using document pinning for my workspace. If using the model directly, for example I used Gemini 2.0, or any other model, the document pinning works as expected. However, if using the same model (like Gemini 2.0) through LiteLLM, anythingLLM seems not being able to detect the max context through LiteLLM so it automatically truncate the document ### Are there known steps to reproduce? 1. Upload a document, enable document pinning 2. Set model used as Gemini 2.0, it works 3. Switch model to LiteLLM, still using Gemini 2.0, the prompt is truncated
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/anything-llm#2226
No description provided.