It's used when the n_ctx limit is reached. A new prompt will be constructed with the first n_keep characters of the original prompt plus the second half of the output to free up space for more conversation.
It's the amount of tokens after your system prompt that are always kept, when the start of the history is thrown away.
First N, no Last N !!!
In Params Configs it's wrong exemplified, as:
"This option controls how many tokens are preserved when refreshing the context. For example, if set to 2, the last 2 tokens of the conversation context will be retained. Preserving context can help maintain the continuity of a conversation, but it may reduce the ability to respond to new topics."
When have to be, as:
"This option controls how many tokens are preserved when refreshing the context. For example, if set to 2, the first 2 tokens of the conversation context will be retained. Preserving context can help maintain the continuity of a conversation, but it may reduce the ability to respond to new topics."
🔄 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/open-webui/open-webui/pull/12289
**Author:** [@rgaricano](https://github.com/rgaricano)
**Created:** 4/1/2025
**Status:** ❌ Closed
**Base:** `dev` ← **Head:** `dev`
---
### 📝 Commits (5)
- [`83a76c0`](https://github.com/open-webui/open-webui/commit/83a76c02c741302bd27bc4030e69286ac3f870b4) FIX: num_keep param explanation/exemplified (en-US)
- [`4331c52`](https://github.com/open-webui/open-webui/commit/4331c52e6f20fad6d0778f5dffb78cd31eb77a21) Update by outside exchanged lines
- [`14056fc`](https://github.com/open-webui/open-webui/commit/14056fc3bdbbb74485b03db85384da3f78de440e) Update translation.json
- [`aefbf4e`](https://github.com/open-webui/open-webui/commit/aefbf4ec73df9aa56da44bdfc55a0fa493d8d0a2) UPD: Spanish Translation (es-ES) v0.6.0
- [`6598681`](https://github.com/open-webui/open-webui/commit/659868178ed7f71a6d197bf49a17cd28b7de0278) Merge branch 'open-webui:dev' into dev
### 📊 Changes
**2 files changed** (+95 additions, -94 deletions)
<details>
<summary>View changed files</summary>
📝 `src/lib/i18n/locales/en-US/translation.json` (+2 -2)
📝 `src/lib/i18n/locales/es-ES/translation.json` (+93 -92)
</details>
### 📄 Description
Def. n_keep / num_keep:
- It's used when the n_ctx limit is reached. A new prompt will be constructed with the first n_keep characters of the original prompt plus the second half of the output to free up space for more conversation.
- It's the amount of tokens after your system prompt that are always kept, when the start of the history is thrown away.
First N, no Last N !!!
In Params Configs it's wrong exemplified, as:
"This option controls how many tokens are preserved when refreshing the context. For example, if set to 2, the **last** 2 tokens of the conversation context will be retained. Preserving context can help maintain the continuity of a conversation, but it may reduce the ability to respond to new topics."
When have to be, as:
"This option controls how many tokens are preserved when refreshing the context. For example, if set to 2, the **first** 2 tokens of the conversation context will be retained. Preserving context can help maintain the continuity of a conversation, but it may reduce the ability to respond to new topics."
Ollama's num_keep func.: https://github.com/ollama/ollama/blob/c001b98087e45b7b60509127d4d2e9d9ba809444/runner/ollamarunner/runner.go#L124-L131
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/12289
Author: @rgaricano
Created: 4/1/2025
Status: ❌ Closed
Base:
dev← Head:dev📝 Commits (5)
83a76c0FIX: num_keep param explanation/exemplified (en-US)4331c52Update by outside exchanged lines14056fcUpdate translation.jsonaefbf4eUPD: Spanish Translation (es-ES) v0.6.06598681Merge branch 'open-webui:dev' into dev📊 Changes
2 files changed (+95 additions, -94 deletions)
View changed files
📝
src/lib/i18n/locales/en-US/translation.json(+2 -2)📝
src/lib/i18n/locales/es-ES/translation.json(+93 -92)📄 Description
Def. n_keep / num_keep:
First N, no Last N !!!
In Params Configs it's wrong exemplified, as:
"This option controls how many tokens are preserved when refreshing the context. For example, if set to 2, the last 2 tokens of the conversation context will be retained. Preserving context can help maintain the continuity of a conversation, but it may reduce the ability to respond to new topics."
When have to be, as:
"This option controls how many tokens are preserved when refreshing the context. For example, if set to 2, the first 2 tokens of the conversation context will be retained. Preserving context can help maintain the continuity of a conversation, but it may reduce the ability to respond to new topics."
Ollama's num_keep func.: https://github.com/ollama/ollama/blob/c001b98087e45b7b60509127d4d2e9d9ba809444/runner/ollamarunner/runner.go#L124-L131
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.