[PR #3817] [MERGED] Automatic Context window detection #4417

Closed
opened 2026-02-22 18:35:47 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/3817
Author: @timothycarambat
Created: 5/13/2025
Status: Merged
Merged: 5/14/2025
Merged by: @timothycarambat

Base: masterHead: context-window-finder


📝 Commits (3)

  • 076cb84 Add context window finder from litellm maintained list
  • c0d7bb9 linting
  • eb15a46 Merge branch 'master' into context-window-finder

📊 Changes

12 files changed (+183 additions, -67 deletions)

View changed files

📝 server/storage/models/.gitignore (+1 -0)
📝 server/utils/AiProviders/anthropic/index.js (+2 -2)
📝 server/utils/AiProviders/cohere/index.js (+2 -2)
📝 server/utils/AiProviders/deepseek/index.js (+5 -3)
📝 server/utils/AiProviders/gemini/defaultModels.js (+10 -5)
📝 server/utils/AiProviders/gemini/index.js (+5 -6)
📝 server/utils/AiProviders/gemini/syncStaticLists.mjs (+0 -31)
📝 server/utils/AiProviders/groq/index.js (+2 -2)
server/utils/AiProviders/modelMap/index.js (+140 -0)
📝 server/utils/AiProviders/modelMap/legacy.js (+2 -11)
📝 server/utils/AiProviders/openAi/index.js (+9 -2)
📝 server/utils/AiProviders/xai/index.js (+5 -3)

📄 Description

Pull Request Type

  • feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

What is in this change?

Additional Information

  • Pulls an accurate context window listing from LiteLLM
  • apply to all cloud providers, stores this on client cache for 3 days
  • This is what will be used to lookup your model tag using .get(provider,model) to always have up to date context windows on providers which we do not provider a way to override this value. (openai, gemini, etc) without us having to maintain this list

Developer Validations

  • Bumped Gemini model listings with sync script.
  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/3817 **Author:** [@timothycarambat](https://github.com/timothycarambat) **Created:** 5/13/2025 **Status:** ✅ Merged **Merged:** 5/14/2025 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `context-window-finder` --- ### 📝 Commits (3) - [`076cb84`](https://github.com/Mintplex-Labs/anything-llm/commit/076cb844fc0b13e2797dfd309cdb756bdca6dc66) Add context window finder from litellm maintained list - [`c0d7bb9`](https://github.com/Mintplex-Labs/anything-llm/commit/c0d7bb9a49aedc26dfd38087b2c0c191971c4579) linting - [`eb15a46`](https://github.com/Mintplex-Labs/anything-llm/commit/eb15a46f7e10b4f597a32e260a2a344ab792de4e) Merge branch 'master' into context-window-finder ### 📊 Changes **12 files changed** (+183 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `server/storage/models/.gitignore` (+1 -0) 📝 `server/utils/AiProviders/anthropic/index.js` (+2 -2) 📝 `server/utils/AiProviders/cohere/index.js` (+2 -2) 📝 `server/utils/AiProviders/deepseek/index.js` (+5 -3) 📝 `server/utils/AiProviders/gemini/defaultModels.js` (+10 -5) 📝 `server/utils/AiProviders/gemini/index.js` (+5 -6) 📝 `server/utils/AiProviders/gemini/syncStaticLists.mjs` (+0 -31) 📝 `server/utils/AiProviders/groq/index.js` (+2 -2) ➕ `server/utils/AiProviders/modelMap/index.js` (+140 -0) 📝 `server/utils/AiProviders/modelMap/legacy.js` (+2 -11) 📝 `server/utils/AiProviders/openAi/index.js` (+9 -2) 📝 `server/utils/AiProviders/xai/index.js` (+5 -3) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [ ] ✨ feat - [x] 🐛 fix - [x] ♻️ refactor - [ ] 💄 style - [x] 🔨 chore - [ ] 📝 docs ### What is in this change? <!-- Describe the changes in this PR that are impactful to the repo. --> ### Additional Information - Pulls an accurate context window listing from [LiteLLM](https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json) - apply to all cloud providers, stores this on client cache for 3 days - This is what will be used to lookup your model tag using `.get(provider,model)` to always have up to date context windows on providers which we do not provider a way to override this value. (openai, gemini, etc) without us having to maintain this list <!-- Add any other context about the Pull Request here that was not captured above. --> ### Developer Validations - Bumped Gemini model listings with `sync` script. <!-- All of the applicable items should be checked. --> - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] Relevant documentation has been updated - [x] I have tested my code functionality - [x] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:35:47 -05:00
yindo closed this issue 2026-02-22 18:35:47 -05:00
yindo changed title from [PR #3817] Automatic Context window detection to [PR #3817] [MERGED] Automatic Context window detection 2026-06-05 15:18:28 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#4417