Skip to content

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]

Merge branch 'litellm_internal_staging' into feature/improve-gigachat-provider

KnyazShd7d2e440e076
diff --cc gateway/routes/allowlist.py
index 6cb55327dd4,05baf98bbb5..92b73867e67
--- a/gateway/routes/allowlist.py
+++ b/gateway/routes/allowlist.py
@@@ -82,9 -83,9 +83,10 @@@ GATEWAY_PATH_PREFIXES: tuple[str, ...]
"/azure_ai/",
"/aws/",
"/bedrock/",
+ "/comprehendmedical",
"/cohere/",
"/gemini/",
+ "/gigachat/",
"/google/",
"/vertex_ai/",
"/vertex-ai/",
diff --cc litellm/litellm_core_utils/get_llm_provider_logic.py
index d3621193463,dbb40913e14..8844578f722
--- a/litellm/litellm_core_utils/get_llm_provider_logic.py
+++ b/litellm/litellm_core_utils/get_llm_provider_logic.py
@@@ -349,17 -349,12 +349,15 @@@ def get_llm_provider
elif endpoint == "https://api.meta.ai/v1":
custom_llm_provider = "meta"
dynamic_api_key = get_secret_str("META_API_KEY")
+ elif endpoint == "https://gigachat.devices.sberbank.ru/api/v1":
+ custom_llm_provider = "gigachat"
+ dynamic_api_key = get_secret_str("GIGACHAT_API_KEY")
if api_base is not None and not isinstance(api_base, str):
- raise Exception("api base needs to be a string. api_base={}".format(api_base))
+ raise Exception(f"api base needs to be a string. api_base={api_base}")
if dynamic_api_key is not None and not isinstance(dynamic_api_key, str):
- raise Exception(
- "dynamic_api_key needs to be a string. dynamic_api_key={}".format(dynamic_api_key)
- )
- return model, custom_llm_provider, dynamic_api_key, api_base # type: ignore
+ raise Exception(f"dynamic_api_key needs to be a string. dynamic_api_key={dynamic_api_key}")
+ return model, custom_llm_provider, dynamic_api_key, api_base
# check if model in known model provider list -> for huggingface models, raise exception as they don't have a fixed provider (can be togetherai, anyscale, baseten, runpod, et.)
## openai - chatcompletion + text completion
@@@ -851,14 -844,11 +849,14 @@@ def _get_openai_compatible_provider_inf
# Manus is OpenAI compatible for responses API
api_base = api_base or get_secret_str("MANUS_API_BASE") or "https://api.manus.im"
dynamic_api_key = api_key or get_secret_str("MANUS_API_KEY")
+ elif custom_llm_provider == "gigachat":
+ api_base = api_base or get_secret_str("GIGACHAT_API_BASE") or "https://gigachat.devices.sberbank.ru/api/v1"
+ dynamic_api_key = api_key or get_secret_str("GIGACHAT_API_KEY")
if api_base is not None and not isinstance(api_base, str):
- raise Exception("api base needs to be a string. api_base={}".format(api_base))
+ raise Exception(f"api base needs to be a string. api_base={api_base}")
if dynamic_api_key is not None and not isinstance(dynamic_api_key, str):
- raise Exception("dynamic_api_key needs to be a string. dynamic_api_key={}".format(dynamic_api_key))
+ raise Exception(f"dynamic_api_key needs to be a string. dynamic_api_key={dynamic_api_key}")
if dynamic_api_key is None and api_key is not None:
dynamic_api_key = api_key
return model, custom_llm_provider, dynamic_api_key, api_base
diff --cc litellm/litellm_core_utils/litellm_logging.py
index 905986177e3,edb4d56a5b7..3bc13f5456b
--- a/litellm/litellm_core_utils/litellm_logging.py
+++ b/litellm/litellm_core_utils/litellm_logging.py
@@@ -1833,11 -2010,8 +2011,11 @@@ class Logging(LiteLLMLoggingBaseClass)
elif self.call_type == CallTypes.asend_message.value or self.call_type == CallTypes.send_message.value:
result = self._handle_a2a_response_logging(result=result)
- logging_result = self.normalize_logging_result(result=result)
+ logging_result: Final = self.normalize_logging_result(result=result)
+ if isinstance(result, Response) and isinstance(logging_result, ModelResponse):
+ result = logging_result
+
if standard_logging_object is None and result is not None and self.stream is not True:
if self._is_recognized_call_type_for_logging(logging_result=logging_result) or isinstance(
logging_result, (dict, list)
diff --cc litellm/llms/gigachat/authenticator.py
index db0fff3e302,9ef6fe7a93c..01272c42284
--- a/litellm/llms/gigachat/authenticator.py
+++ b/litellm/llms/gigachat/authenticator.py
@@@ -94,12 -85,12 +93,12 @@@ def get_access_token
message="GigaChat credentials not provided. Set GIGACHAT_CREDENTIALS or GIGACHAT_API_KEY environment variable.",
)
- scope = scope or _get_scope()
- auth_url = auth_url or _get_auth_url()
+ scope = scope or litellm_params.get("gigachat_scope") or _get_scope()
+ auth_url = auth_url or litellm_params.get("gigachat_auth_url") or _get_auth_url()
# Check cache
- cache_key = f"gigachat_token:{credentials[:16]}"
- cached = _token_cache.get_cache(cache_key)
+ cache_key: Final = f"gigachat_token:{credentials[:16]}"
+ cached: Final = _token_cache.get_cache(cache_key)
if cached:
token, expires_at = cached
# Check if token is still valid (with buffer)
@@@ -110,11 -101,10 +109,11 @@@
# Request new token
token, expires_at = _request_token_sync(credentials, scope, auth_url)
- # Cache token
- ttl_seconds: Final = max(0, (expires_at - TOKEN_EXPIRY_BUFFER_MS - time.time() * 1000) / 1000)
- if ttl_seconds > 0:
- _token_cache.set_cache(cache_key, (token, expires_at), ttl=ttl_seconds)
+ if expires_at:
+ # Cache token
- ttl_seconds = max(0, (expires_at - TOKEN_EXPIRY_BUFFER_MS - time.time() * 1000) / 1000)
++ ttl_seconds: Final = max(0, (expires_at - TOKEN_EXPIRY_BUFFER_MS - time.time() * 1000) / 1000)
+ if ttl_seconds > 0:
+ _token_cache.set_cache(cache_key, (token, expires_at), ttl=ttl_seconds)
return token
@@@ -140,12 -122,12 +139,12 @@@ async def get_access_token_async
message="GigaChat credentials not provided. Set GIGACHAT_CREDENTIALS or GIGACHAT_API_KEY environment variable.",
)
- scope = scope or _get_scope()
- auth_url = auth_url or _get_auth_url()
+ scope = scope or litellm_params.get("gigachat_scope") or _get_scope()
+ auth_url = auth_url or litellm_params.get("gigachat_auth_url") or _get_auth_url()
# Check cache
- cache_key = f"gigachat_token:{credentials[:16]}"
- cached = _token_cache.get_cache(cache_key)
+ cache_key: Final = f"gigachat_token:{credentials[:16]}"
+ cached: Final = _token_cache.get_cache(cache_key)
if cached:
token, expires_at = cached
if time.time() * 1000 < expires_at - TOKEN_EXPIRY_BUFFER_MS:
@@@ -155,11 -137,10 +154,11 @@@
# Request new token
token, expires_at = await _request_token_async(credentials, scope, auth_url)
- # Cache token
- ttl_seconds: Final = max(0, (expires_at - TOKEN_EXPIRY_BUFFER_MS - time.time() * 1000) / 1000)
- if ttl_seconds > 0:
- _token_cache.set_cache(cache_key, (token, expires_at), ttl=ttl_seconds)
+ if expires_at:
+ # Cache token
- ttl_seconds = max(0, (expires_at - TOKEN_EXPIRY_BUFFER_MS - time.time() * 1000) / 1000)
++ ttl_seconds: Final = max(0, (expires_at - TOKEN_EXPIRY_BUFFER_MS - time.time() * 1000) / 1000)
+ if ttl_seconds > 0:
+ _token_cache.set_cache(cache_key, (token, expires_at), ttl=ttl_seconds)
return token
@@@ -173,9 -154,9 +172,9 @@@ def _request_token_sync
Request new access token from GigaChat OAuth endpoint (sync).
Returns:
- Tuple of (access_token, expires_at_ms)
+ tuple of (access_token, expires_at_ms)
"""
- headers = {
+ headers: Final = {
"Authorization": f"Basic {credentials}",
"RqUID": str(uuid.uuid4()),
"Content-Type": "application/x-www-form-urlencoded",
diff --cc litellm/llms/gigachat/chat/streaming.py
index 260761645c0,219209773ea..1b207057537
--- a/litellm/llms/gigachat/chat/streaming.py
+++ b/litellm/llms/gigachat/chat/streaming.py
@@@ -4,9 -4,8 +4,9 @@@ GigaChat Streaming Response Handle
import json
import uuid
- from typing import Any
+ from typing import Any, Final
+from litellm.llms.gigachat.utils import convert_usage
from litellm.types.llms.openai import (
ChatCompletionToolCallChunk,
ChatCompletionToolCallFunctionChunk,
diff --cc litellm/llms/gigachat/chat/transformation.py
index 2116cc86d2b,6d75c311084..920a067eaa9
--- a/litellm/llms/gigachat/chat/transformation.py
+++ b/litellm/llms/gigachat/chat/transformation.py
@@@ -94,7 -93,7 +93,7 @@@ class GigaChatConfig(BaseConfig)
stream: bool | None = None,
) -> str:
"""Get complete API URL for chat completions."""
- base = get_api_base(api_base)
- base: Final = api_base or get_secret_str("GIGACHAT_API_BASE") or GIGACHAT_BASE_URL
++ base: Final = get_api_base(api_base)
return f"{base}/chat/completions"
def validate_environment(
@@@ -111,10 -110,8 +110,8 @@@
Set up headers with OAuth token.
"""
# Get access token
- credentials = api_key or get_secret_str("GIGACHAT_CREDENTIALS") or get_secret_str("GIGACHAT_API_KEY")
- access_token = get_access_token(credentials=credentials)
- credentials = api_key or get_secret_str("GIGACHAT_CREDENTIALS") or get_secret_str("GIGACHAT_API_KEY")
- access_token = get_access_token(credentials=credentials, litellm_params=litellm_params)
+ credentials: Final = api_key or get_secret_str("GIGACHAT_CREDENTIALS") or get_secret_str("GIGACHAT_API_KEY")
- access_token: Final = get_access_token(credentials=credentials)
++ access_token: Final = get_access_token(credentials=credentials, litellm_params=litellm_params)
# Store credentials for image uploads
self._current_credentials = credentials
@@@ -271,39 -268,9 +268,39 @@@
api_base=self._current_api_base,
)
except Exception as e:
- verbose_logger.error(f"Failed to upload image: {e}")
+ verbose_logger.error("Failed to upload image: %s", e)
return None
+ def _transform_list_content(self, content: list) -> tuple[str, list[str]]:
+ """
+ Extract text and image attachments from a multimodal message content list.
+
+ Args:
+ content: List of content parts (OpenAI multimodal format)
+
+ Returns:
+ Tuple of (combined text, list of attachment file ids)
+ """
+ texts = []
+ attachments = []
+ for part in content:
+ if isinstance(part, dict):
+ if part.get("type") == "text":
+ texts.append(part.get("text", ""))
+ elif part.get("type") == "image_url":
+ # Extract image URL and upload to GigaChat
+ image_url = part.get("image_url", {})
+ if isinstance(image_url, str):
+ url = image_url
+ else:
+ url = image_url.get("url", "")
+ if url:
+ file_id = self._upload_image(url)
+ if file_id:
+ attachments.append(file_id)
+ text = "\n".join(texts) if texts else ""
+ return text, attachments
+
def transform_request(
self,
model: str,
@@@ -475,8 -459,12 +472,8 @@@
)
# Build usage
- usage_data = response_json.get("usage", {})
- usage = convert_usage(usage_data)
+ usage_data: Final = response_json.get("usage", {})
- usage: Final = Usage(
- prompt_tokens=usage_data.get("prompt_tokens", 0),
- completion_tokens=usage_data.get("completion_tokens", 0),
- total_tokens=usage_data.get("total_tokens", 0),
- )
++ usage: Final = convert_usage(usage_data)
model_response.id = response_json.get("id", f"chatcmpl-{uuid.uuid4().hex[:12]}")
model_response.created = response_json.get("created", int(time.time()))
diff --cc litellm/llms/gigachat/embedding/transformation.py
index 9495e2b414f,bb495cea423..6c6ed3ce35f
--- a/litellm/llms/gigachat/embedding/transformation.py
+++ b/litellm/llms/gigachat/embedding/transformation.py
@@@ -5,17 -5,15 +5,18 @@@ Transforms OpenAI /v1/embeddings forma
API Documentation: https://developers.sber.ru/docs/ru/gigachat/api/reference/rest/post-embeddings
"""
+from __future__ import annotations
+
import types
+ from typing import Final
import httpx
from litellm import LlmProviders
+ from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
from litellm.llms.base_llm.chat.transformation import BaseLLMException
from litellm.llms.base_llm.embedding.transformation import BaseEmbeddingConfig
- from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
+from litellm.llms.gigachat.utils import get_api_base
from litellm.types.llms.openai import AllEmbeddingInputValues, AllMessageValues
from litellm.types.utils import EmbeddingResponse
@@@ -94,7 -93,7 +93,7 @@@ class GigaChatEmbeddingConfig(BaseEmbed
stream: bool | None = None,
) -> str:
"""Get the complete URL for embeddings endpoint."""
- base = get_api_base(api_base)
- base: Final = api_base or GIGACHAT_BASE_URL
++ base: Final = get_api_base(api_base)
return f"{base}/embeddings"
def transform_embedding_request(
@@@ -193,9 -191,9 +191,9 @@@
Set up headers with OAuth token for GigaChat.
"""
# Get access token via OAuth
- access_token = get_access_token(credentials=api_key, litellm_params=litellm_params)
- access_token: Final = get_access_token(api_key)
++ access_token: Final = get_access_token(credentials=api_key, litellm_params=litellm_params)
- default_headers = {
+ default_headers: Final = {
"Content-Type": "application/json",
"Authorization": f"Bearer {access_token}",
}
diff --cc litellm/llms/gigachat/file_handler.py
index ac03732a9bb,4cbde551fa2..6dfd4d74be7
--- a/litellm/llms/gigachat/file_handler.py
+++ b/litellm/llms/gigachat/file_handler.py
@@@ -20,8 -20,11 +21,8 @@@ from litellm.types.utils import LlmProv
from .authenticator import get_access_token, get_access_token_async
-# GigaChat API endpoint
-GIGACHAT_BASE_URL: Final = "https://gigachat.devices.sberbank.ru/api/v1"
-
# Simple in-memory cache for file IDs
- _file_cache: dict[str, str] = {}
+ _file_cache: Final[dict[str, str]] = {}
def _get_url_hash(url: str) -> str:
@@@ -106,20 -108,20 +107,20 @@@ def upload_file_sync
content_bytes, content_type, ext = parsed
verbose_logger.debug("Decoded base64 image")
else:
- verbose_logger.debug(f"Downloading image from URL: {image_url[:80]}...")
+ verbose_logger.debug("Downloading image from URL: %s...", image_url[:80])
content_bytes, content_type, ext = _download_image_sync(image_url)
- filename = f"{uuid.uuid4()}.{ext}"
+ filename: Final = f"{uuid.uuid4()}.{ext}"
# Get access token
- access_token = get_access_token(credentials=credentials, litellm_params=litellm_params)
- access_token: Final = get_access_token(credentials)
++ access_token: Final = get_access_token(credentials=credentials, litellm_params=litellm_params)
# Upload to GigaChat
- base_url = get_api_base(api_base)
- upload_url = f"{base_url}/files"
- base_url: Final = api_base or GIGACHAT_BASE_URL
++ base_url: Final = get_api_base(api_base)
+ upload_url: Final = f"{base_url}/files"
- client = _get_httpx_client(params={"ssl_verify": False})
- response = client.post(
+ client: Final = _get_httpx_client(params={"ssl_verify": False})
+ response: Final = client.post(
upload_url,
headers={"Authorization": f"Bearer {access_token}"},
files={"file": (filename, content_bytes, content_type)},
@@@ -172,19 -173,19 +173,19 @@@ async def upload_file_async
content_bytes, content_type, ext = parsed
verbose_logger.debug("Decoded base64 image")
else:
- verbose_logger.debug(f"Downloading image from URL: {image_url[:80]}...")
+ verbose_logger.debug("Downloading image from URL: %s...", image_url[:80])
content_bytes, content_type, ext = await _download_image_async(image_url)
- filename = f"{uuid.uuid4()}.{ext}"
+ filename: Final = f"{uuid.uuid4()}.{ext}"
# Get access token
- access_token = await get_access_token_async(credentials=credentials, litellm_params=litellm_params)
- access_token: Final = await get_access_token_async(credentials)
++ access_token: Final = await get_access_token_async(credentials=credentials, litellm_params=litellm_params)
# Upload to GigaChat
- base_url = get_api_base(api_base)
- upload_url = f"{base_url}/files"
- base_url: Final = api_base or GIGACHAT_BASE_URL
++ base_url: Final = get_api_base(api_base)
+ upload_url: Final = f"{base_url}/files"
- client = get_async_httpx_client(
+ client: Final = get_async_httpx_client(
llm_provider=LlmProviders.GIGACHAT,
params={"ssl_verify": False},
)
diff --cc litellm/passthrough/main.py
index 95ec4b04b27,8a2ee2a3af8..2d9da5cfdbc
--- a/litellm/passthrough/main.py
+++ b/litellm/passthrough/main.py
@@@ -2,21 -2,11 +2,13 @@@
This module is used to pass through requests to the LLM APIs.
"""
+from __future__ import annotations
+
import asyncio
import contextvars
+ from collections.abc import AsyncGenerator, Coroutine, Generator
from functools import partial
- from typing import (
- Any,
- AsyncGenerator,
- AsyncIterator,
- Coroutine,
- Generator,
- Iterator,
- List,
- cast,
- )
-from typing import TYPE_CHECKING, Any, Final, Optional, cast
++from typing import TYPE_CHECKING, Any, AsyncIterator, Iterator, Final, Optional, cast
import httpx
from httpx._types import CookieTypes, QueryParamTypes, RequestFiles
@@@ -394,11 -188,9 +386,11 @@@ def llm_passthrough_route
from litellm.types.utils import LlmProviders
from litellm.utils import ProviderConfigManager
- _is_async = bool(kwargs.get("allm_passthrough_route", False))
+ _is_async: Final = bool(kwargs.get("allm_passthrough_route", False))
- litellm_logging_obj = cast(
- litellm_logging_obj: Final = cast("LiteLLMLoggingObj", kwargs.get("litellm_logging_obj"))
++ litellm_logging_obj: Final = cast(
+ LiteLLMLoggingObj, kwargs.get("litellm_logging_obj")
+ ) # cast-ok: logging obj is constructed upstream; tests inject mocks
model, custom_llm_provider, api_key, api_base = get_llm_provider(
model=model,
@@@ -442,8 -234,8 +434,8 @@@
request_data=data if data else json,
)
- provider_config = cast(
+ provider_config: Final = cast(
- Optional["BasePassthroughConfig"], kwargs.get("provider_config")
+ BasePassthroughConfig | None, kwargs.get("provider_config")
) or ProviderConfigManager.get_provider_passthrough_config(
provider=LlmProviders(custom_llm_provider),
model=model,
@@@ -541,12 -333,15 +533,12 @@@
)
else:
# Sync path - client.client.send returns Response directly
- response: httpx.Response = client.client.send(request=request, stream=is_streaming_request) # type: ignore
+ response: httpx.Response = client.client.send(request=request, stream=is_streaming_request)
response.raise_for_status()
- if (
- hasattr(response, "iter_bytes") and is_streaming_request
- ): # yield the chunk, so we can store it in the logging object
- return _sync_streaming(response, litellm_logging_obj, provider_config)
+ if hasattr(response, "iter_bytes") and is_streaming_request:
+ return PassthroughStreamingResponse(response, litellm_logging_obj, provider_config)
else:
- # For non-streaming responses, yield the entire response
return response
except Exception as e:
if provider_config is None:
diff --cc litellm/proxy/common_request_processing.py
index c62b6d63587,adae59a1174..15498c286e6
--- a/litellm/proxy/common_request_processing.py
+++ b/litellm/proxy/common_request_processing.py
@@@ -1791,16 -2004,9 +2033,16 @@@ class ProxyBaseLLMRequestProcessing
cache_hit=cache_hit,
)
- logging_obj._on_deferred_stream_complete = _on_deferred_stream_complete # type: ignore[union-attr]
+ logging_obj._on_deferred_stream_complete = _on_deferred_stream_complete
if route_type == "allm_passthrough_route":
+ streaming_headers = custom_headers
+ if hasattr(response, "headers"):
+ streaming_headers = ProxyBaseLLMRequestProcessing._merge_passthrough_streaming_headers(
+ response_headers=getattr(response, "headers", None),
+ custom_headers=custom_headers,
+ )
+
# Check if response is an async generator
if self._is_streaming_response(response):
if asyncio.iscoroutine(response):
@@@ -1848,9 -2052,9 +2088,9 @@@
if _early is not None:
return _early
return StreamingResponse(
- content=response.aiter_bytes(), # type: ignore[union-attr]
- status_code=response.status_code, # type: ignore[union-attr]
+ content=response.aiter_bytes(),
+ status_code=response.status_code,
- headers=custom_headers,
+ headers=streaming_headers,
)
elif route_type == "anthropic_messages":
# Check if response is actually a streaming response (async generator)
diff --cc litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
index c20fd733037,635767f4db7..2aa494468ec
--- a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
+++ b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
@@@ -11,7 -9,8 +11,8 @@@ from __future__ import annotation
import json
import os
import re
- from typing import TYPE_CHECKING, Annotated, Any, Callable, cast
+ from types import MappingProxyType
-from typing import Annotated, Any, Final, cast
++from typing import Annotated, Any, Final, Callable, cast
import httpx
from fastapi import APIRouter, Depends, HTTPException, Request, Response, WebSocket
@@@ -61,19 -60,12 +63,27 @@@ from litellm.utils import ProviderConfi
from .passthrough_endpoint_router import PassthroughEndpointRouter
+if TYPE_CHECKING:
+ from litellm.proxy.proxy_server import ProxyConfig as _ProxyConfig
+
+ ProxyConfig = _ProxyConfig
+else:
+ ProxyConfig = Any
+
+
- vertex_llm_base = VertexBase()
- router = APIRouter()
- default_vertex_config = None
++if TYPE_CHECKING:
++ from litellm.proxy.proxy_server import ProxyConfig as _ProxyConfig
+
- passthrough_endpoint_router = PassthroughEndpointRouter()
++ ProxyConfig = _ProxyConfig
++else:
++ ProxyConfig = Any
++
++
+ vertex_llm_base: Final = VertexBase()
+ router: Final = APIRouter()
+ openai_passthrough_router: Final = APIRouter()
+ default_vertex_config: Final = None
-
+ passthrough_endpoint_router: Final = PassthroughEndpointRouter()
def create_request_copy(request: Request):
@@@ -452,16 -449,10 +467,16 @@@ async def milvus_proxy_route
)
# check if managed vector store index is used
- request_body = await get_request_body(request)
+ request_body: Final = await get_request_body(request)
# check collectionName
- _raw_collection_name = request_body.get("collectionName")
- collection_name: Final = cast(str | None, request_body.get("collectionName"))
++ _raw_collection_name: Final = request_body.get("collectionName")
+ if _raw_collection_name is not None and not isinstance(_raw_collection_name, str):
+ raise HTTPException(
+ status_code=400,
+ detail=f"collectionName must be a string. Got {type(_raw_collection_name).__name__}",
+ )
+ collection_name: str | None = _raw_collection_name
extra_headers = {}
base_target_url: str | None = None
if not collection_name:
@@@ -1576,14 -1728,14 +1752,14 @@@ async def _prepare_vertex_auth_headers
get_vertex_pass_through_handler: Handler for the specific Vertex AI service
Returns:
- Tuple containing:
+ tuple containing:
- headers: dict - Authentication headers to use
- - base_target_url: Optional[str] - Updated base target URL
+ - base_target_url: str | None - Updated base target URL
- headers_passed_through: bool - Whether headers were passed through from request
- - vertex_project: Optional[str] - Updated vertex project ID
- - vertex_location: Optional[str] - Updated vertex location
+ - vertex_project: str | None - Updated vertex project ID
+ - vertex_location: str | None - Updated vertex location
"""
- vertex_llm_base = VertexBase()
+ vertex_llm_base: Final = VertexBase()
headers_passed_through = False
# Use headers from the incoming request if no vertex credentials are found
diff --cc tests/test_litellm/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py
index c5f5f4a11ae,050070e2fcf..3c0c2b0294e
--- a/tests/test_litellm/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py
+++ b/tests/test_litellm/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py
@@@ -7,8 -8,7 +8,8 @@@ from unittest.mock import AsyncMock, Ma
import httpx
import pytest
- from fastapi import Request, Response
+ from fastapi import HTTPException, Request, Response
+from fastapi.responses import StreamingResponse
from fastapi.testclient import TestClient
sys.path.insert(
@@@ -23,8 -24,9 +26,10 @@@ from litellm.proxy.pass_through_endpoin
bedrock_llm_proxy_route,
create_pass_through_route,
cursor_proxy_route,
+ get_azure_ai_search_index_from_endpoint,
get_vertex_base_url,
+ is_azure_ai_search_service_level_index_create,
+ gigachat_proxy_route,
llm_passthrough_factory_proxy_route,
milvus_proxy_route,
mistral_proxy_route,