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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix loc of DBSpendUpdateTransactions
Ishaan Jaff7c73987066dd
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.pyindex 17b4acd138c..1c3251c12aa 100644--- a/litellm/proxy/_types.py+++ b/litellm/proxy/_types.py@@ -2733,3 +2733,12 @@ class DailyUserSpendTransaction(TypedDict):prompt_tokens: intcompletion_tokens: intspend: float+++class DBSpendUpdateTransactions(TypedDict):+ user_list_transactions: Optional[Dict[str, float]]+ end_user_list_transactions: Optional[Dict[str, float]]+ key_list_transactions: Optional[Dict[str, float]]+ team_list_transactions: Optional[Dict[str, float]]+ team_member_list_transactions: Optional[Dict[str, float]]+ org_list_transactions: Optional[Dict[str, float]]diff --git a/litellm/proxy/db/db_spend_update_writer.py b/litellm/proxy/db/db_spend_update_writer.pyindex 17247aff74b..8f175fc9058 100644--- a/litellm/proxy/db/db_spend_update_writer.py+++ b/litellm/proxy/db/db_spend_update_writer.py@@ -18,15 +18,13 @@ from litellm.caching import DualCache, RedisCachefrom litellm.constants import DB_SPEND_UPDATE_JOB_NAMEfrom litellm.proxy._types import (DB_CONNECTION_ERROR_TYPES,+ DBSpendUpdateTransactions,Litellm_EntityType,LiteLLM_UserTable,SpendLogsPayload,)from litellm.proxy.db.pod_lock_manager import PodLockManager-from litellm.proxy.db.redis_update_buffer import (- DBSpendUpdateTransactions,- RedisUpdateBuffer,-)+from litellm.proxy.db.redis_update_buffer import RedisUpdateBufferif TYPE_CHECKING:from litellm.proxy.utils import PrismaClient, ProxyLoggingdiff --git a/litellm/proxy/db/redis_update_buffer.py b/litellm/proxy/db/redis_update_buffer.pyindex 2207911024a..6f334e90ed4 100644--- a/litellm/proxy/db/redis_update_buffer.py+++ b/litellm/proxy/db/redis_update_buffer.py@@ -4,10 +4,11 @@ Handles buffering database `UPDATE` transactions in Redis before committing themThis is to prevent deadlocks and improve reliability"""-from typing import TYPE_CHECKING, Any, Dict, Optional, TypedDict, Union, cast+from typing import TYPE_CHECKING, Any, Dict, Optional, Union, castfrom litellm._logging import verbose_proxy_loggerfrom litellm.caching import RedisCache+from litellm.proxy._types import DBSpendUpdateTransactionsfrom litellm.secret_managers.main import str_to_boolif TYPE_CHECKING:@@ -16,15 +17,6 @@ else:PrismaClient = Any-class DBSpendUpdateTransactions(TypedDict):- user_list_transactions: Optional[Dict[str, float]]- end_user_list_transactions: Optional[Dict[str, float]]- key_list_transactions: Optional[Dict[str, float]]- team_list_transactions: Optional[Dict[str, float]]- team_member_list_transactions: Optional[Dict[str, float]]- org_list_transactions: Optional[Dict[str, float]]--class RedisUpdateBuffer:"""Handles buffering database `UPDATE` transactions in Redis before committing them to the database