project-nomad/admin
Henry Estela 8b54310746
Improve context window size estimation
fixes issue seen with some models in lm studio resulting in:
"The number of tokens to keep from the initial prompt is greater than the context length (n_keep: 4705>= n_ctx: 4096)"

Fixed char/token estimate, the old value was too optimistic,
causing the cap to allow more text than the budget allowed in actual tokens.
After RAG injection, estimates the system prompt token count.
If it exceeds ~3000 tokens, requests the next standard context size (8192, 16384, 32768, or 65536),
large enough to fit the prompt plus a 2048-token buffer for the conversation and response.

For Ollama, num_ctx is honoured per-request and will load the model with that context
window. For LM Studio, the parameter is silently ignored — but the tighter char
estimate will also reduce how much RAG text gets stuffed in, so it's less likely to
overflow.
2026-03-25 17:18:06 -07:00
..
app Improve context window size estimation 2026-03-25 17:18:06 -07:00
bin feat: curated content system overhaul 2026-02-11 15:44:46 -08:00
commands fix: improve download reliability with stall detection, failure visibility, and Wikipedia status tracking 2026-03-20 11:46:10 -07:00
config fix(ui): reduce SSE reconnect churn and polling overhead on navigation 2026-03-20 11:46:10 -07:00
constants feat(ai-chat): Add ability to use a remote ollama instance on LAN 2026-03-25 17:18:04 -07:00
database fix: bump default ollama and cyberchef versions 2026-03-25 16:30:35 -07:00
docs docs(release): finalize v1.30.3 release notes [skip ci] 2026-03-25 23:40:34 +00:00
inertia fix(ai-chat): ingestion of documents with openai and add cleanup button 2026-03-25 17:18:05 -07:00
providers fix(Maps): static path resolution 2026-01-23 14:17:25 -08:00
public feat(UI): add Support the Project settings page 2026-03-20 11:46:10 -07:00
resources/views feat(UI): add Night Ops dark mode with theme toggle 2026-03-20 11:46:10 -07:00
start fix(ai-chat): ingestion of documents with openai and add cleanup button 2026-03-25 17:18:05 -07:00
tests feat: initial commit 2025-06-29 15:51:08 -07:00
types fix(ai-chat): ingestion of documents with openai and add cleanup button 2026-03-25 17:18:05 -07:00
util feat: display model download progress 2026-02-06 16:22:23 -08:00
views feat: initial commit 2025-06-29 15:51:08 -07:00
.editorconfig feat: initial commit 2025-06-29 15:51:08 -07:00
.env.example feat: Add Windows Docker Desktop support for local development 2026-01-19 10:29:24 -08:00
ace.js feat: initial commit 2025-06-29 15:51:08 -07:00
adonisrc.ts feat: background job overhaul with bullmq 2025-12-06 23:59:01 -08:00
eslint.config.js feat: openwebui+ollama and zim management 2025-07-09 09:08:21 -07:00
package-lock.json feat(ai-chat): Add support for OpenAI API 2026-03-25 17:18:05 -07:00
package.json feat(ai-chat): Add support for OpenAI API 2026-03-25 17:18:05 -07:00
tailwind.config.ts feat: initial commit 2025-06-29 15:51:08 -07:00
tsconfig.json feat: initial commit 2025-06-29 15:51:08 -07:00
vite.config.ts feat: initial commit 2025-06-29 15:51:08 -07:00