Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deeptutor/services/llm/capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
},
"qwen": {
"has_thinking_tags": True,
"supports_vision": True,
},
"qwq": {
"has_thinking_tags": True,
Expand Down
6 changes: 4 additions & 2 deletions deeptutor/services/llm/context_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from typing import Any

DEFAULT_CONTEXT_WINDOW_FALLBACK = 16_384
MAX_EFFECTIVE_CONTEXT_WINDOW = 65_536
MAX_EFFECTIVE_CONTEXT_WINDOW = 1_000_000
LARGE_CONTEXT_MODEL_DEFAULT = 65_536
KNOWN_LARGE_CONTEXT_MARKERS = (
"gpt-4.1",
"gpt-4o",
Expand Down Expand Up @@ -44,7 +45,7 @@ def default_context_window_for_model(
) -> int:
"""Return the fallback window used when no explicit model metadata exists."""
if looks_like_large_context_model(model):
return MAX_EFFECTIVE_CONTEXT_WINDOW
return LARGE_CONTEXT_MODEL_DEFAULT
output_limit = coerce_positive_int(max_tokens) or 4096
return max(DEFAULT_CONTEXT_WINDOW_FALLBACK, output_limit * 4)

Expand All @@ -68,6 +69,7 @@ def resolve_effective_context_window(
__all__ = [
"DEFAULT_CONTEXT_WINDOW_FALLBACK",
"MAX_EFFECTIVE_CONTEXT_WINDOW",
"LARGE_CONTEXT_MODEL_DEFAULT",
"KNOWN_LARGE_CONTEXT_MARKERS",
"coerce_positive_int",
"default_context_window_for_model",
Expand Down
2 changes: 1 addition & 1 deletion tests/services/session/test_context_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _make_llm_config(
def test_history_budget_uses_explicit_context_window(self) -> None:
builder = ContextBuilder(store=MagicMock(), history_budget_ratio=0.35)
budget = builder._history_budget(self._make_llm_config(4096, context_window=128000))
assert budget == int(65536 * 0.35)
assert budget == int(128000 * 0.35)

def test_history_budget_uses_large_context_model_heuristic(self) -> None:
builder = ContextBuilder(store=MagicMock(), history_budget_ratio=0.35)
Expand Down
Loading