Download lib/src/limits.js from Rachit-Tw/PRININIT: direct link, hf CLI and curl.
- Browser
- Download file 1.8 kB
-
https://huggingface.co/spaces/Rachit-Tw/PRININIT/resolve/main/lib/src/limits.js
- Command line
-
hf download hf://spaces/Rachit-Tw/PRININIT/lib/src/limits.js
-
curl -L -o limits.js https://huggingface.co/spaces/Rachit-Tw/PRININIT/resolve/main/lib/src/limits.js
1.8 kB
| ; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.TokenLimits = void 0; | |
| class TokenLimits { | |
| maxTokens; | |
| requestTokens; | |
| responseTokens; | |
| knowledgeCutOff; | |
| constructor(model = 'openai/gpt-oss-120b:free') { | |
| this.knowledgeCutOff = '2023-12-01'; | |
| // Default for modern large context models | |
| this.maxTokens = 128000; | |
| this.responseTokens = 4000; // Standardized at 4k for safety across all models | |
| if (model.includes('kimi-k2')) { | |
| this.maxTokens = 256000; | |
| } | |
| else if (model.includes('llama-3.3')) { | |
| // Models with strict TPM limits | |
| // We must cap the context to avoid 'Request too large' 413 errors | |
| this.maxTokens = 12000; | |
| this.responseTokens = 3000; // Leave more room for input | |
| } | |
| else if (model.includes('qwen') || model.includes('llama-4')) { | |
| this.maxTokens = 128000; | |
| } | |
| else if (model.includes('gpt-oss-120b')) { | |
| this.maxTokens = 128000; | |
| } | |
| else if (model.includes('3.2-11b')) { | |
| this.maxTokens = 128000; | |
| } | |
| else if (model.includes('llama3') || | |
| model.includes('llama-3') || | |
| model.includes('mixtral')) { | |
| this.maxTokens = 128000; | |
| } | |
| // Provide some margin | |
| this.requestTokens = this.maxTokens - this.responseTokens - 500; | |
| // Ensure requestTokens is never negative | |
| if (this.requestTokens < 1000) { | |
| this.requestTokens = 1000; | |
| } | |
| } | |
| string() { | |
| return `max_tokens=${this.maxTokens}, request_tokens=${this.requestTokens}, response_tokens=${this.responseTokens}`; | |
| } | |
| } | |
| exports.TokenLimits = TokenLimits; | |
| //# sourceMappingURL=limits.js.map |