Increase Ollama context window to 16k tokens
Ollama defaults to 2048 tokens which is far too small for page context data + 15 tool definitions + conversation history. Added num_ctx=16384 via the options field on all Ollama requests. With Qwen at ~4GB and 7GB VRAM free this fits comfortably. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -198,7 +198,8 @@ public class ChatService : IChatService
|
||||
Model = modelName,
|
||||
Messages = ollamaMessages,
|
||||
Stream = false,
|
||||
Tools = tools
|
||||
Tools = tools,
|
||||
Options = new OllamaRequestOptions { NumCtx = 16384 }
|
||||
};
|
||||
|
||||
var response = await CallOllamaAsync(ollamaUrl, ollamaRequest);
|
||||
@@ -270,7 +271,8 @@ public class ChatService : IChatService
|
||||
Model = modelName,
|
||||
Messages = ollamaMessages,
|
||||
Stream = false,
|
||||
Tools = null // drop tools so the model focuses on the page data
|
||||
Tools = null, // drop tools so the model focuses on the page data
|
||||
Options = new OllamaRequestOptions { NumCtx = 16384 }
|
||||
};
|
||||
var retryResponse = await CallOllamaAsync(ollamaUrl, retryRequest);
|
||||
rawContent = retryResponse?.Message?.Content;
|
||||
|
||||
Reference in New Issue
Block a user