Skip to content

fix(lint): address mypy errors in api/server

What does this merge request do and why?

This addressed mypy errors in api/server.py.

❯ poetry run mypy ai_gateway/api/server.py
ai_gateway/api/server.py:190: error: Argument 2 to "add_exception_handler" of "Starlette" has incompatible type "Callable[[Request, HTTPException], Coroutine[Any, Any, Any]]"; expected "Callable[[Request, Exception], Response | Awaitable[Response]] | Callable[[WebSocket, Exception], Awaitable[None]]"  [arg-type]
ai_gateway/api/server.py:191: error: Argument 2 to "add_exception_handler" of "Starlette" has incompatible type "Callable[[Request, ModelAPIError], Coroutine[Any, Any, Any]]"; expected "Callable[[Request, Exception], Response | Awaitable[Response]] | Callable[[WebSocket, Exception], Awaitable[None]]"  [arg-type]
ai_gateway/api/server.py:192: error: Argument 2 to "add_exception_handler" of "Starlette" has incompatible type "Callable[[Request, RequestValidationError], Coroutine[Any, Any, Any]]"; expected "Callable[[Request, Exception], Response | Awaitable[Response]] | Callable[[WebSocket, Exception], Awaitable[None]]"  [arg-type]
Found 3 errors in 1 file (checked 1 source file)

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Merge request checklist

  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.

Contributes to #715 (closed)

Edited by Tan Le

Merge request reports

Loading