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
fix(vertex-ai): address greptile review feedback on batch cancel
Sameer Kankute74382f1c89cf
diff --git a/litellm/llms/vertex_ai/batches/handler.py b/litellm/llms/vertex_ai/batches/handler.pyindex 36728499b9c..b30130688d2 100644--- a/litellm/llms/vertex_ai/batches/handler.py+++ b/litellm/llms/vertex_ai/batches/handler.py@@ -399,14 +399,11 @@ class VertexAIBatchPrediction(VertexLLM):vertex_project=vertex_project or project_id,)- # Compute endpoint from the URL without :cancel for consistency with other methods- base_without_cancel = f"{default_api_base}/{batch_id}"- default_api_base = f"{base_without_cancel}:cancel"+ retrieve_api_base_default = f"{default_api_base}/{batch_id}"+ default_api_base = f"{retrieve_api_base_default}:cancel"- if len(base_without_cancel.split(":")) > 1:- endpoint = base_without_cancel.split(":")[-1]- else:- endpoint = ""+ # The Vertex AI action suffix for this operation+ endpoint = "cancel"_, api_base = self._check_custom_proxy(api_base=api_base,@@ -422,13 +419,9 @@ class VertexAIBatchPrediction(VertexLLM):vertex_api_version="v1",)- if not api_base.endswith(":cancel"):- raise ValueError(- f"cancel_batch: expected api_base to end with ':cancel', got: {api_base!r}. "- "Custom proxy URL rewriting is not supported for this operation."- )-- retrieve_api_base = api_base.rsplit(":cancel", 1)[0]+ # Use the canonical retrieve URL built from components rather than stripping+ # ":cancel" from api_base, so custom proxy URL rewriting does not break retrieval.+ retrieve_api_base = retrieve_api_base_defaultheaders = {"Content-Type": "application/json; charset=utf-8",diff --git a/litellm/proxy/batches_endpoints/endpoints.py b/litellm/proxy/batches_endpoints/endpoints.pyindex 9ce1b6e9168..3b26e6c096c 100644--- a/litellm/proxy/batches_endpoints/endpoints.py+++ b/litellm/proxy/batches_endpoints/endpoints.py@@ -898,9 +898,9 @@ async def cancel_batch(else:custom_llm_provider = (provider+ or data.pop("custom_llm_provider", None)or get_custom_llm_provider_from_request_headers(request=request)or get_custom_llm_provider_from_request_query(request=request)- or data.pop("custom_llm_provider", None)or "openai")# Extract batch_id from data to avoid "multiple values for keyword argument" error