resolving dependency issues

This commit is contained in:
harish876
2026-04-11 00:07:41 +00:00
parent c5d93e67f4
commit 68bc6de214
2 changed files with 23 additions and 17 deletions
@@ -1,16 +1,13 @@
from typing import Any, AsyncIterator, Dict, Optional, cast
from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, Optional, cast
from fastapi.responses import StreamingResponse
import litellm
from 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 ProxyLogging
class FileContentStreamingHandler:
@@ -28,8 +25,8 @@ class FileContentStreamingHandler:
@staticmethod
async 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_provider
if should_route:
if credentials is None or credentials.get("custom_llm_provider") is None:
@@ -24,9 +24,6 @@ from fastapi import (
import litellm
from litellm import CreateFileRequest, get_secret_str
from 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 BaseFileEndpoints
from 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 data
file_data = extract_file_data(cast(Any, _create_file_request.get("file")))
@@ -734,6 +732,10 @@ async def get_file_content( # noqa: PLR0915
check_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,