Skip to content

Commit aad5a79

Browse files
clucraftclaude
andcommitted
Increase Ollama context window to 16K tokens
Default 4K context was truncating the HTML before the model could see it. Added num_ctx: 16384 to all 4 Ollama API calls to ensure the full ~25K character HTML content fits in context. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 57ba90e commit aad5a79

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

backend/src/services/ai-extractor.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ async function extractWithOllama(
293293
],
294294
stream: false,
295295
think: false, // Disable thinking mode for Qwen3/DeepSeek models
296+
options: {
297+
num_ctx: 16384, // Increase context window for large HTML content
298+
},
296299
},
297300
{
298301
headers: {
@@ -388,6 +391,9 @@ async function verifyWithOllama(
388391
messages: [{ role: 'user', content: prompt }],
389392
stream: false,
390393
think: false, // Disable thinking mode for Qwen3/DeepSeek models
394+
options: {
395+
num_ctx: 16384, // Increase context window for large HTML content
396+
},
391397
},
392398
{
393399
headers: { 'Content-Type': 'application/json' },
@@ -481,6 +487,9 @@ async function verifyStockStatusWithOllama(
481487
messages: [{ role: 'user', content: prompt }],
482488
stream: false,
483489
think: false, // Disable thinking mode for Qwen3/DeepSeek models
490+
options: {
491+
num_ctx: 16384, // Increase context window for large HTML content
492+
},
484493
},
485494
{
486495
headers: { 'Content-Type': 'application/json' },
@@ -937,6 +946,9 @@ async function arbitrateWithOllama(
937946
messages: [{ role: 'user', content: prompt }],
938947
stream: false,
939948
think: false, // Disable thinking mode for Qwen3/DeepSeek models
949+
options: {
950+
num_ctx: 16384, // Increase context window for large HTML content
951+
},
940952
},
941953
{
942954
headers: { 'Content-Type': 'application/json' },

0 commit comments

Comments
 (0)