From 37cbe6c488b3f3a1f45deeaf0aca0f550a4fc26b Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sun, 26 Jan 2025 18:49:21 -0800 Subject: [PATCH] feat: add Ollama context window size warning with documentation link --- aider/coders/base_coder.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index 6d0f33c57..b99feb438 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -1244,6 +1244,17 @@ class Coder: self.io.tool_error("- Use /drop to remove unneeded files from the chat") self.io.tool_error("- Use /clear to clear the chat history") self.io.tool_error("- Break your code into smaller files") + + # Special warning for Ollama models about context window size + if self.main_model.name.startswith(("ollama/", "ollama_chat/")): + num_ctx = self.main_model.extra_params.get("num_ctx") + if num_ctx: + self.io.tool_error( + f"\nNote: Your Ollama model is configured with num_ctx={num_ctx}." + f" See https://aider.chat/docs/llms/ollama.html#setting-the-context-window-size" + " for help configuring larger context windows." + ) + if not self.io.confirm_ask("Try to proceed anyway?", default="n"): return False return True