fix: add missing o1-series and Ollama models to context window table (#250)

Models not in the lookup table fall through to a 200k default, causing
auto-compact to never trigger for models with smaller actual context
windows. Users hit hard context_window_exceeded errors instead.

Added to both context window and max output token tables:
- o1, o1-mini, o1-preview, o1-pro (OpenAI reasoning models)
- llama3.2:1b, qwen3:8b, codestral (common Ollama models)

Relates to #248
This commit is contained in:
Juan Camilo Auriti
2026-04-06 00:39:24 +02:00
committed by GitHub
parent 3b9893b586
commit 60d3d8961a

View File

@@ -23,9 +23,13 @@ const OPENAI_CONTEXT_WINDOWS: Record<string, number> = {
'gpt-4.1-nano': 1_047_576, 'gpt-4.1-nano': 1_047_576,
'gpt-4-turbo': 128_000, 'gpt-4-turbo': 128_000,
'gpt-4': 8_192, 'gpt-4': 8_192,
'o1': 200_000,
'o1-mini': 128_000,
'o1-preview': 128_000,
'o1-pro': 200_000,
'o3': 200_000,
'o3-mini': 200_000, 'o3-mini': 200_000,
'o4-mini': 200_000, 'o4-mini': 200_000,
'o3': 200_000,
// DeepSeek (V3: 128k context per official docs) // DeepSeek (V3: 128k context per official docs)
'deepseek-chat': 128_000, 'deepseek-chat': 128_000,
@@ -63,6 +67,9 @@ const OPENAI_CONTEXT_WINDOWS: Record<string, number> = {
'phi4:14b': 16_384, 'phi4:14b': 16_384,
'gemma2:27b': 8_192, 'gemma2:27b': 8_192,
'codellama:13b': 16_384, 'codellama:13b': 16_384,
'llama3.2:1b': 128_000,
'qwen3:8b': 128_000,
'codestral': 32_768,
} }
/** /**
@@ -82,9 +89,13 @@ const OPENAI_MAX_OUTPUT_TOKENS: Record<string, number> = {
'gpt-4.1-nano': 32_768, 'gpt-4.1-nano': 32_768,
'gpt-4-turbo': 4_096, 'gpt-4-turbo': 4_096,
'gpt-4': 4_096, 'gpt-4': 4_096,
'o1': 100_000,
'o1-mini': 65_536,
'o1-preview': 32_768,
'o1-pro': 100_000,
'o3': 100_000,
'o3-mini': 100_000, 'o3-mini': 100_000,
'o4-mini': 100_000, 'o4-mini': 100_000,
'o3': 100_000,
// DeepSeek // DeepSeek
'deepseek-chat': 8_192, 'deepseek-chat': 8_192,
@@ -120,6 +131,9 @@ const OPENAI_MAX_OUTPUT_TOKENS: Record<string, number> = {
'phi4:14b': 4_096, 'phi4:14b': 4_096,
'gemma2:27b': 4_096, 'gemma2:27b': 4_096,
'codellama:13b': 4_096, 'codellama:13b': 4_096,
'llama3.2:1b': 4_096,
'qwen3:8b': 8_192,
'codestral': 8_192,
} }
function lookupByModel<T>(table: Record<string, T>, model: string): T | undefined { function lookupByModel<T>(table: Record<string, T>, model: string): T | undefined {