Update stale API endpoints and model chains
- Instagram: migrate /v1/ to /v2/ ScrapeCreators endpoint (v1 deprecated Feb 2026) - OpenAI: switch fallback chain to [gpt-5-mini, gpt-4.1-mini, gpt-4.1] (8x cheaper, gpt-5-mini is the first mini model supporting web_search with filters.allowed_domains) - xAI: use explicit grok-4-1-fast-non-reasoning (bare name aliases to reasoning variant) - xAI: pass from_date/to_date natively to x_search tool config instead of prompt-only - Polymarket: correct rate limit comment (15K/10s, not 350/10s)
This commit is contained in:
@@ -84,7 +84,7 @@ class TestSelectXAIModel(unittest.TestCase):
|
||||
"fake-key",
|
||||
policy="latest"
|
||||
)
|
||||
self.assertEqual(result, "grok-4-1-fast")
|
||||
self.assertEqual(result, "grok-4-1-fast-non-reasoning")
|
||||
|
||||
def test_stable_policy(self):
|
||||
# Clear cache first to avoid interference
|
||||
@@ -94,7 +94,7 @@ class TestSelectXAIModel(unittest.TestCase):
|
||||
"fake-key",
|
||||
policy="stable"
|
||||
)
|
||||
self.assertEqual(result, "grok-4-1-fast")
|
||||
self.assertEqual(result, "grok-4-1-fast-non-reasoning")
|
||||
|
||||
def test_pinned_policy(self):
|
||||
result = models.select_xai_model(
|
||||
@@ -125,10 +125,10 @@ class TestGetModels(unittest.TestCase):
|
||||
"XAI_API_KEY": "xai-test",
|
||||
}
|
||||
mock_openai = [{"id": "gpt-5.2", "created": 1704067200}]
|
||||
mock_xai = [{"id": "grok-4-1-fast", "created": 1704067200}]
|
||||
mock_xai = [{"id": "grok-4-1-fast-non-reasoning", "created": 1704067200}]
|
||||
result = models.get_models(config, mock_openai, mock_xai)
|
||||
self.assertEqual(result["openai"], "gpt-5.2")
|
||||
self.assertEqual(result["xai"], "grok-4-1-fast")
|
||||
self.assertEqual(result["xai"], "grok-4-1-fast-non-reasoning")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -64,13 +64,13 @@ class TestIsModelAccessError(unittest.TestCase):
|
||||
class TestModelFallbackOrder(unittest.TestCase):
|
||||
"""Tests for MODEL_FALLBACK_ORDER constant."""
|
||||
|
||||
def test_contains_gpt4o(self):
|
||||
"""Fallback list should include gpt-4o."""
|
||||
self.assertIn("gpt-4o", MODEL_FALLBACK_ORDER)
|
||||
def test_contains_gpt41(self):
|
||||
"""Fallback list should include gpt-4.1 as last resort."""
|
||||
self.assertIn("gpt-4.1", MODEL_FALLBACK_ORDER)
|
||||
|
||||
def test_gpt41_is_first(self):
|
||||
"""gpt-4.1 should be the first fallback option."""
|
||||
self.assertEqual(MODEL_FALLBACK_ORDER[0], "gpt-4.1")
|
||||
def test_gpt5_mini_is_first(self):
|
||||
"""gpt-5-mini should be the first fallback option (cheapest with web_search support)."""
|
||||
self.assertEqual(MODEL_FALLBACK_ORDER[0], "gpt-5-mini")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user