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
added redis iam auth (#13275)
Jugal D. Bhatt29a8c583c20a
diff --git a/.circleci/requirements.txt b/.circleci/requirements.txtindex dab838133e9..a1e5cb99416 100644--- a/.circleci/requirements.txt+++ b/.circleci/requirements.txt@@ -10,6 +10,7 @@ anthropicorjson==3.10.12 # fast /embedding responsespydantic==2.10.2google-cloud-aiplatform==1.43.0+google-cloud-iam==2.19.1fastapi-sso==0.16.0uvloop==0.21.0mcp==1.10.1 # for MCP serverdiff --git a/docs/my-website/docs/caching/all_caches.md b/docs/my-website/docs/caching/all_caches.mdindex e3bf363e67d..829511914fb 100644--- a/docs/my-website/docs/caching/all_caches.md+++ b/docs/my-website/docs/caching/all_caches.md@@ -28,6 +28,8 @@ pip install redisFor the hosted version you can setup your own Redis DB here: https://redis.io/try-free/+**Basic Redis Cache**+```pythonimport litellmfrom litellm import completion@@ -48,6 +50,77 @@ response2 = completion(# response1 == response2, response 1 is cached```+**GCP IAM Redis Authentication**++For GCP Memorystore Redis with IAM authentication:++```shell+pip install google-cloud-iam+```++```python+import litellm+from litellm import completion+from litellm.caching.caching import Cache++# Using Redis Cache with GCP IAM Authentication+litellm.cache = Cache(+ type="redis",+ host="10.128.0.2", # Your GCP Redis IP+ port=6379,+ gcp_service_account="projects/-/serviceAccounts/[email protected]",+ gcp_ssl_ca_certs="./server-ca.pem", # Path to SSL CA certificate+ ssl=True,+ ssl_cert_reqs=None, # For self-signed certificates+ ssl_check_hostname=False, # For self-signed certificates+)++# For Redis Cluster with GCP IAM+from litellm.caching.redis_cluster_cache import RedisClusterCache++litellm.cache = RedisClusterCache(+ startup_nodes=[+ {"host": "10.128.0.2", "port": 6379},+ {"host": "10.128.0.2", "port": 11008},+ ],+ gcp_service_account="projects/-/serviceAccounts/[email protected]",+ gcp_ssl_ca_certs="./server-ca.pem",+ ssl=True,+ ssl_cert_reqs=None,+ ssl_check_hostname=False,+)++# Make completion calls+response1 = completion(+ model="gpt-3.5-turbo",+ messages=[{"role": "user", "content": "Tell me a joke."}]+)+response2 = completion(+ model="gpt-3.5-turbo",+ messages=[{"role": "user", "content": "Tell me a joke."}]+)++# response1 == response2, response 1 is cached+```++**Environment Variables for GCP IAM Redis**++You can also set these as environment variables:++```shell+export REDIS_HOST="10.128.0.2"+export REDIS_PORT="6379"+export REDIS_GCP_SERVICE_ACCOUNT="projects/-/serviceAccounts/[email protected]"+export REDIS_GCP_SSL_CA_CERTS="./server-ca.pem"+export REDIS_SSL="True"+```++Then simply initialize:++```python+litellm.cache = Cache(type="redis")+```+</TabItem><TabItem value="gcs" label="gcs-cache">@@ -534,6 +607,13 @@ def __init__(namespace: Optional[str] = None,default_in_redis_ttl: Optional[float] = None,redis_flush_size=None,++ # GCP IAM Redis authentication params+ gcp_service_account: Optional[str] = None,+ gcp_ssl_ca_certs: Optional[str] = None,+ ssl: Optional[bool] = None,+ ssl_cert_reqs: Optional[Union[str, None]] = None,+ ssl_check_hostname: Optional[bool] = None,# redis semantic cache paramssimilarity_threshold: Optional[float] = None,diff --git a/docs/my-website/docs/proxy/caching.md b/docs/my-website/docs/proxy/caching.mdindex aec734e9142..95d61ede2cb 100644--- a/docs/my-website/docs/proxy/caching.md+++ b/docs/my-website/docs/proxy/caching.md@@ -204,7 +204,96 @@ For quick testing, you can also use REDIS_URL, eg.:REDIS_URL="rediss://.."```-but we **don't** recommend using REDIS_URL in prod. We've noticed a performance difference between using it vs. redis_host, port, etc.+but we **don't** recommend using REDIS_URL in prod. We've noticed a performance difference between using it vs. redis_host, port, etc.++#### GCP IAM Authentication++For GCP Memorystore Redis with IAM authentication, install the required dependency:++```shell+pip install google-cloud-iam+```++<Tabs>++<TabItem value="gcp-iam-config" label="Set on config.yaml">++```yaml+model_list:+ - model_name: gpt-3.5-turbo+ litellm_params:+ model: gpt-3.5-turbo++litellm_settings:+ cache: True+ cache_params:+ type: redis+ host: "10.128.0.2" # Your GCP Redis IP+ port: 6379+ gcp_service_account: "projects/-/serviceAccounts/[email protected]"+ gcp_ssl_ca_certs: "./server-ca.pem" # Path to SSL CA certificate+ ssl: true+ ssl_cert_reqs: null # For self-signed certificates+ ssl_check_hostname: false # For self-signed certificates+```++For Redis Cluster with GCP IAM:++```yaml+litellm_settings:+ cache: True+ cache_params:+ type: redis+ redis_startup_nodes: [{"host": "10.128.0.2", "port": 6379}, {"host": "10.128.0.2", "port": 11008}]+ gcp_service_account: "projects/-/serviceAccounts/[email protected]"+ gcp_ssl_ca_certs: "./server-ca.pem"+ ssl: true+ ssl_cert_reqs: null+ ssl_check_hostname: false+```++</TabItem>++<TabItem value="gcp-iam-env" label="Set on .env">++You can configure GCP IAM Redis authentication in your .env:++```env+REDIS_HOST="10.128.0.2"+REDIS_PORT="6379"+REDIS_GCP_SERVICE_ACCOUNT="projects/-/serviceAccounts/[email protected]"+REDIS_GCP_SSL_CA_CERTS="./server-ca.pem"+REDIS_SSL="True"+REDIS_SSL_CERT_REQS="None"+REDIS_SSL_CHECK_HOSTNAME="False"+```++For Redis Cluster:++```env+REDIS_CLUSTER_NODES='[{"host": "10.128.0.2", "port": 6379}, {"host": "10.128.0.2", "port": 11008}]'+REDIS_GCP_SERVICE_ACCOUNT="projects/-/serviceAccounts/[email protected]"+REDIS_GCP_SSL_CA_CERTS="./server-ca.pem"+REDIS_SSL="True"+REDIS_SSL_CERT_REQS="None"+REDIS_SSL_CHECK_HOSTNAME="False"+```++**GCP Authentication Setup**++Make sure your GCP credentials are configured:++```shell+# Option 1: Service account key file+export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"++# Option 2: If running on GCP compute instance with service account attached+# No additional setup needed+```++</TabItem>++</Tabs>#### Step 2: Add Redis Credentials to .envSet either `REDIS_URL` or the `REDIS_HOST` in your os environment, to enable caching.@@ -917,6 +1006,13 @@ cache_params:password: secret_password # Redis server passwordnamespace: Optional[str] = None,+ # GCP IAM Authentication for Redis+ gcp_service_account: "projects/-/serviceAccounts/[email protected]" # GCP service account for IAM authentication+ gcp_ssl_ca_certs: "./server-ca.pem" # Path to SSL CA certificate file for GCP Memorystore Redis+ ssl: true # Enable SSL for secure connections+ ssl_cert_reqs: null # Set to null for self-signed certificates+ ssl_check_hostname: false # Set to false for self-signed certificates+# S3 cache parameterss3_bucket_name: your_s3_bucket_name # Name of the S3 bucketdiff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.mdindex 853322bd19b..c8aee990415 100644--- a/docs/my-website/docs/proxy/config_settings.md+++ b/docs/my-website/docs/proxy/config_settings.md@@ -58,6 +58,13 @@ litellm_settings:service_name: "mymaster"sentinel_nodes: [["localhost", 26379]]+ # Optional - GCP IAM Authentication for Redis+ gcp_service_account: "projects/-/serviceAccounts/[email protected]" # GCP service account for IAM authentication+ gcp_ssl_ca_certs: "./server-ca.pem" # Path to SSL CA certificate file for GCP Memorystore Redis+ ssl: true # Enable SSL for secure connections+ ssl_cert_reqs: null # Set to null for self-signed certificates+ ssl_check_hostname: false # Set to false for self-signed certificates+# Optional - Qdrant Semantic Cache Settingsqdrant_semantic_cache_embedding_model: openai-embedding # the model should be defined on the model_listqdrant_collection_name: test_collection@@ -649,6 +656,8 @@ router_settings:| REDIS_PASSWORD | Password for Redis service| REDIS_PORT | Port number for Redis server| REDIS_SOCKET_TIMEOUT | Timeout in seconds for Redis socket operations. Default is 0.1+| REDIS_GCP_SERVICE_ACCOUNT | GCP service account for IAM authentication with Redis. Format: "projects/-/serviceAccounts/[email protected]"+| REDIS_GCP_SSL_CA_CERTS | Path to SSL CA certificate file for secure GCP Memorystore Redis connections| REDOC_URL | The path to the Redoc Fast API documentation. **By default this is "/redoc"**| REPEATED_STREAMING_CHUNK_LIMIT | Limit for repeated streaming chunks to detect looping. Default is 100| REPLICATE_MODEL_NAME_WITH_ID_LENGTH | Length of Replicate model names with ID. Default is 64diff --git a/litellm/_redis.py b/litellm/_redis.pyindex cb01064f413..8371ef5bbc7 100644--- a/litellm/_redis.py+++ b/litellm/_redis.py@@ -12,7 +12,7 @@ import json# s/o [@Frank Colson](https://www.linkedin.com/in/frank-colson-422b9b183/) for this redis implementationimport os-from typing import List, Optional, Union+from typing import Callable, List, Optional, Unionimport redis # type: ignoreimport redis.asyncio as async_redis # type: ignore@@ -34,7 +34,7 @@ def _get_redis_kwargs():"retry",}- include_args = ["url"]+ include_args = ["url", "redis_connect_func", "gcp_service_account", "gcp_ssl_ca_certs"]available_args = [x for x in arg_spec.args if x not in exclude_args] + include_args@@ -72,6 +72,12 @@ def _get_redis_cluster_kwargs(client=None):available_args.append("password")available_args.append("username")available_args.append("ssl")+ available_args.append("ssl_cert_reqs")+ available_args.append("ssl_check_hostname")+ available_args.append("ssl_ca_certs")+ available_args.append("redis_connect_func") # Needed for sync clusters and IAM detection+ available_args.append("gcp_service_account")+ available_args.append("gcp_ssl_ca_certs")return available_args@@ -93,6 +99,73 @@ def _redis_kwargs_from_environment():return return_dict+def _generate_gcp_iam_access_token(service_account: str) -> str:+ """+ Generate GCP IAM access token for Redis authentication.++ Args:+ service_account: GCP service account in format 'projects/-/serviceAccounts/[email protected]'++ Returns:+ Access token string for GCP IAM authentication+ """+ try:+ from google.cloud import iam_credentials_v1+ except ImportError:+ raise ImportError(+ "google-cloud-iam is required for GCP IAM Redis authentication. "+ "Install it with: pip install google-cloud-iam"+ )++ client = iam_credentials_v1.IAMCredentialsClient()+ request = iam_credentials_v1.GenerateAccessTokenRequest(+ name=service_account,+ scope=['https://www.googleapis.com/auth/cloud-platform'],+ )+ response = client.generate_access_token(request=request)+ return str(response.access_token)+++def create_gcp_iam_redis_connect_func(+ service_account: str,+ ssl_ca_certs: Optional[str] = None,+) -> Callable:+ """+ Creates a custom Redis connection function for GCP IAM authentication.++ Args:+ service_account: GCP service account in format 'projects/-/serviceAccounts/[email protected]'+ ssl_ca_certs: Path to SSL CA certificate file for secure connections++ Returns:+ A connection function that can be used with Redis clients+ """+ def iam_connect(self):+ """Initialize the connection and authenticate using GCP IAM"""+ from redis.exceptions import AuthenticationError, AuthenticationWrongNumberOfArgsError+ from redis.utils import str_if_bytes++ self._parser.on_connect(self)++ auth_args = (_generate_gcp_iam_access_token(service_account),)+ self.send_command("AUTH", *auth_args, check_health=False)++ try:+ auth_response = self.read_response()+ except AuthenticationWrongNumberOfArgsError:+ # Fallback to password auth if IAM fails+ if hasattr(self, 'password') and self.password:+ self.send_command("AUTH", self.password, check_health=False)+ auth_response = self.read_response()+ else:+ raise++ if str_if_bytes(auth_response) != "OK":+ raise AuthenticationError("GCP IAM authentication failed")++ return iam_connect++def get_redis_url_from_environment():if "REDIS_URL" in os.environ:return os.environ["REDIS_URL"]@@ -156,6 +229,27 @@ def _get_redis_client_logic(**env_overrides):if _service_name is not None:redis_kwargs["service_name"] = _service_name+ # Handle GCP IAM authentication+ _gcp_service_account = redis_kwargs.get("gcp_service_account") or get_secret_str("REDIS_GCP_SERVICE_ACCOUNT")+ _gcp_ssl_ca_certs = redis_kwargs.get("gcp_ssl_ca_certs") or get_secret_str("REDIS_GCP_SSL_CA_CERTS")++ if _gcp_service_account is not None:+ verbose_logger.debug("Setting up GCP IAM authentication for Redis with service account.")+ redis_kwargs["redis_connect_func"] = create_gcp_iam_redis_connect_func(+ service_account=_gcp_service_account,+ ssl_ca_certs=_gcp_ssl_ca_certs+ )+ # Store GCP service account in redis_connect_func for async cluster access+ redis_kwargs["redis_connect_func"]._gcp_service_account = _gcp_service_account++ # Remove GCP-specific kwargs that shouldn't be passed to Redis client+ redis_kwargs.pop("gcp_service_account", None)+ redis_kwargs.pop("gcp_ssl_ca_certs", None)++ # Only enable SSL if explicitly requested AND SSL CA certs are provided+ if _gcp_ssl_ca_certs and redis_kwargs.get("ssl", False):+ redis_kwargs["ssl_ca_certs"] = _gcp_ssl_ca_certs+if "url" in redis_kwargs and redis_kwargs["url"] is not None:redis_kwargs.pop("host", None)redis_kwargs.pop("port", None)@@ -198,7 +292,7 @@ def init_redis_cluster(redis_kwargs) -> redis.RedisCluster:for item in redis_kwargs["startup_nodes"]:new_startup_nodes.append(ClusterNode(**item))- redis_kwargs.pop("startup_nodes")+ cluster_kwargs.pop("startup_nodes", None)return redis.RedisCluster(startup_nodes=new_startup_nodes, **cluster_kwargs) # type: ignore@@ -273,7 +367,7 @@ def get_redis_client(**env_overrides):def get_redis_async_client(**env_overrides,-) -> async_redis.Redis:+) -> Union[async_redis.Redis, async_redis.RedisCluster]:redis_kwargs = _get_redis_client_logic(**env_overrides)if "url" in redis_kwargs and redis_kwargs["url"] is not None:args = _get_redis_url_kwargs(client=async_redis.Redis.from_url)@@ -298,14 +392,46 @@ def get_redis_async_client(if arg in args:cluster_kwargs[arg] = redis_kwargs[arg]+ # Handle GCP IAM authentication for async clusters+ redis_connect_func = cluster_kwargs.pop("redis_connect_func", None)+ from litellm import get_secret_str++ # Get GCP service account - first try from redis_connect_func, then from environment+ gcp_service_account = None+ if redis_connect_func and hasattr(redis_connect_func, '_gcp_service_account'):+ gcp_service_account = redis_connect_func._gcp_service_account+ else:+ gcp_service_account = redis_kwargs.get("gcp_service_account") or get_secret_str("REDIS_GCP_SERVICE_ACCOUNT")++ verbose_logger.info(f"DEBUG: Redis cluster kwargs: redis_connect_func={redis_connect_func is not None}, gcp_service_account_provided={gcp_service_account is not None}")++ # If GCP IAM is configured (indicated by redis_connect_func), generate access token and use as password+ if redis_connect_func and gcp_service_account:+ verbose_logger.info("DEBUG: Generating IAM token for service account (value not logged for security reasons)")+ try:+ # Generate IAM access token using the helper function+ access_token = _generate_gcp_iam_access_token(gcp_service_account)+ cluster_kwargs["password"] = access_token+ verbose_logger.info("DEBUG: Successfully generated GCP IAM access token for async Redis cluster")+ except Exception as e:+ verbose_logger.error(f"Failed to generate GCP IAM access token: {e}")+ from redis.exceptions import AuthenticationError+ raise AuthenticationError("Failed to generate GCP IAM access token")+ else:+ verbose_logger.info(f"DEBUG: Not using GCP IAM auth - redis_connect_func={redis_connect_func is not None}, gcp_service_account={gcp_service_account}")+new_startup_nodes: List[ClusterNode] = []for item in redis_kwargs["startup_nodes"]:new_startup_nodes.append(ClusterNode(**item))- redis_kwargs.pop("startup_nodes")- return async_redis.RedisCluster(+ cluster_kwargs.pop("startup_nodes", None)++ # Create async RedisCluster with IAM token as password if available+ cluster_client = async_redis.RedisCluster(startup_nodes=new_startup_nodes, **cluster_kwargs # type: ignore)++ return cluster_client# Check for Redis Sentinelif "sentinel_nodes" in redis_kwargs and "service_name" in redis_kwargs:diff --git a/litellm/caching/caching.py b/litellm/caching/caching.pyindex 8416790edb1..1455e011bc5 100644--- a/litellm/caching/caching.py+++ b/litellm/caching/caching.py@@ -106,6 +106,9 @@ class Cache:qdrant_collection_name: Optional[str] = None,qdrant_quantization_config: Optional[str] = None,qdrant_semantic_cache_embedding_model: str = "text-embedding-ada-002",+ # GCP IAM authentication parameters+ gcp_service_account: Optional[str] = None,+ gcp_ssl_ca_certs: Optional[str] = None,**kwargs,):"""@@ -161,14 +164,21 @@ class Cache:"""if type == LiteLLMCacheType.REDIS:if redis_startup_nodes:- self.cache: BaseCache = RedisClusterCache(- host=host,- port=port,- password=password,- redis_flush_size=redis_flush_size,- startup_nodes=redis_startup_nodes,+ # Only pass GCP parameters if they are provided+ cluster_kwargs = {+ "host": host,+ "port": port,+ "password": password,+ "redis_flush_size": redis_flush_size,+ "startup_nodes": redis_startup_nodes,**kwargs,- )+ }+ if gcp_service_account is not None:+ cluster_kwargs["gcp_service_account"] = gcp_service_account+ if gcp_ssl_ca_certs is not None:+ cluster_kwargs["gcp_ssl_ca_certs"] = gcp_ssl_ca_certs++ self.cache: BaseCache = RedisClusterCache(**cluster_kwargs)else:self.cache = RedisCache(host=host,diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex dffb12873ce..c77f4f5317c 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -126,6 +126,7 @@ import litellmfrom litellm import Routerfrom litellm._logging import verbose_proxy_logger, verbose_router_loggerfrom litellm.caching.caching import DualCache, RedisCache+from litellm.caching.redis_cluster_cache import RedisClusterCachefrom litellm.constants import (DAYS_IN_A_MONTH,DEFAULT_HEALTH_CHECK_INTERVAL,@@ -1591,7 +1592,7 @@ class ProxyConfig:litellm.cache = Cache(**cache_params)- if litellm.cache is not None and isinstance(litellm.cache.cache, RedisCache):+ if litellm.cache is not None and isinstance(litellm.cache.cache, (RedisCache, RedisClusterCache)):## INIT PROXY REDIS USAGE CLIENT ##redis_usage_cache = litellm.cache.cachediff --git a/poetry.lock b/poetry.lockindex 31be122c788..8a641c0489e 100644--- a/poetry.lock+++ b/poetry.lock@@ -1,4 +1,4 @@-# This file is automatically @generated by Poetry 2.1.2 and should not be changed by hand.+# This file is automatically @generated by Poetry 2.1.3 and should not be changed by hand.[[package]]name = "aiohappyeyeballs"@@ -530,7 +530,7 @@ description = "Extensible memoizing collections and decorators"optional = truepython-versions = ">=3.7"groups = ["main"]-markers = "python_version >= \"3.10\" and (extra == \"mlflow\" or extra == \"extra-proxy\") or extra == \"extra-proxy\""+markers = "python_version >= \"3.11\" and (extra == \"mlflow\" or extra == \"extra-proxy\") or python_version >= \"3.10\" and (extra == \"extra-proxy\" or extra == \"mlflow\") or extra == \"extra-proxy\""files = [{file = "cachetools-5.5.2-py3-none-any.whl", hash = "sha256:d26a22bcc62eb95c3beabd9f1ee5e820d3d2704fe2967cbe350e20c8ffcd3f0a"},{file = "cachetools-5.5.2.tar.gz", hash = "sha256:1a661caa9175d26759571b2e19580f9d6393969e5dfca11fdb1f947a23e640d4"},@@ -791,7 +791,7 @@ files = [{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},]-markers = {main = "sys_platform == \"win32\" and (extra == \"utils\" or extra == \"semantic-router\") and python_version >= \"3.9\" or platform_system == \"Windows\" or sys_platform == \"win32\" and extra == \"utils\"", dev = "platform_system == \"Windows\" or sys_platform == \"win32\"", proxy-dev = "platform_system == \"Windows\""}+markers = {main = "platform_system == \"Windows\" or sys_platform == \"win32\" and python_version >= \"3.9\" and (extra == \"utils\" or extra == \"semantic-router\") or sys_platform == \"win32\" and extra == \"utils\"", dev = "platform_system == \"Windows\" or sys_platform == \"win32\"", proxy-dev = "platform_system == \"Windows\""}[[package]]name = "coloredlogs"@@ -800,7 +800,7 @@ description = "Colored terminal output for Python's logging module"optional = truepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"groups = ["main"]-markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and python_version < \"3.14\""+markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and python_version <= \"3.13\""files = [{file = "coloredlogs-15.0.1-py2.py3-none-any.whl", hash = "sha256:612ee75c546f53e92e70049c9dbfcc18c935a2b9a53b66085ce9ef6a6e5c0934"},{file = "coloredlogs-15.0.1.tar.gz", hash = "sha256:7c991aa71a4577af2f82600d8f8f3a89f936baeaf9b50a9c197da014e5bf16b0"},@@ -1144,7 +1144,7 @@ description = "FastAPI framework, high performance, easy to learn, fast to code,optional = truepython-versions = ">=3.8"groups = ["main"]-markers = "python_version >= \"3.10\" and (extra == \"mlflow\" or extra == \"proxy\") or extra == \"proxy\""+markers = "python_version >= \"3.11\" and (extra == \"mlflow\" or extra == \"proxy\") or python_version >= \"3.10\" and (extra == \"proxy\" or extra == \"mlflow\") or extra == \"proxy\""files = [{file = "fastapi-0.115.14-py3-none-any.whl", hash = "sha256:6c0c8bf9420bd58f565e585036d971872472b4f7d3f6c73b698e10cffdefb3ca"},{file = "fastapi-0.115.14.tar.gz", hash = "sha256:b1de15cdc1c499a4da47914db35d0e4ef8f1ce62b624e94e0e5824421df99739"},@@ -1560,8 +1560,8 @@ grpcio-status = [{version = ">=1.33.2,<2.0.0", optional = true, markers = "extra == \"grpc\""},]proto-plus = [- {version = ">=1.22.3,<2.0.0"},{version = ">=1.25.0,<2.0.0", markers = "python_version >= \"3.13\""},+ {version = ">=1.22.3,<2.0.0"},]protobuf = ">=3.19.5,<3.20.0 || >3.20.0,<3.20.1 || >3.20.1,<4.21.0 || >4.21.0,<4.21.1 || >4.21.1,<4.21.2 || >4.21.2,<4.21.3 || >4.21.3,<4.21.4 || >4.21.4,<4.21.5 || >4.21.5,<7.0.0"requests = ">=2.18.0,<3.0.0"@@ -1579,7 +1579,7 @@ description = "Google Authentication Library"optional = truepython-versions = ">=3.7"groups = ["main"]-markers = "python_version >= \"3.10\" and (extra == \"mlflow\" or extra == \"extra-proxy\") or extra == \"extra-proxy\""+markers = "python_version >= \"3.11\" and (extra == \"mlflow\" or extra == \"extra-proxy\") or python_version >= \"3.10\" and (extra == \"extra-proxy\" or extra == \"mlflow\") or extra == \"extra-proxy\""files = [{file = "google_auth-2.40.3-py2.py3-none-any.whl", hash = "sha256:1370d4593e86213563547f97a92752fc658456fe4514c809544f330fed45a7ca"},{file = "google_auth-2.40.3.tar.gz", hash = "sha256:500c3a29adedeb36ea9cf24b8d10858e152f2412e3ca37829b3fa18e33d63b77"},@@ -1600,6 +1600,29 @@ requests = ["requests (>=2.20.0,<3.0.0)"]testing = ["aiohttp (<3.10.0)", "aiohttp (>=3.6.2,<4.0.0)", "aioresponses", "cryptography (<39.0.0) ; python_version < \"3.8\"", "cryptography (>=38.0.3)", "flask", "freezegun", "grpcio", "mock", "oauth2client", "packaging", "pyjwt (>=2.0)", "pyopenssl (<24.3.0)", "pyopenssl (>=20.0.0)", "pytest", "pytest-asyncio", "pytest-cov", "pytest-localserver", "pyu2f (>=0.1.5)", "requests (>=2.20.0,<3.0.0)", "responses", "urllib3"]urllib3 = ["packaging", "urllib3"]+[[package]]+name = "google-cloud-iam"+version = "2.19.1"+description = "Google Cloud Iam API client library"+optional = true+python-versions = ">=3.7"+groups = ["main"]+markers = "extra == \"extra-proxy\""+files = [+ {file = "google_cloud_iam-2.19.1-py3-none-any.whl", hash = "sha256:11b08b86d82510021f9dd9f0beb5a08219e070deab09e28d4c0ce49f8c70997d"},+ {file = "google_cloud_iam-2.19.1.tar.gz", hash = "sha256:f059c369ad98af6be3401f0f5d087775d775fb96833be1e9ab8048c422fb1bf4"},+]++[package.dependencies]+google-api-core = {version = ">=1.34.1,<2.0.dev0 || >=2.11.dev0,<3.0.0", extras = ["grpc"]}+google-auth = ">=2.14.1,<2.24.0 || >2.24.0,<2.25.0 || >2.25.0,<3.0.0"+grpc-google-iam-v1 = ">=0.12.4,<1.0.0"+proto-plus = [+ {version = ">=1.25.0,<2.0.0", markers = "python_version >= \"3.13\""},+ {version = ">=1.22.3,<2.0.0", markers = "python_version < \"3.13\""},+]+protobuf = ">=3.20.2,<4.21.0 || >4.21.0,<4.21.1 || >4.21.1,<4.21.2 || >4.21.2,<4.21.3 || >4.21.3,<4.21.4 || >4.21.4,<4.21.5 || >4.21.5,<7.0.0"+[[package]]name = "google-cloud-kms"version = "2.24.2"@@ -1699,7 +1722,7 @@ description = "Lightweight in-process concurrent programming"optional = truepython-versions = ">=3.9"groups = ["main"]-markers = "python_version >= \"3.10\" and (platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\") and extra == \"mlflow\" and python_version < \"3.14\""+markers = "python_version >= \"3.10\" and extra == \"mlflow\" and (platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\") and python_version <= \"3.13\""files = [{file = "greenlet-3.2.3-cp310-cp310-macosx_11_0_universal2.whl", hash = "sha256:1afd685acd5597349ee6d7a88a8bec83ce13c106ac78c196ee9dde7c04fe87be"},{file = "greenlet-3.2.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:761917cac215c61e9dc7324b2606107b3b292a8349bdebb31503ab4de3f559ac"},@@ -1873,7 +1896,7 @@ description = "WSGI HTTP Server for UNIX"optional = truepython-versions = ">=3.7"groups = ["main"]-markers = "platform_system != \"Windows\" and (extra == \"mlflow\" or extra == \"proxy\") and python_version >= \"3.10\" or extra == \"proxy\""+markers = "python_version >= \"3.11\" and platform_system != \"Windows\" and (extra == \"mlflow\" or extra == \"proxy\") or extra == \"proxy\" or python_version >= \"3.10\" and (extra == \"proxy\" or extra == \"mlflow\") and platform_system != \"Windows\""files = [{file = "gunicorn-23.0.0-py3-none-any.whl", hash = "sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d"},{file = "gunicorn-23.0.0.tar.gz", hash = "sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec"},@@ -2057,7 +2080,7 @@ description = "Human friendly output for text interfaces using Python"optional = truepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"groups = ["main"]-markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and python_version < \"3.14\""+markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and python_version <= \"3.13\""files = [{file = "humanfriendly-10.0-py2.py3-none-any.whl", hash = "sha256:1697e1a8a8f550fd43c2865cd84542fc175a61dcb779b6fee18cf6b6ccba1477"},{file = "humanfriendly-10.0.tar.gz", hash = "sha256:6b0b831ce8f15f7300721aa49829fc4e83921a9a301cc7f606be6686a2288ddc"},@@ -2786,7 +2809,7 @@ description = ""optional = truepython-versions = ">=3.9"groups = ["main"]-markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and python_version < \"3.14\""+markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and python_version <= \"3.13\""files = [{file = "ml_dtypes-0.4.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:1fe8b5b5e70cd67211db94b05cfd58dace592f24489b038dc6f9fe347d2e07d5"},{file = "ml_dtypes-0.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8c09a6d11d8475c2a9fd2bc0695628aec105f97cab3b3a3fb7c9660348ff7d24"},@@ -2809,10 +2832,10 @@ files = [[package.dependencies]numpy = [+ {version = ">=1.26.0", markers = "python_version >= \"3.12\""},{version = ">=1.23.3", markers = "python_version >= \"3.11\""},{version = ">1.20"},{version = ">=1.21.2", markers = "python_version >= \"3.10\""},- {version = ">=1.26.0", markers = "python_version >= \"3.12\""},][package.extras]@@ -3162,7 +3185,7 @@ description = "Fundamental package for array computing in Python"optional = truepython-versions = ">=3.9"groups = ["main"]-markers = "python_version >= \"3.9\" and (python_version >= \"3.10\" or extra == \"extra-proxy\" or extra == \"semantic-router\") and (python_version < \"3.14\" or extra == \"semantic-router\" or extra == \"mlflow\") and (extra == \"extra-proxy\" or extra == \"semantic-router\" or extra == \"mlflow\")"+markers = "python_version == \"3.13\" and extra == \"extra-proxy\" or python_version >= \"3.13\" and (extra == \"semantic-router\" or extra == \"mlflow\") or python_version >= \"3.9\" and (python_version >= \"3.10\" or extra == \"extra-proxy\" or extra == \"semantic-router\") and (extra == \"extra-proxy\" or extra == \"semantic-router\" or extra == \"mlflow\") and python_version < \"3.13\""files = [{file = "numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0"},{file = "numpy-1.26.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a"},@@ -3567,9 +3590,9 @@ files = [[package.dependencies]numpy = [+ {version = ">=1.26.0", markers = "python_version >= \"3.12\""},{version = ">=1.23.2", markers = "python_version == \"3.11\""},{version = ">=1.22.4", markers = "python_version < \"3.11\""},- {version = ">=1.26.0", markers = "python_version >= \"3.12\""},]python-dateutil = ">=2.8.2"pytz = ">=2020.1"@@ -4029,7 +4052,7 @@ files = [{file = "protobuf-4.25.8-py3-none-any.whl", hash = "sha256:15a0af558aa3b13efef102ae6e4f3efac06f1eea11afb3a57db2901447d9fb59"},{file = "protobuf-4.25.8.tar.gz", hash = "sha256:6135cf8affe1fc6f76cced2641e4ea8d3e59518d1f24ae41ba97bcad82d397cd"},]-markers = {main = "python_version >= \"3.10\" and (extra == \"mlflow\" or extra == \"extra-proxy\") or extra == \"extra-proxy\""}+markers = {main = "python_version >= \"3.11\" and (extra == \"mlflow\" or extra == \"extra-proxy\") or python_version >= \"3.10\" and (extra == \"extra-proxy\" or extra == \"mlflow\") or extra == \"extra-proxy\""}[[package]]name = "pyarrow"@@ -4095,7 +4118,7 @@ description = "Pure-Python implementation of ASN.1 types and DER/BER/CER codecsoptional = truepython-versions = ">=3.8"groups = ["main"]-markers = "python_version >= \"3.10\" and (extra == \"mlflow\" or extra == \"extra-proxy\") or extra == \"extra-proxy\""+markers = "python_version >= \"3.11\" and (extra == \"mlflow\" or extra == \"extra-proxy\") or python_version >= \"3.10\" and (extra == \"extra-proxy\" or extra == \"mlflow\") or extra == \"extra-proxy\""files = [{file = "pyasn1-0.6.1-py3-none-any.whl", hash = "sha256:0d632f46f2ba09143da3a8afe9e33fb6f92fa2320ab7e886e2d0f7672af84629"},{file = "pyasn1-0.6.1.tar.gz", hash = "sha256:6f580d2bdd84365380830acf45550f2511469f673cb4a5ae3857a3170128b034"},@@ -4108,7 +4131,7 @@ description = "A collection of ASN.1-based protocols modules"optional = truepython-versions = ">=3.8"groups = ["main"]-markers = "python_version >= \"3.10\" and (extra == \"mlflow\" or extra == \"extra-proxy\") or extra == \"extra-proxy\""+markers = "python_version >= \"3.11\" and (extra == \"mlflow\" or extra == \"extra-proxy\") or python_version >= \"3.10\" and (extra == \"extra-proxy\" or extra == \"mlflow\") or extra == \"extra-proxy\""files = [{file = "pyasn1_modules-0.4.2-py3-none-any.whl", hash = "sha256:29253a9207ce32b64c3ac6600edc75368f98473906e8fd1043bd6b5b1de2c14a"},{file = "pyasn1_modules-0.4.2.tar.gz", hash = "sha256:677091de870a80aae844b1ca6134f54652fa2c8c5a52aa396440ac3106e941e6"},@@ -4402,7 +4425,7 @@ description = "A python implementation of GNU readline."optional = truepython-versions = ">=3.8"groups = ["main"]-markers = "python_version >= \"3.9\" and sys_platform == \"win32\" and extra == \"extra-proxy\" and python_version < \"3.14\""+markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and sys_platform == \"win32\" and python_version <= \"3.13\""files = [{file = "pyreadline3-3.5.4-py3-none-any.whl", hash = "sha256:eaf8e6cc3c49bcccf145fc6067ba8643d1df34d604a1ec0eccbf7a18e6d3fae6"},{file = "pyreadline3-3.5.4.tar.gz", hash = "sha256:8d57d53039a1c75adba8e50dd3d992b28143480816187ea5efbd5c78e6c885b7"},@@ -4478,7 +4501,7 @@ description = "Extensions to the standard Python datetime module"optional = truepython-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"groups = ["main"]-markers = "python_version >= \"3.10\" and (extra == \"mlflow\" or extra == \"proxy\") or extra == \"proxy\""+markers = "python_version >= \"3.11\" and (extra == \"mlflow\" or extra == \"proxy\") or python_version >= \"3.10\" and (extra == \"proxy\" or extra == \"mlflow\") or extra == \"proxy\""files = [{file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"},{file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"},@@ -4522,7 +4545,7 @@ description = "Universally unique lexicographically sortable identifier"optional = truepython-versions = ">=3.9"groups = ["main"]-markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and python_version < \"3.14\""+markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and python_version <= \"3.13\""files = [{file = "python_ulid-3.0.0-py3-none-any.whl", hash = "sha256:e4c4942ff50dbd79167ad01ac725ec58f924b4018025ce22c858bfcff99a5e31"},{file = "python_ulid-3.0.0.tar.gz", hash = "sha256:e50296a47dc8209d28629a22fc81ca26c00982c78934bd7766377ba37ea49a9f"},@@ -4551,7 +4574,7 @@ description = "Python for Window Extensions"optional = truepython-versions = "*"groups = ["main"]-markers = "python_version >= \"3.10\" and sys_platform == \"win32\" and (extra == \"proxy\" or extra == \"mlflow\")"+markers = "python_version >= \"3.10\" and (extra == \"proxy\" or extra == \"mlflow\") and sys_platform == \"win32\""files = [{file = "pywin32-311-cp310-cp310-win32.whl", hash = "sha256:d03ff496d2a0cd4a5893504789d4a15399133fe82517455e78bad62efbb7f0a3"},{file = "pywin32-311-cp310-cp310-win_amd64.whl", hash = "sha256:797c2772017851984b97180b0bebe4b620bb86328e8a884bb626156295a63b3b"},@@ -4645,7 +4668,7 @@ description = "Python client for Redis database and key-value store"optional = truepython-versions = ">=3.8"groups = ["main"]-markers = "python_version >= \"3.9\" and (extra == \"extra-proxy\" or extra == \"proxy\") and python_version < \"3.14\" or extra == \"proxy\""+markers = "python_version == \"3.13\" and (extra == \"extra-proxy\" or extra == \"proxy\") or python_version >= \"3.9\" and (extra == \"proxy\" or extra == \"extra-proxy\") and python_version <= \"3.13\" or extra == \"proxy\""files = [{file = "redis-5.3.1-py3-none-any.whl", hash = "sha256:dc1909bd24669cc31b5f67a039700b16ec30571096c5f1f0d9d2324bff31af97"},{file = "redis-5.3.1.tar.gz", hash = "sha256:ca49577a531ea64039b5a36db3d6cd1a0c7a60c34124d46924a45b956e8cf14c"},@@ -4666,7 +4689,7 @@ description = "Python client library and CLI for using Redis as a vector databasoptional = truepython-versions = "<3.14,>=3.9"groups = ["main"]-markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and python_version < \"3.14\""+markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and python_version <= \"3.13\""files = [{file = "redisvl-0.4.1-py3-none-any.whl", hash = "sha256:6db5d5bc95b1fe8032a1cdae74ce1c65bc7fe9054e5429b5d34d5a91d28bae5f"},{file = "redisvl-0.4.1.tar.gz", hash = "sha256:fd6a36426ba94792c0efca20915c31232d4ee3cc58eb23794a62c142696401e6"},@@ -4676,8 +4699,8 @@ files = [coloredlogs = ">=15.0,<16.0"ml-dtypes = ">=0.4.0,<0.5.0"numpy = [- {version = ">=1,<2", markers = "python_version < \"3.12\""},{version = ">=1.26.0,<3", markers = "python_version >= \"3.12\""},+ {version = ">=1,<2", markers = "python_version < \"3.12\""},]pydantic = ">=2,<3"python-ulid = ">=3.0.0,<4.0.0"@@ -5064,7 +5087,7 @@ description = "Pure-Python RSA implementation"optional = truepython-versions = "<4,>=3.6"groups = ["main"]-markers = "python_version >= \"3.10\" and (extra == \"mlflow\" or extra == \"extra-proxy\") or extra == \"extra-proxy\""+markers = "python_version >= \"3.11\" and (extra == \"mlflow\" or extra == \"extra-proxy\") or python_version >= \"3.10\" and (extra == \"extra-proxy\" or extra == \"mlflow\") or extra == \"extra-proxy\""files = [{file = "rsa-4.9.1-py3-none-any.whl", hash = "sha256:68635866661c6836b8d39430f97a996acbd61bfa49406748ea243539fe239762"},{file = "rsa-4.9.1.tar.gz", hash = "sha256:e7bdbfdb5497da4c07dfd35530e1a902659db6ff241e39d9953cad06ebd0ae75"},@@ -5593,7 +5616,7 @@ description = "The little ASGI library that shines."optional = truepython-versions = ">=3.8"groups = ["main"]-markers = "python_version >= \"3.10\" and (extra == \"mlflow\" or extra == \"proxy\") or extra == \"proxy\""+markers = "python_version >= \"3.11\" and (extra == \"mlflow\" or extra == \"proxy\") or python_version >= \"3.10\" and (extra == \"proxy\" or extra == \"mlflow\") or extra == \"proxy\""files = [{file = "starlette-0.44.0-py3-none-any.whl", hash = "sha256:19edeb75844c16dcd4f9dd72f22f9108c1539f3fc9c4c88885654fef64f85aea"},{file = "starlette-0.44.0.tar.gz", hash = "sha256:e35166950a3ccccc701962fe0711db0bc14f2ecd37c6f9fe5e3eae0cbaea8715"},@@ -5612,7 +5635,7 @@ description = "Pretty-print tabular data"optional = truepython-versions = ">=3.7"groups = ["main"]-markers = "python_version >= \"3.9\" and (extra == \"extra-proxy\" or extra == \"utils\") and python_version < \"3.14\" or extra == \"utils\""+markers = "python_version == \"3.13\" and (extra == \"extra-proxy\" or extra == \"utils\") or python_version >= \"3.9\" and (extra == \"utils\" or extra == \"extra-proxy\") and python_version <= \"3.13\" or extra == \"utils\""files = [{file = "tabulate-0.9.0-py3-none-any.whl", hash = "sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f"},{file = "tabulate-0.9.0.tar.gz", hash = "sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c"},@@ -5645,7 +5668,7 @@ description = "Retry code until it succeeds"optional = truepython-versions = ">=3.9"groups = ["main"]-markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and python_version < \"3.14\""+markers = "python_version >= \"3.9\" and extra == \"extra-proxy\" and python_version <= \"3.13\""files = [{file = "tenacity-9.1.2-py3-none-any.whl", hash = "sha256:f77bf36710d8b73a50b2dd155c97b870017ad21afe6ab300326b0371b3b05138"},{file = "tenacity-9.1.2.tar.gz", hash = "sha256:1169d376c297e7de388d18b4481760d478b0e99a777cad3a9c86e556f4b697cb"},@@ -6052,7 +6075,7 @@ description = "The lightning-fast ASGI server."optional = truepython-versions = ">=3.8"groups = ["main"]-markers = "python_version >= \"3.10\" and (extra == \"mlflow\" or extra == \"proxy\") or extra == \"proxy\""+markers = "python_version >= \"3.11\" and (extra == \"mlflow\" or extra == \"proxy\") or python_version >= \"3.10\" and (extra == \"proxy\" or extra == \"mlflow\") or extra == \"proxy\""files = [{file = "uvicorn-0.29.0-py3-none-any.whl", hash = "sha256:2c2aac7ff4f4365c206fd773a39bf4ebd1047c238f8b8268ad996829323473de"},{file = "uvicorn-0.29.0.tar.gz", hash = "sha256:6a69214c0b6a087462412670b3ef21224fa48cae0e452b5883e8e8bdfdd11dd0"},@@ -6126,7 +6149,7 @@ description = "Waitress WSGI server"optional = truepython-versions = ">=3.9.0"groups = ["main"]-markers = "python_version >= \"3.10\" and platform_system == \"Windows\" and extra == \"mlflow\""+markers = "python_version >= \"3.10\" and extra == \"mlflow\" and platform_system == \"Windows\""files = [{file = "waitress-3.0.2-py3-none-any.whl", hash = "sha256:c56d67fd6e87c2ee598b76abdd4e96cfad1f24cacdea5078d382b1f9d7b5ed2e"},{file = "waitress-3.0.2.tar.gz", hash = "sha256:682aaaf2af0c44ada4abfb70ded36393f0e307f4ab9456a215ce0020baefc31f"},@@ -6492,7 +6515,7 @@ type = ["pytest-mypy"][extras]caching = ["diskcache"]-extra-proxy = ["azure-identity", "azure-keyvault-secrets", "google-cloud-kms", "prisma", "redisvl", "resend"]+extra-proxy = ["azure-identity", "azure-keyvault-secrets", "google-cloud-iam", "google-cloud-kms", "prisma", "redisvl", "resend"]mlflow = ["mlflow"]proxy = ["PyJWT", "apscheduler", "azure-identity", "azure-storage-blob", "backoff", "boto3", "cryptography", "fastapi", "fastapi-sso", "gunicorn", "litellm-enterprise", "litellm-proxy-extras", "mcp", "orjson", "polars", "pynacl", "python-multipart", "pyyaml", "rich", "rq", "uvicorn", "uvloop", "websockets"]semantic-router = ["semantic-router"]@@ -6501,4 +6524,4 @@ utils = ["numpydoc"][metadata]lock-version = "2.1"python-versions = ">=3.8.1,<4.0, !=3.9.7"-content-hash = "d932532149768069e9b4002e113e8ced494318055c69d79e9ef22f535d96a20c"+content-hash = "4028a46e4d7c526e2fa7215ce4786f7f8b3c31c944686fb124e95b40ab86eccb"diff --git a/pyproject.toml b/pyproject.tomlindex 8bb8e03dad8..625ef4de0aa 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -51,6 +51,7 @@ azure-identity = {version = "^1.15.0", optional = true}azure-keyvault-secrets = {version = "^4.8.0", optional = true}azure-storage-blob = {version="^12.25.1", optional=true}google-cloud-kms = {version = "^2.21.3", optional = true}+google-cloud-iam = {version = "^2.19.1", optional = true}resend = {version = "^0.8.0", optional = true}pynacl = {version = "^1.5.0", optional = true}websockets = {version = "^13.1.0", optional = true}@@ -97,6 +98,7 @@ extra_proxy = ["azure-identity","azure-keyvault-secrets","google-cloud-kms",+ "google-cloud-iam","resend","redisvl"]diff --git a/requirements.txt b/requirements.txtindex 9a7ce42e3be..8278ff2513e 100644--- a/requirements.txt+++ b/requirements.txt@@ -14,6 +14,7 @@ prisma==0.11.0 # for dbmangum==0.17.0 # for aws lambda functionspynacl==1.5.0 # for encrypting keysgoogle-cloud-aiplatform==1.47.0 # for vertex ai calls+google-cloud-iam==2.19.1 # for GCP IAM Redis authenticationgoogle-genai==1.22.0anthropic[vertex]==0.54.0mcp==1.10.1 # for MCP serverdiff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.pyindex b342f268cbd..c17535bf0ec 100644--- a/tests/test_litellm/test_utils.py+++ b/tests/test_litellm/test_utils.py@@ -2350,6 +2350,67 @@ def test_block_key_hashing_logic():print("✅ All block_key hashing logic tests passed!")+def test_generate_gcp_iam_access_token():+ """+ Test the _generate_gcp_iam_access_token function with mocked GCP IAM client.+ """+ from unittest.mock import Mock, patch++ service_account = "projects/-/serviceAccounts/[email protected]"+ expected_token = "test-access-token-12345"++ # Mock the GCP IAM client and its response+ mock_response = Mock()+ mock_response.access_token = expected_token++ mock_client = Mock()+ mock_client.generate_access_token.return_value = mock_response++ # Mock the iam_credentials_v1 module+ mock_iam_credentials_v1 = Mock()+ mock_iam_credentials_v1.IAMCredentialsClient = Mock(return_value=mock_client)+ mock_iam_credentials_v1.GenerateAccessTokenRequest = Mock()++ # Test successful token generation by mocking sys.modules+ with patch.dict('sys.modules', {'google.cloud.iam_credentials_v1': mock_iam_credentials_v1}):+ from litellm._redis import _generate_gcp_iam_access_token++ result = _generate_gcp_iam_access_token(service_account)++ assert result == expected_token+ mock_iam_credentials_v1.IAMCredentialsClient.assert_called_once()+ mock_client.generate_access_token.assert_called_once()++ # Verify the request was created with correct parameters+ mock_iam_credentials_v1.GenerateAccessTokenRequest.assert_called_once_with(+ name=service_account,+ scope=['https://www.googleapis.com/auth/cloud-platform']+ )+++def test_generate_gcp_iam_access_token_import_error():+ """+ Test that _generate_gcp_iam_access_token raises ImportError when google-cloud-iam is not available.+ """+ # Import the function first, before mocking+ from litellm._redis import _generate_gcp_iam_access_token++ # Mock the import to fail when the function tries to import google.cloud.iam_credentials_v1+ original_import = __builtins__['__import__']++ def mock_import(name, *args, **kwargs):+ if name == 'google.cloud.iam_credentials_v1':+ raise ImportError("No module named 'google.cloud.iam_credentials_v1'")+ return original_import(name, *args, **kwargs)++ with patch('builtins.__import__', side_effect=mock_import):+ with pytest.raises(ImportError) as exc_info:+ _generate_gcp_iam_access_token("test-service-account")++ assert "google-cloud-iam is required" in str(exc_info.value)+ assert "pip install google-cloud-iam" in str(exc_info.value)++if __name__ == "__main__":# Allow running this test file directly for debuggingpytest.main([__file__, "-v"])