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: resolve mypy type errors in audit_logs.py

Ryan Crabbe3e27ff1b7814
diff --git a/litellm/proxy/management_helpers/audit_logs.py b/litellm/proxy/management_helpers/audit_logs.py
index 44b0d75cfa2..b9020222f1f 100644
--- a/litellm/proxy/management_helpers/audit_logs.py
+++ b/litellm/proxy/management_helpers/audit_logs.py
@@ -51,9 +51,7 @@ def _build_audit_log_payload(
if request_data.updated_at is not None:
updated_at = request_data.updated_at.isoformat()
- table_name = request_data.table_name
- if isinstance(table_name, LitellmTableNames):
- table_name = table_name.value
+ table_name_str: str = request_data.table_name.value if isinstance(request_data.table_name, LitellmTableNames) else str(request_data.table_name)
return StandardAuditLogPayload(
id=request_data.id,
@@ -61,7 +59,7 @@ def _build_audit_log_payload(
changed_by=request_data.changed_by or "",
changed_by_api_key=request_data.changed_by_api_key or "",
action=request_data.action,
- table_name=str(table_name),
+ table_name=table_name_str,
object_id=request_data.object_id,
before_value=request_data.before_value,
updated_values=request_data.updated_values,
@@ -91,7 +89,7 @@ async def _dispatch_audit_log_to_callbacks(
for callback in litellm.audit_log_callbacks:
try:
- resolved = callback
+ resolved: Optional[CustomLogger] = callback if isinstance(callback, CustomLogger) else None
if isinstance(callback, str):
resolved = _resolve_audit_log_callback(callback)
if resolved is None: