-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: do not override Ollama model num_ctx configuration #7160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,7 +181,7 @@ export class NativeOllamaHandler extends BaseProvider implements SingleCompletio | |
| messages: ollamaMessages, | ||
| stream: true, | ||
| options: { | ||
| num_ctx: modelInfo.contextWindow, | ||
| // Don't override num_ctx - let Ollama use the model's configured value | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good fix removing the num_ctx override. However, could we consider adding documentation about how the Ollama context configuration works with this handler? It might help future developers understand why we're not setting this value explicitly. |
||
| temperature: this.options.modelTemperature ?? (useR1Format ? DEEP_SEEK_DEFAULT_TEMPERATURE : 0), | ||
| }, | ||
| }) | ||
|
|
@@ -270,6 +270,7 @@ export class NativeOllamaHandler extends BaseProvider implements SingleCompletio | |
| messages: [{ role: "user", content: prompt }], | ||
| stream: false, | ||
| options: { | ||
| // Don't override num_ctx - let Ollama use the model's configured value | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These comments are identical in both methods. Is this intentional? We could consider extracting this behavior note to a class-level comment or constant to avoid duplication and make it clear this is a deliberate pattern across all Ollama API calls. |
||
| temperature: this.options.modelTemperature ?? (useR1Format ? DEEP_SEEK_DEFAULT_TEMPERATURE : 0), | ||
| }, | ||
| }) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test coverage for verifying num_ctx isn't set! Could we also add an integration test that verifies the handler works correctly when Ollama models have different configured context sizes? This would help catch any future regressions.