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]

Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_list_batches_resolves_unified_ids

mateo-berri02d60847ee27
diff --cc enterprise/litellm_enterprise/proxy/hooks/managed_files.py
index 6fa6ef46ad4,8d589e6207c..d8318962633
--- a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py
+++ b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py
@@@ -81,20 -75,26 +82,44 @@@ else
PrismaClient = Any
++def _sanitized_parse_error(e: Exception) -> str:
++ return (
++ str(e.errors(include_input=False, include_url=False, include_context=False))
++ if isinstance(e, ValidationError)
++ else type(e).__name__
++ )
++
++
+def _decode_json_blob(blob: object) -> object:
+ return json.loads(blob) if isinstance(blob, str) else blob
+
+
+def _parse_managed_batch_row(row: "PrismaManagedObjectRow") -> Optional[LiteLLMBatch]:
+ try:
+ batch_obj: Final = LiteLLMBatch.model_validate(_decode_json_blob(row.file_object))
+ except Exception as e:
- verbose_logger.warning(f"Failed to parse batch object {row.unified_object_id}: {e}")
++ verbose_logger.warning(
++ f"Failed to parse batch object {row.unified_object_id}: {_sanitized_parse_error(e)}"
++ )
+ return None
+ batch_obj.id = row.unified_object_id
+ return batch_obj
+
+
+ def _parse_managed_file_object(
+ raw_file_object: object, unified_file_id: str
+ ) -> Optional[OpenAIFileObject]:
+ if raw_file_object is None:
+ return None
+ try:
+ return OpenAIFileObject.model_validate(raw_file_object)
- except ValidationError as e:
- verbose_logger.warning(
- f"Failed to parse managed file object {unified_file_id}: "
- f"{e.errors(include_input=False, include_url=False, include_context=False)}"
- )
- return None
+ except Exception as e:
+ verbose_logger.warning(
- f"Failed to parse managed file object {unified_file_id}: {type(e).__name__}"
++ f"Failed to parse managed file object {unified_file_id}: {_sanitized_parse_error(e)}"
+ )
+ return None
+
+
class _PROXY_LiteLLMManagedFiles(CustomLogger, BaseFileEndpoints):
# Class variables or attributes
def __init__(