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 Crabbe9b90e80f7187
diff --git a/litellm/proxy/management_helpers/audit_logs.py b/litellm/proxy/management_helpers/audit_logs.py
index 08d92c3e6a6..44b0d75cfa2 100644
--- a/litellm/proxy/management_helpers/audit_logs.py
+++ b/litellm/proxy/management_helpers/audit_logs.py
@@ -132,20 +132,24 @@ async def create_object_audit_log(
"""
from litellm.secret_managers.main import get_secret_bool
- store_audit_logs = litellm.store_audit_logs or get_secret_bool(
+ _store_audit_logs: Optional[bool] = litellm.store_audit_logs or get_secret_bool(
"LITELLM_STORE_AUDIT_LOGS"
)
- if store_audit_logs is not True:
+ if _store_audit_logs is not True:
return
+ _changed_by = (
+ litellm_changed_by
+ or user_api_key_dict.user_id
+ or litellm_proxy_admin_name
+ )
+
await create_audit_log_for_update(
request_data=LiteLLM_AuditLogs(
id=str(uuid.uuid4()),
updated_at=datetime.now(timezone.utc),
- changed_by=litellm_changed_by
- or user_api_key_dict.user_id
- or litellm_proxy_admin_name,
+ changed_by=_changed_by,
changed_by_api_key=user_api_key_dict.api_key,
table_name=table_name,
object_id=object_id,
@@ -162,10 +166,10 @@ async def create_audit_log_for_update(request_data: LiteLLM_AuditLogs):
"""
from litellm.secret_managers.main import get_secret_bool
- store_audit_logs = litellm.store_audit_logs or get_secret_bool(
+ _store_audit_logs: Optional[bool] = litellm.store_audit_logs or get_secret_bool(
"LITELLM_STORE_AUDIT_LOGS"
)
- if store_audit_logs is not True:
+ if _store_audit_logs is not True:
return
from litellm.proxy.proxy_server import premium_user, prisma_client