From fc2d1f264619044a7ee2ca730cad7d74306b3866 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sun, 14 Sep 2025 09:32:21 -0700 Subject: [PATCH] fix: fix import errors --- .../types/proxy/proxy_server.py | 4 +- .../handler.py | 4 +- .../speech_to_completion_bridge/handler.py | 4 +- litellm/integrations/humanloop.py | 3 +- .../integrations/prompt_management_base.py | 4 +- litellm/litellm_core_utils/logging_worker.py | 4 +- .../llms/huggingface/rerank/transformation.py | 3 +- .../text_to_speech/text_to_speech_handler.py | 3 +- .../llms/vertex_ai/vertex_embeddings/types.py | 4 +- ...odel_prices_and_context_window_backup.json | 202 ++++++++++++++++++ .../proxy/hooks/parallel_request_limiter.py | 3 +- .../management_endpoints/scim/scim_v2.py | 3 +- .../assembly_passthrough_logging_handler.py | 3 +- litellm/router_utils/cooldown_cache.py | 4 +- litellm/router_utils/prompt_caching_cache.py | 4 +- litellm/types/caching.py | 3 +- litellm/types/guardrails.py | 4 +- litellm/types/images/main.py | 4 +- .../anthropic_cache_control_hook.py | 4 +- litellm/types/integrations/argilla.py | 4 +- .../types/integrations/base_health_check.py | 4 +- litellm/types/integrations/datadog.py | 4 +- litellm/types/integrations/datadog_llm_obs.py | 4 +- litellm/types/integrations/gcs_bucket.py | 4 +- litellm/types/integrations/langfuse.py | 4 +- litellm/types/integrations/langsmith.py | 3 +- litellm/types/integrations/pagerduty.py | 4 +- .../integrations/rag/bedrock_knowledgebase.py | 4 +- litellm/types/integrations/slack_alerting.py | 3 +- .../streaming_chunk_builder_utils.py | 4 +- .../anthropic_messages/anthropic_response.py | 4 +- litellm/types/llms/bedrock.py | 3 +- litellm/types/llms/bedrock_invoke_agents.py | 4 +- litellm/types/llms/databricks.py | 3 +- litellm/types/llms/mistral.py | 4 +- litellm/types/llms/ollama.py | 3 +- litellm/types/llms/openrouter.py | 4 +- litellm/types/llms/rerank.py | 3 +- litellm/types/llms/watsonx.py | 3 +- .../pass_through_endpoints.py | 4 +- litellm/types/proxy/litellm_pre_call_utils.py | 2 +- .../common_daily_activity.py | 3 +- .../proxy/management_endpoints/ui_sso.py | 3 +- litellm/types/proxy/ui_sso.py | 4 +- litellm/types/realtime.py | 4 +- litellm/utils.py | 2 +- 46 files changed, 315 insertions(+), 47 deletions(-) diff --git a/enterprise/litellm_enterprise/types/proxy/proxy_server.py b/enterprise/litellm_enterprise/types/proxy/proxy_server.py index 497be59c4b9..f1a1f2639ed 100644 --- a/enterprise/litellm_enterprise/types/proxy/proxy_server.py +++ b/enterprise/litellm_enterprise/types/proxy/proxy_server.py @@ -1,4 +1,6 @@ -from typing import Literal, TypedDict +from typing import Literal + +from typing_extensions import TypedDict class CustomAuthSettings(TypedDict): diff --git a/litellm/completion_extras/litellm_responses_transformation/handler.py b/litellm/completion_extras/litellm_responses_transformation/handler.py index f2eeaf04554..6ec49ce0620 100644 --- a/litellm/completion_extras/litellm_responses_transformation/handler.py +++ b/litellm/completion_extras/litellm_responses_transformation/handler.py @@ -2,7 +2,9 @@ Handler for transforming /chat/completions api requests to litellm.responses requests """ -from typing import TYPE_CHECKING, Any, Coroutine, TypedDict, Union +from typing import TYPE_CHECKING, Any, Coroutine, Union + +from typing_extensions import TypedDict if TYPE_CHECKING: from litellm import CustomStreamWrapper, LiteLLMLoggingObj, ModelResponse diff --git a/litellm/endpoints/speech/speech_to_completion_bridge/handler.py b/litellm/endpoints/speech/speech_to_completion_bridge/handler.py index 3035c5065c5..13af0a30fe0 100644 --- a/litellm/endpoints/speech/speech_to_completion_bridge/handler.py +++ b/litellm/endpoints/speech/speech_to_completion_bridge/handler.py @@ -2,7 +2,9 @@ Handler for transforming /chat/completions api requests to litellm.responses requests """ -from typing import TYPE_CHECKING, Optional, TypedDict, Union +from typing import TYPE_CHECKING, Optional, Union + +from typing_extensions import TypedDict if TYPE_CHECKING: from litellm import LiteLLMLoggingObj diff --git a/litellm/integrations/humanloop.py b/litellm/integrations/humanloop.py index 9f43d806266..8e60d3736e0 100644 --- a/litellm/integrations/humanloop.py +++ b/litellm/integrations/humanloop.py @@ -4,9 +4,10 @@ Humanloop integration https://humanloop.com/ """ -from typing import Any, Dict, List, Optional, Tuple, TypedDict, Union, cast +from typing import Any, Dict, List, Optional, Tuple, Union, cast import httpx +from typing_extensions import TypedDict import litellm from litellm.caching import DualCache diff --git a/litellm/integrations/prompt_management_base.py b/litellm/integrations/prompt_management_base.py index 34b4455f564..7754ca435ca 100644 --- a/litellm/integrations/prompt_management_base.py +++ b/litellm/integrations/prompt_management_base.py @@ -1,5 +1,7 @@ from abc import ABC, abstractmethod -from typing import Any, Dict, List, Optional, Tuple, TypedDict +from typing import Any, Dict, List, Optional, Tuple + +from typing_extensions import TypedDict from litellm.types.llms.openai import AllMessageValues from litellm.types.utils import StandardCallbackDynamicParams diff --git a/litellm/litellm_core_utils/logging_worker.py b/litellm/litellm_core_utils/logging_worker.py index 16860ad6852..3c475f133a8 100644 --- a/litellm/litellm_core_utils/logging_worker.py +++ b/litellm/litellm_core_utils/logging_worker.py @@ -1,7 +1,9 @@ import asyncio import contextlib import contextvars -from typing import Coroutine, Optional, TypedDict +from typing import Coroutine, Optional + +from typing_extensions import TypedDict from litellm._logging import verbose_logger diff --git a/litellm/llms/huggingface/rerank/transformation.py b/litellm/llms/huggingface/rerank/transformation.py index 3f5c44fec05..9c3234c3512 100644 --- a/litellm/llms/huggingface/rerank/transformation.py +++ b/litellm/llms/huggingface/rerank/transformation.py @@ -1,8 +1,9 @@ import os import uuid -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, TypedDict, Union +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import httpx +from typing_extensions import TypedDict import litellm from litellm.llms.base_llm.chat.transformation import BaseLLMException diff --git a/litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py b/litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py index 18bc72db46a..9d9015c2b91 100644 --- a/litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py +++ b/litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py @@ -1,6 +1,7 @@ -from typing import Optional, TypedDict, Union +from typing import Optional, Union import httpx +from typing_extensions import TypedDict import litellm from litellm.llms.custom_httpx.http_handler import ( diff --git a/litellm/llms/vertex_ai/vertex_embeddings/types.py b/litellm/llms/vertex_ai/vertex_embeddings/types.py index c0c53b170c4..7f85ea46f31 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/types.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/types.py @@ -3,7 +3,9 @@ Types for Vertex Embeddings Requests """ from enum import Enum -from typing import List, Optional, TypedDict, Union +from typing import List, Optional, Union + +from typing_extensions import TypedDict class TaskType(str, Enum): diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 46331c7cff7..261fe9552d0 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -20777,5 +20777,207 @@ "metadata": { "notes": "Volcengine Doubao embedding model - text-240715 version with 2560 dimensions" } + }, + "ovhcloud/Qwen2.5-VL-72B-Instruct": { + "max_tokens": 32000, + "max_input_tokens": 32000, + "max_output_tokens": 32000, + "input_cost_per_token": 9.1e-07, + "output_cost_per_token": 9.1e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": false, + "supports_response_schema": true, + "supports_tool_choice": false, + "supports_vision": true, + "source": "https://endpoints.ai.cloud.ovh.net/models/qwen2-5-vl-72b-instruct" + }, + "ovhcloud/llava-v1.6-mistral-7b-hf": { + "max_tokens": 32000, + "max_input_tokens": 32000, + "max_output_tokens": 32000, + "input_cost_per_token": 2.9e-07, + "output_cost_per_token": 2.9e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": false, + "supports_response_schema": true, + "supports_tool_choice": false, + "supports_vision": true, + "source": "https://endpoints.ai.cloud.ovh.net/models/llava-next-mistral-7b" + }, + "ovhcloud/gpt-oss-120b": { + "max_tokens": 131000, + "max_input_tokens": 131000, + "max_output_tokens": 131000, + "input_cost_per_token": 8e-08, + "output_cost_per_token": 4e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": false, + "supports_response_schema": true, + "supports_tool_choice": false, + "supports_reasoning": true, + "source": "https://endpoints.ai.cloud.ovh.net/models/gpt-oss-120b" + }, + "ovhcloud/Meta-Llama-3_3-70B-Instruct": { + "max_tokens": 131000, + "max_input_tokens": 131000, + "max_output_tokens": 131000, + "input_cost_per_token": 6.7e-07, + "output_cost_per_token": 6.7e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "source": "https://endpoints.ai.cloud.ovh.net/models/meta-llama-3-3-70b-instruct" + }, + "ovhcloud/Qwen2.5-Coder-32B-Instruct": { + "max_tokens": 32000, + "max_input_tokens": 32000, + "max_output_tokens": 32000, + "input_cost_per_token": 8.7e-07, + "output_cost_per_token": 8.7e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": false, + "supports_response_schema": true, + "supports_tool_choice": false, + "source": "https://endpoints.ai.cloud.ovh.net/models/qwen2-5-coder-32b-instruct" + }, + "ovhcloud/Mixtral-8x7B-Instruct-v0.1": { + "max_tokens": 32000, + "max_input_tokens": 32000, + "max_output_tokens": 32000, + "input_cost_per_token": 6.3e-07, + "output_cost_per_token": 6.3e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": false, + "supports_response_schema": true, + "supports_tool_choice": false, + "source": "https://endpoints.ai.cloud.ovh.net/models/mixtral-8x7b-instruct-v0-1" + }, + "ovhcloud/Meta-Llama-3_1-70B-Instruct": { + "max_tokens": 131000, + "max_input_tokens": 131000, + "max_output_tokens": 131000, + "input_cost_per_token": 6.7e-07, + "output_cost_per_token": 6.7e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": false, + "supports_response_schema": false, + "supports_tool_choice": false, + "source": "https://endpoints.ai.cloud.ovh.net/models/meta-llama-3-1-70b-instruct" + }, + "ovhcloud/Mistral-Small-3.2-24B-Instruct-2506": { + "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "input_cost_per_token": 9e-08, + "output_cost_per_token": 2.8e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "source": "https://endpoints.ai.cloud.ovh.net/models/mistral-small-3-2-24b-instruct-2506" + }, + "ovhcloud/DeepSeek-R1-Distill-Llama-70B": { + "max_tokens": 131000, + "max_input_tokens": 131000, + "max_output_tokens": 131000, + "input_cost_per_token": 6.7e-07, + "output_cost_per_token": 6.7e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_reasoning": true, + "source": "https://endpoints.ai.cloud.ovh.net/models/deepseek-r1-distill-llama-70b" + }, + "ovhcloud/Llama-3.1-8B-Instruct": { + "max_tokens": 131000, + "max_input_tokens": 131000, + "max_output_tokens": 131000, + "input_cost_per_token": 1e-07, + "output_cost_per_token": 1e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "source": "https://endpoints.ai.cloud.ovh.net/models/llama-3-1-8b-instruct" + }, + "ovhcloud/Mistral-7B-Instruct-v0.3": { + "max_tokens": 127000, + "max_input_tokens": 127000, + "max_output_tokens": 127000, + "input_cost_per_token": 1e-07, + "output_cost_per_token": 1e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "source": "https://endpoints.ai.cloud.ovh.net/models/mistral-7b-instruct-v0-3" + }, + "ovhcloud/gpt-oss-20b": { + "max_tokens": 131000, + "max_input_tokens": 131000, + "max_output_tokens": 131000, + "input_cost_per_token": 4e-08, + "output_cost_per_token": 1.5e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": false, + "supports_response_schema": true, + "supports_tool_choice": false, + "supports_reasoning": true, + "source": "https://endpoints.ai.cloud.ovh.net/models/gpt-oss-20b" + }, + "ovhcloud/Mistral-Nemo-Instruct-2407": { + "max_tokens": 118000, + "max_input_tokens": 118000, + "max_output_tokens": 118000, + "input_cost_per_token": 1.3e-07, + "output_cost_per_token": 1.3e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "source": "https://endpoints.ai.cloud.ovh.net/models/mistral-nemo-instruct-2407" + }, + "ovhcloud/Qwen3-32B": { + "max_tokens": 32000, + "max_input_tokens": 32000, + "max_output_tokens": 32000, + "input_cost_per_token": 8e-08, + "output_cost_per_token": 2.3e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_reasoning": true, + "source": "https://endpoints.ai.cloud.ovh.net/models/qwen3-32b" + }, + "ovhcloud/mamba-codestral-7B-v0.1": { + "max_tokens": 256000, + "max_input_tokens": 256000, + "max_output_tokens": 256000, + "input_cost_per_token": 1.9e-07, + "output_cost_per_token": 1.9e-07, + "litellm_provider": "ovhcloud", + "mode": "chat", + "supports_function_calling": false, + "supports_response_schema": true, + "supports_tool_choice": false, + "source": "https://endpoints.ai.cloud.ovh.net/models/mamba-codestral-7b-v0-1" } } diff --git a/litellm/proxy/hooks/parallel_request_limiter.py b/litellm/proxy/hooks/parallel_request_limiter.py index 242c013d677..c7bfc27d6b6 100644 --- a/litellm/proxy/hooks/parallel_request_limiter.py +++ b/litellm/proxy/hooks/parallel_request_limiter.py @@ -1,10 +1,11 @@ import asyncio import sys from datetime import datetime, timedelta -from typing import TYPE_CHECKING, Any, List, Literal, Optional, Tuple, TypedDict, Union +from typing import TYPE_CHECKING, Any, List, Literal, Optional, Tuple, Union from fastapi import HTTPException from pydantic import BaseModel +from typing_extensions import TypedDict import litellm from litellm import DualCache, ModelResponse diff --git a/litellm/proxy/management_endpoints/scim/scim_v2.py b/litellm/proxy/management_endpoints/scim/scim_v2.py index b9929c3b433..f84b4df42d0 100644 --- a/litellm/proxy/management_endpoints/scim/scim_v2.py +++ b/litellm/proxy/management_endpoints/scim/scim_v2.py @@ -5,7 +5,7 @@ This is an enterprise feature and requires a premium license. """ import uuid -from typing import Any, Dict, List, Optional, Set, Tuple, TypedDict +from typing import Any, Dict, List, Optional, Set, Tuple from fastapi import ( APIRouter, @@ -17,6 +17,7 @@ from fastapi import ( Request, Response, ) +from typing_extensions import TypedDict import litellm from litellm._logging import verbose_proxy_logger diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/assembly_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/assembly_passthrough_logging_handler.py index 1acaf5f3614..a8c5562d4d6 100644 --- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/assembly_passthrough_logging_handler.py +++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/assembly_passthrough_logging_handler.py @@ -2,10 +2,11 @@ import asyncio import json import time from datetime import datetime -from typing import Literal, Optional, TypedDict +from typing import Literal, Optional from urllib.parse import urlparse import httpx +from typing_extensions import TypedDict import litellm from litellm._logging import verbose_proxy_logger diff --git a/litellm/router_utils/cooldown_cache.py b/litellm/router_utils/cooldown_cache.py index 0a199d4b757..aba8bfd72f1 100644 --- a/litellm/router_utils/cooldown_cache.py +++ b/litellm/router_utils/cooldown_cache.py @@ -3,7 +3,9 @@ Wrapper around router cache. Meant to handle model cooldown logic """ import time -from typing import TYPE_CHECKING, Any, List, Optional, Tuple, TypedDict, Union +from typing import TYPE_CHECKING, Any, List, Optional, Tuple, Union + +from typing_extensions import TypedDict from litellm import verbose_logger from litellm.caching.caching import DualCache diff --git a/litellm/router_utils/prompt_caching_cache.py b/litellm/router_utils/prompt_caching_cache.py index 6a96b85e8af..e9637f28605 100644 --- a/litellm/router_utils/prompt_caching_cache.py +++ b/litellm/router_utils/prompt_caching_cache.py @@ -4,7 +4,9 @@ Wrapper around router cache. Meant to store model id when prompt caching support import hashlib import json -from typing import TYPE_CHECKING, Any, List, Optional, TypedDict, Union +from typing import TYPE_CHECKING, Any, List, Optional, Union + +from typing_extensions import TypedDict from litellm.caching.caching import DualCache from litellm.caching.in_memory_cache import InMemoryCache diff --git a/litellm/types/caching.py b/litellm/types/caching.py index 67b0238ce8a..bb4ea416b87 100644 --- a/litellm/types/caching.py +++ b/litellm/types/caching.py @@ -1,7 +1,8 @@ from enum import Enum -from typing import Any, Dict, List, Literal, Optional, TypedDict, Union +from typing import Any, Dict, List, Literal, Optional, Union from pydantic import BaseModel +from typing_extensions import TypedDict class LiteLLMCacheType(str, Enum): diff --git a/litellm/types/guardrails.py b/litellm/types/guardrails.py index d257e316d7c..e5ea89325eb 100644 --- a/litellm/types/guardrails.py +++ b/litellm/types/guardrails.py @@ -1,9 +1,9 @@ from datetime import datetime from enum import Enum -from typing import Any, Dict, List, Literal, Optional, TypedDict, Union +from typing import Any, Dict, List, Literal, Optional, Union from pydantic import BaseModel, ConfigDict, Field -from typing_extensions import Required +from typing_extensions import Required, TypedDict """ Pydantic object defining how to set guardrails on litellm proxy diff --git a/litellm/types/images/main.py b/litellm/types/images/main.py index 1e7466f4e83..3002f9bffb4 100644 --- a/litellm/types/images/main.py +++ b/litellm/types/images/main.py @@ -1,4 +1,6 @@ -from typing import Any, Dict, List, Literal, Optional, TypedDict, Union +from typing import Any, Dict, List, Literal, Optional, Union + +from typing_extensions import TypedDict from litellm.types.utils import FileTypes diff --git a/litellm/types/integrations/anthropic_cache_control_hook.py b/litellm/types/integrations/anthropic_cache_control_hook.py index 88f22ac1b71..6e859f10187 100644 --- a/litellm/types/integrations/anthropic_cache_control_hook.py +++ b/litellm/types/integrations/anthropic_cache_control_hook.py @@ -1,4 +1,6 @@ -from typing import Literal, Optional, TypedDict, Union +from typing import Literal, Optional, Union + +from typing_extensions import TypedDict from litellm.types.llms.openai import ChatCompletionCachedContent diff --git a/litellm/types/integrations/argilla.py b/litellm/types/integrations/argilla.py index 6c0de762a70..1de7e75ed7c 100644 --- a/litellm/types/integrations/argilla.py +++ b/litellm/types/integrations/argilla.py @@ -1,7 +1,9 @@ import os from datetime import datetime as dt from enum import Enum -from typing import Any, Dict, List, Literal, Optional, Set, TypedDict +from typing import Any, Dict, List, Literal, Optional, Set + +from typing_extensions import TypedDict class ArgillaItem(TypedDict): diff --git a/litellm/types/integrations/base_health_check.py b/litellm/types/integrations/base_health_check.py index b69529d1fcd..2443564dcd2 100644 --- a/litellm/types/integrations/base_health_check.py +++ b/litellm/types/integrations/base_health_check.py @@ -1,4 +1,6 @@ -from typing import Literal, Optional, TypedDict +from typing import Literal, Optional + +from typing_extensions import TypedDict class IntegrationHealthCheckStatus(TypedDict): diff --git a/litellm/types/integrations/datadog.py b/litellm/types/integrations/datadog.py index 7ea25561f95..fce60b9c4b5 100644 --- a/litellm/types/integrations/datadog.py +++ b/litellm/types/integrations/datadog.py @@ -1,5 +1,7 @@ from enum import Enum -from typing import Optional, TypedDict +from typing import Optional + +from typing_extensions import TypedDict DD_MAX_BATCH_SIZE = 1000 diff --git a/litellm/types/integrations/datadog_llm_obs.py b/litellm/types/integrations/datadog_llm_obs.py index 41489ace30f..25ee0932b12 100644 --- a/litellm/types/integrations/datadog_llm_obs.py +++ b/litellm/types/integrations/datadog_llm_obs.py @@ -3,7 +3,9 @@ Payloads for Datadog LLM Observability Service (LLMObs) API Reference: https://docs.datadoghq.com/llm_observability/setup/api/?tab=example#api-standards """ -from typing import Any, Dict, List, Literal, Optional, TypedDict +from typing import Any, Dict, List, Literal, Optional + +from typing_extensions import TypedDict from litellm.types.integrations.custom_logger import StandardCustomLoggerInitParams diff --git a/litellm/types/integrations/gcs_bucket.py b/litellm/types/integrations/gcs_bucket.py index 9f5065ced2b..2be2acab2f2 100644 --- a/litellm/types/integrations/gcs_bucket.py +++ b/litellm/types/integrations/gcs_bucket.py @@ -1,4 +1,6 @@ -from typing import TYPE_CHECKING, Any, Dict, Optional, TypedDict +from typing import TYPE_CHECKING, Any, Dict, Optional + +from typing_extensions import TypedDict from litellm.types.utils import StandardLoggingPayload diff --git a/litellm/types/integrations/langfuse.py b/litellm/types/integrations/langfuse.py index ecf42d8cd47..e509d074172 100644 --- a/litellm/types/integrations/langfuse.py +++ b/litellm/types/integrations/langfuse.py @@ -1,4 +1,6 @@ -from typing import Optional, TypedDict +from typing import Optional + +from typing_extensions import TypedDict class LangfuseLoggingConfig(TypedDict): diff --git a/litellm/types/integrations/langsmith.py b/litellm/types/integrations/langsmith.py index 48c8e2e0a29..382479ab420 100644 --- a/litellm/types/integrations/langsmith.py +++ b/litellm/types/integrations/langsmith.py @@ -1,8 +1,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Dict, List, NamedTuple, Optional, TypedDict +from typing import Any, Dict, List, NamedTuple, Optional from pydantic import BaseModel +from typing_extensions import TypedDict class LangsmithInputs(BaseModel): diff --git a/litellm/types/integrations/pagerduty.py b/litellm/types/integrations/pagerduty.py index 22fd16654aa..0fa45f219cb 100644 --- a/litellm/types/integrations/pagerduty.py +++ b/litellm/types/integrations/pagerduty.py @@ -1,5 +1,7 @@ from datetime import datetime -from typing import List, Literal, Optional, TypedDict, Union +from typing import List, Literal, Optional, Union + +from typing_extensions import TypedDict from litellm.types.utils import StandardLoggingUserAPIKeyMetadata diff --git a/litellm/types/integrations/rag/bedrock_knowledgebase.py b/litellm/types/integrations/rag/bedrock_knowledgebase.py index dd60ccc198d..c7ee4d87825 100644 --- a/litellm/types/integrations/rag/bedrock_knowledgebase.py +++ b/litellm/types/integrations/rag/bedrock_knowledgebase.py @@ -1,4 +1,6 @@ -from typing import Any, Dict, List, Literal, Optional, TypedDict, Union +from typing import Any, Dict, List, Literal, Optional, Union + +from typing_extensions import TypedDict class BedrockKBLocation(TypedDict, total=False): diff --git a/litellm/types/integrations/slack_alerting.py b/litellm/types/integrations/slack_alerting.py index 804c41eaf87..856640638c2 100644 --- a/litellm/types/integrations/slack_alerting.py +++ b/litellm/types/integrations/slack_alerting.py @@ -1,9 +1,10 @@ import os from datetime import datetime as dt from enum import Enum -from typing import Any, Dict, List, Literal, Optional, Set, TypedDict +from typing import Any, Dict, List, Literal, Optional, Set from pydantic import BaseModel, Field +from typing_extensions import TypedDict from litellm.types.utils import LiteLLMPydanticObjectBase diff --git a/litellm/types/litellm_core_utils/streaming_chunk_builder_utils.py b/litellm/types/litellm_core_utils/streaming_chunk_builder_utils.py index ecdc95bf25e..aa879e14c34 100644 --- a/litellm/types/litellm_core_utils/streaming_chunk_builder_utils.py +++ b/litellm/types/litellm_core_utils/streaming_chunk_builder_utils.py @@ -1,4 +1,6 @@ -from typing import TYPE_CHECKING, Optional, TypedDict +from typing import TYPE_CHECKING, Optional + +from typing_extensions import TypedDict from ..utils import CompletionTokensDetails, PromptTokensDetailsWrapper diff --git a/litellm/types/llms/anthropic_messages/anthropic_response.py b/litellm/types/llms/anthropic_messages/anthropic_response.py index 158d11c463c..1eab1b37e06 100644 --- a/litellm/types/llms/anthropic_messages/anthropic_response.py +++ b/litellm/types/llms/anthropic_messages/anthropic_response.py @@ -1,6 +1,6 @@ -from typing import Any, Dict, List, Literal, Optional, TypedDict, Union +from typing import Any, Dict, List, Literal, Optional, Union -from typing_extensions import TypeAlias +from typing_extensions import TypeAlias, TypedDict from litellm.types.llms.anthropic import ( AnthropicResponseContentBlockText, diff --git a/litellm/types/llms/bedrock.py b/litellm/types/llms/bedrock.py index 5853f9de2aa..baa7c205204 100644 --- a/litellm/types/llms/bedrock.py +++ b/litellm/types/llms/bedrock.py @@ -1,11 +1,12 @@ import json -from typing import Any, List, Literal, Optional, TypedDict, Union +from typing import Any, List, Literal, Optional, Union from typing_extensions import ( TYPE_CHECKING, Protocol, Required, Self, + TypedDict, TypeGuard, get_origin, override, diff --git a/litellm/types/llms/bedrock_invoke_agents.py b/litellm/types/llms/bedrock_invoke_agents.py index dde9405a720..385048b4ff6 100644 --- a/litellm/types/llms/bedrock_invoke_agents.py +++ b/litellm/types/llms/bedrock_invoke_agents.py @@ -4,7 +4,9 @@ Type definitions for AWS Bedrock Invoke Agent API responses. https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html """ -from typing import Any, Dict, List, Optional, TypedDict, Union +from typing import Any, Dict, List, Optional, Union + +from typing_extensions import TypedDict class InvokeAgentEventHeaders(TypedDict, total=False): diff --git a/litellm/types/llms/databricks.py b/litellm/types/llms/databricks.py index c484e80ada3..c862bf0e4ac 100644 --- a/litellm/types/llms/databricks.py +++ b/litellm/types/llms/databricks.py @@ -1,11 +1,12 @@ import json -from typing import Any, Dict, List, Literal, Optional, TypedDict, Union +from typing import Any, Dict, List, Literal, Optional, Union from pydantic import BaseModel from typing_extensions import ( Protocol, Required, Self, + TypedDict, TypeGuard, get_origin, override, diff --git a/litellm/types/llms/mistral.py b/litellm/types/llms/mistral.py index 375120e5376..34f501ef69f 100644 --- a/litellm/types/llms/mistral.py +++ b/litellm/types/llms/mistral.py @@ -1,4 +1,6 @@ -from typing import List, Literal, Optional, TypedDict, Union +from typing import List, Literal, Optional, Union + +from typing_extensions import TypedDict class FunctionCall(TypedDict): diff --git a/litellm/types/llms/ollama.py b/litellm/types/llms/ollama.py index d8f20de514d..b863b76c03c 100644 --- a/litellm/types/llms/ollama.py +++ b/litellm/types/llms/ollama.py @@ -1,11 +1,12 @@ import json -from typing import Any, List, Optional, TypedDict, Union +from typing import Any, List, Optional, Union from pydantic import BaseModel from typing_extensions import ( Protocol, Required, Self, + TypedDict, TypeGuard, get_origin, override, diff --git a/litellm/types/llms/openrouter.py b/litellm/types/llms/openrouter.py index d5bb031a171..39ed7e104fb 100644 --- a/litellm/types/llms/openrouter.py +++ b/litellm/types/llms/openrouter.py @@ -1,6 +1,8 @@ import json from enum import Enum -from typing import Any, Dict, List, Literal, Optional, Tuple, TypedDict, Union +from typing import Any, Dict, List, Literal, Optional, Tuple, Union + +from typing_extensions import TypedDict class OpenRouterErrorMessage(TypedDict): diff --git a/litellm/types/llms/rerank.py b/litellm/types/llms/rerank.py index f781af88ffb..fac093161c1 100644 --- a/litellm/types/llms/rerank.py +++ b/litellm/types/llms/rerank.py @@ -1,11 +1,12 @@ import json from enum import Enum -from typing import Any, Dict, List, Literal, Optional, Tuple, TypedDict, Union +from typing import Any, Dict, List, Literal, Optional, Tuple, Union from typing_extensions import ( Protocol, Required, Self, + TypedDict, TypeGuard, get_origin, override, diff --git a/litellm/types/llms/watsonx.py b/litellm/types/llms/watsonx.py index 7dee2836527..426ca8a7d25 100644 --- a/litellm/types/llms/watsonx.py +++ b/litellm/types/llms/watsonx.py @@ -1,8 +1,9 @@ import json from enum import Enum -from typing import Any, List, Optional, TypedDict, Union +from typing import Any, List, Optional, Union from pydantic import BaseModel +from typing_extensions import TypedDict class WatsonXAPIParams(TypedDict): diff --git a/litellm/types/passthrough_endpoints/pass_through_endpoints.py b/litellm/types/passthrough_endpoints/pass_through_endpoints.py index 39facdd8e6f..c99775f2a6c 100644 --- a/litellm/types/passthrough_endpoints/pass_through_endpoints.py +++ b/litellm/types/passthrough_endpoints/pass_through_endpoints.py @@ -1,5 +1,7 @@ from enum import Enum -from typing import Optional, TypedDict +from typing import Optional + +from typing_extensions import TypedDict class EndpointType(str, Enum): diff --git a/litellm/types/proxy/litellm_pre_call_utils.py b/litellm/types/proxy/litellm_pre_call_utils.py index c33f1ba8bce..a956f92187c 100644 --- a/litellm/types/proxy/litellm_pre_call_utils.py +++ b/litellm/types/proxy/litellm_pre_call_utils.py @@ -1,4 +1,4 @@ -from typing import TypedDict +from typing_extensions import TypedDict class SecretFields(TypedDict): diff --git a/litellm/types/proxy/management_endpoints/common_daily_activity.py b/litellm/types/proxy/management_endpoints/common_daily_activity.py index 713ca56758c..08ffc5d097a 100644 --- a/litellm/types/proxy/management_endpoints/common_daily_activity.py +++ b/litellm/types/proxy/management_endpoints/common_daily_activity.py @@ -1,8 +1,9 @@ from datetime import date from enum import Enum -from typing import Any, Dict, List, Optional, TypedDict +from typing import Any, Dict, List, Optional from pydantic import BaseModel, Field +from typing_extensions import TypedDict class GroupByDimension(str, Enum): diff --git a/litellm/types/proxy/management_endpoints/ui_sso.py b/litellm/types/proxy/management_endpoints/ui_sso.py index fe6d7569b23..820b0164400 100644 --- a/litellm/types/proxy/management_endpoints/ui_sso.py +++ b/litellm/types/proxy/management_endpoints/ui_sso.py @@ -1,6 +1,7 @@ -from typing import List, Literal, Optional, TypedDict, Union +from typing import List, Literal, Optional, Union from pydantic import Field +from typing_extensions import TypedDict from litellm.types.utils import LiteLLMPydanticObjectBase diff --git a/litellm/types/proxy/ui_sso.py b/litellm/types/proxy/ui_sso.py index 625b523477b..0c036274c79 100644 --- a/litellm/types/proxy/ui_sso.py +++ b/litellm/types/proxy/ui_sso.py @@ -1,4 +1,6 @@ -from typing import Literal, Optional, TypedDict +from typing import Literal, Optional + +from typing_extensions import TypedDict class ReturnedUITokenObject(TypedDict): diff --git a/litellm/types/realtime.py b/litellm/types/realtime.py index 73b60a223a4..1ec41f40b3d 100644 --- a/litellm/types/realtime.py +++ b/litellm/types/realtime.py @@ -1,4 +1,6 @@ -from typing import List, Literal, Optional, TypedDict, Union +from typing import List, Literal, Optional, Union + +from typing_extensions import TypedDict from .llms.openai import ( OpenAIRealtimeEvents, diff --git a/litellm/utils.py b/litellm/utils.py index 0d35f95bbe0..d279ce5c14b 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -4616,7 +4616,7 @@ def _check_provider_match(model_info: dict, custom_llm_provider: Optional[str]) return True -from typing import TypedDict +from typing_extensions import TypedDict class PotentialModelNamesAndCustomLLMProvider(TypedDict):