chore: "fix: ai_gateway/models/litellm.py has 23 mypy errors"
What does this merge request do and why?
Address the 19 mypy erros in ai_gateway/models/litellm.py Resolved the below 19 my errors
ai_gateway/models/litellm.py:199: error: Argument 6 of "generate" is incompatible with supertype "ai_gateway.models.base_chat.ChatModelBase"; supertype defines the argument type as "int" [override]
ai_gateway/models/litellm.py:285: error: Item "None" of "dict[Any, Any] | None" has no attribute "get" [union-attr]
ai_gateway/models/litellm.py:288: error: Item "None" of "dict[Any, Any] | None" has no attribute "get" [union-attr]
ai_gateway/models/litellm.py:290: error: Argument 1 to "_get_fireworks_config" has incompatible type "dict[Any, Any] | None"; expected "dict[Any, Any]" [arg-type]
ai_gateway/models/litellm.py:300: error: Argument "engine" to "ModelMetadata" has incompatible type "KindModelProvider | None"; expected "str" [arg-type]
ai_gateway/models/litellm.py:346: error: "object" has no attribute "get" [attr-defined]
ai_gateway/models/litellm.py:346: error: Argument 1 to "get" of "dict" has incompatible type "KindModelProvider | None"; expected "KindModelProvider" [arg-type]
ai_gateway/models/litellm.py:348: error: Signature of "generate" incompatible with supertype "ai_gateway.models.base_text.TextGenModelBase" [override]
ai_gateway/models/litellm.py:379: error: Argument 1 to "_handle_stream" of "LiteLlmTextGenModel" has incompatible type "ModelResponse | CustomStreamWrapper"; expected "CustomStreamWrapper" [arg-type]
ai_gateway/models/litellm.py:388: error: Item "CustomStreamWrapper" of "ModelResponse | CustomStreamWrapper" has no attribute "choices" [union-attr]
ai_gateway/models/litellm.py:388: error: Item "ChoiceLogprobs" of "ChoiceLogprobs | Any" has no attribute "token_logprobs" [union-attr]
ai_gateway/models/litellm.py:523: error: Item "None" of "dict[Any, Any] | None" has no attribute "get" [union-attr]
ai_gateway/models/litellm.py:526: error: Item "None" of "dict[Any, Any] | None" has no attribute "get" [union-attr]
ai_gateway/models/litellm.py:531: error: Argument 1 to "_get_fireworks_config" has incompatible type "dict[Any, Any] | None"; expected "dict[Any, Any]" [arg-type]
ai_gateway/models/litellm.py:538: error: Incompatible types in assignment (expression has type "KindLiteLlmModel", variable has type "KindVertexTextModel") [assignment]
ai_gateway/models/litellm.py:544: error: Item "None" of "KindModelProvider | None" has no attribute "value" [union-attr]
ai_gateway/models/litellm.py:551: error: Argument "model_name" to "LiteLlmTextGenModel" has incompatible type "KindVertexTextModel"; expected "KindLiteLlmModel" [arg-type]
ai_gateway/models/litellm.py:608: error: Item "None" of "KindModelProvider | None" has no attribute "value" [union-attr]
ai_gateway/models/litellm.py:608: error: "str" not callable [operator]
Found 19 errors in 1 file (checked 765 source files)
How to set up and validate locally
- Check out to this merge request's branch.
- In a terminal session run
make lintand verify there are no mypy errors in the output.
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed. -
If this change requires executor implementation: verified that issues/MRs exist for both Go executor and Node executor or confirmed that changes are backward-compatible and don't break existing executor functionality.
Closes #872