Elffuss BraidHub

kikocis/continue public

Merge pull request #7702 from uinstinct/ollama-memory-contextlength

fix: ollama detect context length automatically
Changeset4d2cde11634f9b89ebfebc4569a299238892b7246abe0b14287da74ec76133d8
AuthorAditya Mitra <61635505+uinstinct@users.noreply.github.com> · 2025-09-18 05:00 +05:30
CommitterGitHub <noreply@github.com> · 2025-09-17 16:30 -07:00
Parents0bee98b44db8

Browse the files at this changeset

2 files changed

modified core/llm/llms/Ollama.ts +5 −0
@@ -269,6 +269,11 @@
269269 return this.modelMap[this.model] ?? this.model;
270270 }
271271
272+ get contextLength() {
273+ const DEFAULT_OLLAMA_CONTEXT_LENGTH = 8192; // twice of https://github.com/ollama/ollama/blob/29ddfc2cab7f5a83a96c3133094f67b22e4f27d1/envconfig/config.go#L185
274+ return this._contextLength ?? DEFAULT_OLLAMA_CONTEXT_LENGTH;
275+ }
276+
272277 private _getModelFileParams(
273278 options: CompletionOptions,
274279 ): OllamaModelFileParams {
modified packages/llm-info/src/providers/os.ts +1 −0
@@ -4,5 +4,6 @@
44 {
55 model: "starcoder2:3b",
66 displayName: "StarCoder 2 3B",
7+ contextLength: 8192,
78 },
89 ];