diff --git a/litellm/llms/azure/azure.py b/litellm/llms/azure/azure.py index 5ee9065f5e..3645c16bf8 100644 --- a/litellm/llms/azure/azure.py +++ b/litellm/llms/azure/azure.py @@ -182,12 +182,12 @@ class AzureChatCompletion(BaseAzureLLM, BaseLLM): model: str, messages: list, model_response: ModelResponse, - api_key: str, + api_key: Optional[str], api_base: str, api_version: str, api_type: str, - azure_ad_token: str, - azure_ad_token_provider: Callable, + azure_ad_token: Optional[str], + azure_ad_token_provider: Optional[Callable], dynamic_params: bool, print_verbose: Callable, timeout: Union[float, httpx.Timeout], @@ -372,7 +372,7 @@ class AzureChatCompletion(BaseAzureLLM, BaseLLM): async def acompletion( self, - api_key: str, + api_key: Optional[str], api_version: str, model: str, api_base: str, @@ -477,7 +477,7 @@ class AzureChatCompletion(BaseAzureLLM, BaseLLM): self, logging_obj, api_base: str, - api_key: str, + api_key: Optional[str], api_version: str, dynamic_params: bool, data: dict, @@ -555,7 +555,7 @@ class AzureChatCompletion(BaseAzureLLM, BaseLLM): self, logging_obj: LiteLLMLoggingObj, api_base: str, - api_key: str, + api_key: Optional[str], api_version: str, dynamic_params: bool, data: dict, diff --git a/litellm/llms/azure/common_utils.py b/litellm/llms/azure/common_utils.py index 09b1888e04..04448681b6 100644 --- a/litellm/llms/azure/common_utils.py +++ b/litellm/llms/azure/common_utils.py @@ -162,8 +162,8 @@ def get_azure_ad_token_from_username_password( def get_azure_ad_token_from_oidc( azure_ad_token: str, - azure_client_id: Optional[str], - azure_tenant_id: Optional[str], + azure_client_id: Optional[str] = None, + azure_tenant_id: Optional[str] = None, scope: Optional[str] = None, ) -> str: """ diff --git a/litellm/llms/azure/completion/handler.py b/litellm/llms/azure/completion/handler.py index a44f904571..49f157495e 100644 --- a/litellm/llms/azure/completion/handler.py +++ b/litellm/llms/azure/completion/handler.py @@ -30,11 +30,11 @@ class AzureTextCompletion(BaseAzureLLM): model: str, messages: list, model_response: ModelResponse, - api_key: str, + api_key: Optional[str], api_base: str, api_version: str, api_type: str, - azure_ad_token: str, + azure_ad_token: Optional[str], azure_ad_token_provider: Optional[Callable], print_verbose: Callable, timeout, @@ -196,7 +196,7 @@ class AzureTextCompletion(BaseAzureLLM): async def acompletion( self, - api_key: str, + api_key: Optional[str], api_version: str, model: str, api_base: str, @@ -263,7 +263,7 @@ class AzureTextCompletion(BaseAzureLLM): self, logging_obj, api_base: str, - api_key: str, + api_key: Optional[str], api_version: str, data: dict, model: str, @@ -320,7 +320,7 @@ class AzureTextCompletion(BaseAzureLLM): self, logging_obj, api_base: str, - api_key: str, + api_key: Optional[str], api_version: str, data: dict, model: str, diff --git a/litellm/proxy/hooks/parallel_request_limiter_v3.py b/litellm/proxy/hooks/parallel_request_limiter_v3.py index 86d61b7c4d..af6f77b3c3 100644 --- a/litellm/proxy/hooks/parallel_request_limiter_v3.py +++ b/litellm/proxy/hooks/parallel_request_limiter_v3.py @@ -377,7 +377,7 @@ class _PROXY_MaxParallelRequestsHandler_v3(CustomLogger): for descriptor in descriptors: descriptor_key = descriptor["key"] descriptor_value = descriptor["value"] - rate_limit: Optional[RateLimitDescriptorRateLimitObject] = ( + rate_limit: RateLimitDescriptorRateLimitObject = ( descriptor.get("rate_limit") or RateLimitDescriptorRateLimitObject() ) requests_limit = rate_limit.get("requests_per_unit") diff --git a/tests/test_litellm/log.txt b/tests/test_litellm/log.txt index f22dfd1ff4..84fcbd137d 100644 --- a/tests/test_litellm/log.txt +++ b/tests/test_litellm/log.txt @@ -1,28 +1,10 @@ -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:1503: error: Argument "api_key" to "completion" of "AzureChatCompletion" has incompatible type "str | None"; expected "str" [arg-type] +main.py:1508: error: Argument "azure_ad_token" to "completion" of "AzureChatCompletion" has incompatible type "Any | str | None"; expected "str" [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:1579: error: Argument "api_key" to "completion" of "AzureTextCompletion" has incompatible type "str | None"; expected "str" [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] -litellm_core_utils/streaming_handler.py:1383: error: Item "None" of "Any | None" has no attribute "choices" [union-attr] -litellm_core_utils/streaming_handler.py:1389: error: Item "None" of "Any | None" has no attribute "system_fingerprint" [union-attr] -litellm_core_utils/streaming_handler.py:1393: error: Item "None" of "Any | None" has no attribute "choices" [union-attr] -litellm_core_utils/streaming_handler.py:1398: error: Item "None" of "Any | None" has no attribute "choices" [union-attr] -litellm_core_utils/streaming_handler.py:1403: error: Item "None" of "Any | None" has no attribute "choices" [union-attr] -litellm_core_utils/streaming_handler.py:1406: error: Item "None" of "Any | None" has no attribute "choices" [union-attr] -litellm_core_utils/streaming_handler.py:1408: error: Item "None" of "Any | None" has no attribute "choices" [union-attr] -litellm_core_utils/streaming_handler.py:1410: error: Item "None" of "Any | None" has no attribute "choices" [union-attr] -litellm_core_utils/streaming_handler.py:1454: error: Item "None" of "Any | None" has no attribute "choices" [union-attr] -litellm_core_utils/streaming_handler.py:1455: error: Item "None" of "Any | None" has no attribute "choices" [union-attr] -proxy/hooks/parallel_request_limiter_v3.py:381: error: Incompatible types in assignment (expression has type "RateLimitDescriptorRateLimitObject | dict[Never, Never]", variable has type "RateLimitDescriptorRateLimitObject | None") [assignment] +main.py:1583: error: Argument "azure_ad_token" to "completion" of "AzureTextCompletion" has incompatible type "Any | str | None"; expected "str" [arg-type] proxy/hooks/parallel_request_limiter_v3.py:383: error: Item "None" of "RateLimitDescriptorRateLimitObject | None" has no attribute "get" [union-attr] 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/team_member_permission_checks.py:174: error: "str" has no attribute "value" [attr-defined] -proxy/management_endpoints/ui_sso.py:895: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "provider" [union-attr] -Found 27 errors in 5 files (checked 1114 source files) +proxy/hooks/parallel_request_limiter_v3.py:386: error: Item "None" of "RateLimitDescriptorRateLimitObject | None" has no attribute "get" [union-attr] \ No newline at end of file