diff --git a/litellm/main.py b/litellm/main.py index 9f5e0ac8db..a7b5f960bc 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -730,7 +730,7 @@ def mock_completion( messages: List, stream: Optional[bool] = False, n: Optional[int] = None, - mock_response: MOCK_RESPONSE_TYPE = "This is a mock request", + mock_response: Optional[MOCK_RESPONSE_TYPE] = "This is a mock request", mock_tool_calls: Optional[List] = None, mock_timeout: Optional[bool] = False, logging=None, @@ -1439,13 +1439,13 @@ def completion( # type: ignore # noqa: PLR0915 api_key or litellm.api_key or litellm.azure_key - or get_secret("AZURE_OPENAI_API_KEY") - or get_secret("AZURE_API_KEY") + or get_secret_str("AZURE_OPENAI_API_KEY") + or get_secret_str("AZURE_API_KEY") ) azure_ad_token = optional_params.get("extra_body", {}).pop( "azure_ad_token", None - ) or get_secret("AZURE_AD_TOKEN") + ) or get_secret_str("AZURE_AD_TOKEN") azure_ad_token_provider = litellm_params.get( "azure_ad_token_provider", None diff --git a/tests/test_litellm/log.txt b/tests/test_litellm/log.txt index 68ad60b5d2..f22dfd1ff4 100644 --- a/tests/test_litellm/log.txt +++ b/tests/test_litellm/log.txt @@ -1,92 +1,10 @@ -main.py:1373: error: Argument "mock_response" to "mock_completion" has incompatible type "Any | None"; expected "str | Exception | dict[Any, Any]" [arg-type] -main.py:1505: error: Argument "azure_ad_token_provider" to "completion" of "AzureChatCompletion" has incompatible type "Any | None"; expected "Callable[..., Any]" [arg-type] -main.py:1511: error: Argument "logging_obj" to "completion" of "AzureChatCompletion" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:1519: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:1592: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:1612: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:1614: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:1627: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:1659: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:1661: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:1673: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:1683: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:1754: error: Argument "logging_obj" to "completion" of "OpenAITextCompletion" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:1773: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:1789: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:1791: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:1804: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:1819: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:1821: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:1833: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:1850: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:1852: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:1865: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:1913: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:1945: error: Argument "logging_obj" to "completion" of "BaseLLMAIOHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:1978: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:1991: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:2068: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:2103: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:2113: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:2136: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:2190: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:2234: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:2280: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:2334: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:2380: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:2466: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:2515: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:2517: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:2533: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:2535: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:2560: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:2619: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:2628: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:2633: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:2643: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:2657: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:2659: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:2729: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:2733: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:2792: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:2796: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:2856: error: Argument "custom_llm_provider" to "completion" of "VertexLLM" has incompatible type "str"; expected "Literal['vertex_ai', 'vertex_ai_beta', 'gemini']" [arg-type] -main.py:2925: error: Argument "custom_llm_provider" to "completion" of "VertexLLM" has incompatible type "str"; expected "Literal['vertex_ai', 'vertex_ai_beta', 'gemini']" [arg-type] -main.py:3081: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:3090: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:3153: error: Argument "logging_obj" to "completion" of "BedrockConverseLLM" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:3168: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:3177: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:3186: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:3195: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:3206: error: Argument "api_base" to "completion" of "WatsonXChatHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:3269: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | Any | None"; expected "str" [arg-type] -main.py:3279: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:3333: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:3367: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:3378: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:3388: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:3421: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:3464: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:3466: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:3479: error: Item "None" of "Any | None" has no attribute "post_call" [union-attr] -main.py:3493: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:3503: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:3520: error: Argument "api_base" to "completion" of "BaseLLMHTTPHandler" has incompatible type "str | None"; expected "str" [arg-type] -main.py:3522: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:3558: error: Argument "logging_obj" to "completion" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:4200: error: Argument "aembedding" to "embedding" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "bool" [arg-type] -main.py:4261: error: Argument "aembedding" to "embedding" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "bool" [arg-type] -main.py:4501: error: Argument "aembedding" to "embedding" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "bool" [arg-type] -main.py:4516: error: Argument "aembedding" to "embedding" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "bool" [arg-type] -main.py:4531: error: Argument "aembedding" to "embedding" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "bool" [arg-type] -main.py:4557: error: Argument "aembedding" to "embedding" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "bool" [arg-type] -main.py:4628: error: Argument "aembedding" to "embedding" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "bool" [arg-type] -main.py:4657: error: Argument "aembedding" to "embedding" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "bool" [arg-type] -main.py:4679: error: Argument "aembedding" to "embedding" of "BaseLLMHTTPHandler" has incompatible type "Any | None"; expected "bool" [arg-type] -main.py:5611: error: Item "None" of "Any | None" has no attribute "update_environment_variables" [union-attr] -main.py:5766: error: Argument "logging_obj" to "speech" of "SpeechToCompletionBridgeHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] -main.py:5795: error: Argument "logging_obj" to "speech" of "SpeechToCompletionBridgeHandler" has incompatible type "Any | None"; expected "Logging" [arg-type] +main.py:1377: error: Argument "mock_response" to "mock_completion" has incompatible type "str | Exception | dict[Any, Any] | None"; expected "str | Exception | dict[Any, Any]" [arg-type] +main.py:1509: error: Argument "azure_ad_token_provider" to "completion" of "AzureChatCompletion" has incompatible type "Any | None"; expected "Callable[..., Any]" [arg-type] +main.py:1580: error: Argument "api_base" to "completion" of "AzureTextCompletion" has incompatible type "str | None"; expected "str" [arg-type] +main.py:1581: error: Argument "api_version" to "completion" of "AzureTextCompletion" has incompatible type "str | None"; expected "str" [arg-type] +main.py:2862: error: Argument "custom_llm_provider" to "completion" of "VertexLLM" has incompatible type "str"; expected "Literal['vertex_ai', 'vertex_ai_beta', 'gemini']" [arg-type] +main.py:2931: error: Argument "custom_llm_provider" to "completion" of "VertexLLM" has incompatible type "str"; expected "Literal['vertex_ai', 'vertex_ai_beta', 'gemini']" [arg-type] +main.py:3212: error: Argument "api_base" to "completion" of "WatsonXChatHandler" has incompatible type "str | None"; expected "str" [arg-type] litellm_core_utils/streaming_handler.py:1374: error: Item "None" of "Any | None" has no attribute "id" [union-attr] litellm_core_utils/streaming_handler.py:1379: error: Argument 1 to "copy_model_response_level_provider_specific_fields" of "CustomStreamWrapper" has incompatible type "Any | None"; expected "ModelResponseStream | ChatCompletionChunk" [arg-type] litellm_core_utils/streaming_handler.py:1382: error: Item "None" of "Any | None" has no attribute "choices" [union-attr] @@ -105,8 +23,6 @@ proxy/hooks/parallel_request_limiter_v3.py:383: error: Item "None" of "RateLimit proxy/hooks/parallel_request_limiter_v3.py:384: error: Item "None" of "RateLimitDescriptorRateLimitObject | None" has no attribute "get" [union-attr] proxy/hooks/parallel_request_limiter_v3.py:385: error: Item "None" of "RateLimitDescriptorRateLimitObject | None" has no attribute "get" [union-attr] proxy/hooks/parallel_request_limiter_v3.py:386: error: Item "None" of "RateLimitDescriptorRateLimitObject | None" has no attribute "get" [union-attr] -proxy/management_helpers/utils.py:39: error: Incompatible types (expression has type "Any | None", TypedDict item "models" has type "list[str]") [typeddict-item] proxy/management_helpers/team_member_permission_checks.py:174: error: "str" has no attribute "value" [attr-defined] -proxy/pass_through_endpoints/pass_through_endpoints.py:501: error: Unsupported type "dict[str, Any]" for ** expansion in TypedDict [typeddict-item] proxy/management_endpoints/ui_sso.py:895: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "provider" [union-attr] -proxy/enterprise/litellm_enterprise/integrations/prometheus.py:2265: error: Incompatible types in assignment (expression has type "Any | None", variable has type "dict[Any, Any]") [assignment] \ No newline at end of file +Found 27 errors in 5 files (checked 1114 source files)