fix(llm-gateway): improve type safety and datetime consistency

- Add type annotations for mypy compliance
- Use UTC-aware datetimes consistently (datetime.now(UTC))
- Add type: ignore comments for LiteLLM incomplete stubs
- Fix import ordering and formatting
- Update pyproject.toml mypy configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-03 20:56:05 +01:00
parent 6e8b0b022a
commit f482559e15
15 changed files with 111 additions and 105 deletions

View File

@@ -36,6 +36,7 @@ def test_client(test_settings: Settings) -> TestClient:
mock_provider.return_value.get_available_models.return_value = {}
from server import app
return TestClient(app)
@@ -243,7 +244,9 @@ class TestListModelsTool:
"""Test listing models by group."""
with patch("server.get_model_router") as mock_router:
mock_router.return_value = MagicMock()
mock_router.return_value.parse_model_group.return_value = ModelGroup.REASONING
mock_router.return_value.parse_model_group.return_value = (
ModelGroup.REASONING
)
mock_router.return_value.get_available_models_for_group = AsyncMock(
return_value=[]
)
@@ -340,9 +343,7 @@ class TestChatCompletionTool:
"arguments": {
"project_id": "proj-123",
"agent_id": "agent-456",
"messages": [
{"role": "user", "content": "Hello"}
],
"messages": [{"role": "user", "content": "Hello"}],
"stream": True,
},
},
@@ -388,7 +389,9 @@ class TestChatCompletionTool:
mock_circuit = MagicMock()
mock_circuit.record_success = AsyncMock()
mock_reg.return_value = MagicMock()
mock_reg.return_value.get_circuit_sync.return_value = mock_circuit
mock_reg.return_value.get_circuit_sync.return_value = (
mock_circuit
)
response = test_client.post(
"/mcp",