Skip to content

Commit 80ec6a5

Browse files
1 parent 95a9d8d commit 80ec6a5

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

pr_agent/algo/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
'gpt-5.2-chat-latest': 128000, # 128K, but may be limited by config.max_model_tokens
4343
'gpt-5.2-codex': 400000, # 400K, but may be limited by config.max_model_tokens
4444
'gpt-5.3-codex': 400000, # 400K, but may be limited by config.max_model_tokens
45+
'gpt-5.4': 272000, # 272K safe default without opt-in 1M context parameters
46+
'gpt-5.4-2026-03-05': 272000, # 272K safe default without opt-in 1M context parameters
4547
'o1-mini': 128000, # 128K, but may be limited by config.max_model_tokens
4648
'o1-mini-2024-09-12': 128000, # 128K, but may be limited by config.max_model_tokens
4749
'o1-preview': 128000, # 128K, but may be limited by config.max_model_tokens

tests/unittest/test_get_max_tokens.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ def test_model_max_tokens(self, monkeypatch):
2222

2323
assert get_max_tokens(model) == expected
2424

25+
@pytest.mark.parametrize("model", ["gpt-5.4", "gpt-5.4-2026-03-05"])
26+
def test_gpt54_model_max_tokens(self, monkeypatch, model):
27+
fake_settings = type('', (), {
28+
'config': type('', (), {
29+
'custom_model_max_tokens': 0,
30+
'max_model_tokens': 0
31+
})()
32+
})()
33+
34+
monkeypatch.setattr(utils, "get_settings", lambda: fake_settings)
35+
36+
assert get_max_tokens(model) == 272000
37+
2538
# Test situations where the model is not registered and exists as a custom model
2639
def test_model_has_custom(self, monkeypatch):
2740
fake_settings = type('', (), {

tests/unittest/test_litellm_reasoning_effort.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,15 @@ async def test_gpt5_model_detection_various_versions(self, monkeypatch, mock_log
307307
fake_settings = create_mock_settings("medium")
308308
monkeypatch.setattr(litellm_handler, "get_settings", lambda: fake_settings)
309309

310-
gpt5_models = ["gpt-5-2025-08-07", "gpt-5.1", "gpt-5-turbo", "gpt-5.1-codex", "gpt-5.3-codex"]
310+
gpt5_models = [
311+
"gpt-5-2025-08-07",
312+
"gpt-5.1",
313+
"gpt-5.4",
314+
"gpt-5.4-2026-03-05",
315+
"gpt-5-turbo",
316+
"gpt-5.1-codex",
317+
"gpt-5.3-codex",
318+
]
311319

312320
for model in gpt5_models:
313321
with patch('pr_agent.algo.ai_handlers.litellm_ai_handler.acompletion', new_callable=AsyncMock) as mock_completion:

0 commit comments

Comments
 (0)