[PR #8938] [MERGED] config: allow setting context length through env var #12820

Closed
opened 2026-04-13 00:10:30 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/8938
Author: @ParthSareen
Created: 2/8/2025
Status: Merged
Merged: 2/24/2025
Merged by: @ParthSareen

Base: mainHead: parth/set-context-length-env


📝 Commits (6)

  • a303119 envconfig: allow setting context length through env var
  • aa05b70 load env var as part of default
  • 9e9ad36 env: set default context length for memory test
  • c2d08dd envconfig: default value for 0 and -ve context length values
  • 96ed1db move context length validation to Scheduler
  • 09f1587 just use existing default for context length

📊 Changes

4 files changed (+23 additions, -1 deletions)

View changed files

📝 api/types.go (+3 -1)
📝 envconfig/config.go (+3 -0)
📝 envconfig/config_test.go (+16 -0)
📝 llm/memory_test.go (+1 -0)

📄 Description

From offline discussions:

  • Current API parameters improperly mix system and request level configurations
  • For now, let users set a context length through OLLAMA_CONTEXT_LENGTH
  • Users can still set num_ctx through the CLI or SDK on a request level but is expected to be moved away from in the future

closes: #6504, #8794, #5356, #5357


🔄 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/ollama/ollama/pull/8938 **Author:** [@ParthSareen](https://github.com/ParthSareen) **Created:** 2/8/2025 **Status:** ✅ Merged **Merged:** 2/24/2025 **Merged by:** [@ParthSareen](https://github.com/ParthSareen) **Base:** `main` ← **Head:** `parth/set-context-length-env` --- ### 📝 Commits (6) - [`a303119`](https://github.com/ollama/ollama/commit/a30311939fb8e67afec460023f2d665960ef2d17) envconfig: allow setting context length through env var - [`aa05b70`](https://github.com/ollama/ollama/commit/aa05b7050679d8cc320378479c1f20ce3340c6bd) load env var as part of default - [`9e9ad36`](https://github.com/ollama/ollama/commit/9e9ad36ea345e96c188457b5f17411af0245d9c4) env: set default context length for memory test - [`c2d08dd`](https://github.com/ollama/ollama/commit/c2d08dd67a9bcf15e52a2f15b1fad888afffcd32) envconfig: default value for 0 and -ve context length values - [`96ed1db`](https://github.com/ollama/ollama/commit/96ed1db4c613d5c08803114bf3c387b7ab3a9ac2) move context length validation to Scheduler - [`09f1587`](https://github.com/ollama/ollama/commit/09f15872d92531f5b41caa51e9b1547eeb7ab694) just use existing default for context length ### 📊 Changes **4 files changed** (+23 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+3 -1) 📝 `envconfig/config.go` (+3 -0) 📝 `envconfig/config_test.go` (+16 -0) 📝 `llm/memory_test.go` (+1 -0) </details> ### 📄 Description From offline discussions: - Current API parameters improperly mix system and request level configurations - For now, let users set a context length through `OLLAMA_CONTEXT_LENGTH` - Users can still set `num_ctx` through the CLI or SDK on a request level but is expected to be moved away from in the future closes: #6504, #8794, #5356, #5357 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 00:10:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#12820