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]

list path now routes to Vertex

naaa760c54986c3c983
diff --git a/litellm/batches/main.py b/litellm/batches/main.py
index 838ee95b2b5..995c45b925a 100644
--- a/litellm/batches/main.py
+++ b/litellm/batches/main.py
@@ -644,7 +644,7 @@ def retrieve_batch(
async def alist_batches(
after: Optional[str] = None,
limit: Optional[int] = None,
- custom_llm_provider: Literal["openai", "azure"] = "openai",
+ custom_llm_provider: Literal["openai", "azure", "vertex_ai"] = "openai",
metadata: Optional[Dict[str, str]] = None,
extra_headers: Optional[Dict[str, str]] = None,
extra_body: Optional[Dict[str, str]] = None,
@@ -687,7 +687,7 @@ async def alist_batches(
def list_batches(
after: Optional[str] = None,
limit: Optional[int] = None,
- custom_llm_provider: Literal["openai", "azure"] = "openai",
+ custom_llm_provider: Literal["openai", "azure", "vertex_ai"] = "openai",
extra_headers: Optional[Dict[str, str]] = None,
extra_body: Optional[Dict[str, str]] = None,
**kwargs,
@@ -784,9 +784,36 @@ def list_batches(
max_retries=optional_params.max_retries,
litellm_params=litellm_params,
)
+ elif custom_llm_provider == "vertex_ai":
+ api_base = optional_params.api_base or ""
+ vertex_ai_project = (
+ optional_params.vertex_project
+ or litellm.vertex_project
+ or get_secret_str("VERTEXAI_PROJECT")
+ )
+ vertex_ai_location = (
+ optional_params.vertex_location
+ or litellm.vertex_location
+ or get_secret_str("VERTEXAI_LOCATION")
+ )
+ vertex_credentials = optional_params.vertex_credentials or get_secret_str(
+ "VERTEXAI_CREDENTIALS"
+ )
+
+ response = vertex_ai_batches_instance.list_batches(
+ _is_async=_is_async,
+ after=after,
+ limit=limit,
+ api_base=api_base,
+ vertex_project=vertex_ai_project,
+ vertex_location=vertex_ai_location,
+ vertex_credentials=vertex_credentials,
+ timeout=timeout,
+ max_retries=optional_params.max_retries,
+ )
else:
raise litellm.exceptions.BadRequestError(
- message="LiteLLM doesn't support {} for 'list_batch'. Only 'openai' is supported.".format(
+ message="LiteLLM doesn't support {} for 'list_batch'. Supported providers: openai, azure, vertex_ai.".format(
custom_llm_provider
),
model="n/a",