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]

refactor(batches): make count_error_file_failed_requests public for the poller import

Mateo Wang128d7e52784b
diff --git a/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py b/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py
index d34635fa253..3b09dc9272e 100644
--- a/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py
+++ b/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py
@@ -627,7 +627,7 @@ class CheckBatchCost:
later poll.
"""
from litellm.batches.batch_utils import (
- _count_error_file_failed_requests,
+ count_error_file_failed_requests,
_get_file_content_as_dictionary,
calculate_batch_cost_and_usage,
)
@@ -772,7 +772,7 @@ class CheckBatchCost:
model_name=model_name,
model_info=deployment_model_info,
)
- error_file_failed_requests: Final = await _count_error_file_failed_requests(
+ error_file_failed_requests: Final = await count_error_file_failed_requests(
response,
custom_llm_provider=batch_file_provider,
litellm_params={
diff --git a/litellm/batches/batch_utils.py b/litellm/batches/batch_utils.py
index ea2a95c1717..3831f57a10d 100644
--- a/litellm/batches/batch_utils.py
+++ b/litellm/batches/batch_utils.py
@@ -89,13 +89,13 @@ async def _handle_completed_batch(
usage=Usage(prompt_tokens=0, completion_tokens=0, total_tokens=0),
models=[], # mutable-ok: no output file means no model was ever priced; BatchCostUsageResult.models requires list[str]
successful_requests=0,
- failed_requests=await _count_error_file_failed_requests(
+ failed_requests=await count_error_file_failed_requests(
batch, custom_llm_provider=custom_llm_provider, litellm_params=litellm_params
),
)
file_content = await _fetch_batch_output_file_content(batch, custom_llm_provider, litellm_params=litellm_params)
- error_file_failed_requests: Final = await _count_error_file_failed_requests(
+ error_file_failed_requests: Final = await count_error_file_failed_requests(
batch, custom_llm_provider=custom_llm_provider, litellm_params=litellm_params
)
@@ -450,7 +450,7 @@ async def _fetch_batch_output_file_content(
)
-async def _count_error_file_failed_requests(
+async def count_error_file_failed_requests(
batch: Batch,
custom_llm_provider: Literal["openai", "azure", "vertex_ai", "hosted_vllm", "anthropic"],
litellm_params: dict | None,