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:
@@ -75,7 +75,7 @@ class LLMGatewayError(Exception):
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
"""Convert error to dictionary for JSON response."""
|
||||
result = {
|
||||
result: dict[str, Any] = {
|
||||
"error": self.code.value,
|
||||
"message": self.message,
|
||||
}
|
||||
@@ -164,9 +164,7 @@ class RateLimitError(LLMGatewayError):
|
||||
error_details["retry_after_seconds"] = retry_after
|
||||
|
||||
code = (
|
||||
ErrorCode.PROVIDER_RATE_LIMIT
|
||||
if provider
|
||||
else ErrorCode.RATE_LIMIT_EXCEEDED
|
||||
ErrorCode.PROVIDER_RATE_LIMIT if provider else ErrorCode.RATE_LIMIT_EXCEEDED
|
||||
)
|
||||
|
||||
super().__init__(
|
||||
|
||||
Reference in New Issue
Block a user