The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
resolving dependency issues
harish87668bc6de214cb
diff --git a/litellm/proxy/openai_files_endpoints/file_content_streaming_handler.py b/litellm/proxy/openai_files_endpoints/file_content_streaming_handler.pyindex e992c47f283..2ca39591dca 100644--- a/litellm/proxy/openai_files_endpoints/file_content_streaming_handler.py+++ b/litellm/proxy/openai_files_endpoints/file_content_streaming_handler.py@@ -1,16 +1,13 @@-from typing import Any, AsyncIterator, Dict, Optional, cast+from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, Optional, castfrom fastapi.responses import StreamingResponseimport litellmfrom litellm.files.types import FileContentStreamingResult-from litellm.proxy._types import UserAPIKeyAuth-from litellm.proxy.common_request_processing import ProxyBaseLLMRequestProcessing-from litellm.proxy.utils import ProxyLogging-from litellm.proxy.openai_files_endpoints.common_utils import (- prepare_data_with_credentials,-)+if TYPE_CHECKING:+ from litellm.proxy._types import UserAPIKeyAuth+ from litellm.proxy.utils import ProxyLoggingclass FileContentStreamingHandler:@@ -28,8 +25,8 @@ class FileContentStreamingHandler:@staticmethodasync def stream_file_content_with_logging(stream_iterator: AsyncIterator[bytes],- proxy_logging_obj: ProxyLogging,- user_api_key_dict: UserAPIKeyAuth,+ proxy_logging_obj: "ProxyLogging",+ user_api_key_dict: "UserAPIKeyAuth",data: Dict[str, Any],):try:@@ -58,10 +55,17 @@ class FileContentStreamingHandler:should_route: bool,original_file_id: Optional[str],credentials: Optional[Dict[str, Any]],- proxy_logging_obj: ProxyLogging,- user_api_key_dict: UserAPIKeyAuth,+ proxy_logging_obj: "ProxyLogging",+ user_api_key_dict: "UserAPIKeyAuth",version: str,) -> StreamingResponse:+ from litellm.proxy.common_request_processing import (+ ProxyBaseLLMRequestProcessing,+ )+ from litellm.proxy.openai_files_endpoints.common_utils import (+ prepare_data_with_credentials,+ )+effective_custom_llm_provider = custom_llm_providerif should_route:if credentials is None or credentials.get("custom_llm_provider") is None:diff --git a/litellm/proxy/openai_files_endpoints/files_endpoints.py b/litellm/proxy/openai_files_endpoints/files_endpoints.pyindex fb131f33ec3..cdf4785f983 100644--- a/litellm/proxy/openai_files_endpoints/files_endpoints.py+++ b/litellm/proxy/openai_files_endpoints/files_endpoints.py@@ -24,9 +24,6 @@ from fastapi import (import litellmfrom litellm import CreateFileRequest, get_secret_strfrom litellm._logging import verbose_proxy_logger-from litellm.proxy.openai_files_endpoints.file_content_streaming_handler import (- FileContentStreamingHandler,-)from litellm.llms.base_llm.files.transformation import BaseFileEndpointsfrom litellm.proxy._types import *from litellm.proxy.auth.user_api_key_auth import user_api_key_auth@@ -55,9 +52,7 @@ from litellm.proxy.openai_files_endpoints.common_utils import (extract_file_creation_params,get_credentials_for_model,handle_model_based_routing,-)-from litellm.proxy.openai_files_endpoints.storage_backend_service import (- StorageBackendFileService,+ prepare_data_with_credentials,)router = APIRouter()@@ -162,6 +157,9 @@ async def route_create_file(from litellm.litellm_core_utils.prompt_templates.common_utils import (extract_file_data,)+ from litellm.proxy.openai_files_endpoints.storage_backend_service import (+ StorageBackendFileService,+ )# Extract file datafile_data = extract_file_data(cast(Any, _create_file_request.get("file")))@@ -734,6 +732,10 @@ async def get_file_content( # noqa: PLR0915check_file_id_encoding=True,)+ from litellm.proxy.openai_files_endpoints.file_content_streaming_handler import (+ FileContentStreamingHandler,+ )+if FileContentStreamingHandler.should_stream_file_content(custom_llm_provider=custom_llm_provider,is_base64_unified_file_id=is_base64_unified_file_id,