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]

Fix batch tests

Sameer Kankute991fee056f89
diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py
index 4e1112329ee..e70d6cb7fca 100644
--- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py
+++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py
@@ -396,7 +396,7 @@ class AnthropicPassthroughLoggingHandler:
# Add batch-specific metadata to indicate this is a pending batch job
litellm_model_response.choices = [Choices(
- finish_reason="batch_pending",
+ finish_reason="stop",
index=0,
message={
"role": "assistant",
@@ -438,7 +438,7 @@ class AnthropicPassthroughLoggingHandler:
# Add error-specific metadata
litellm_model_response.choices = [Choices(
- finish_reason="batch_error",
+ finish_reason="stop",
index=0,
message={
"role": "assistant",
@@ -472,7 +472,7 @@ class AnthropicPassthroughLoggingHandler:
# Add error-specific metadata
litellm_model_response.choices = [Choices(
- finish_reason="batch_error",
+ finish_reason="stop",
index=0,
message={
"role": "assistant",
diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py
index 0962fafe3f6..3d5c529a3bb 100644
--- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py
+++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py
@@ -619,7 +619,7 @@ class VertexPassthroughLoggingHandler:
# Add batch-specific metadata to indicate this is a pending batch job
litellm_model_response.choices = [Choices(
- finish_reason="batch_pending",
+ finish_reason="stop",
index=0,
message={
"role": "assistant",
@@ -661,7 +661,7 @@ class VertexPassthroughLoggingHandler:
# Add error-specific metadata
litellm_model_response.choices = [Choices(
- finish_reason="batch_error",
+ finish_reason="stop",
index=0,
message={
"role": "assistant",
@@ -695,7 +695,7 @@ class VertexPassthroughLoggingHandler:
# Add error-specific metadata
litellm_model_response.choices = [Choices(
- finish_reason="batch_error",
+ finish_reason="stop",
index=0,
message={
"role": "assistant",
diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.py b/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.py
index 68c6bf98cb2..66c063d47d8 100644
--- a/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.py
+++ b/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.py
@@ -127,7 +127,7 @@ class TestVertexAIBatchPassthroughHandler:
assert result is not None
assert "result" in result
assert "kwargs" in result
- assert result["result"].choices[0].finish_reason == "batch_error"
+ assert result["result"].choices[0].finish_reason == "stop"
assert result["kwargs"]["batch_job_state"] == "JOB_STATE_FAILED"
def test_get_actual_model_id_from_router_with_router(self):