mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-30 01:52:18 +00:00
refactor(proxy): drop descriptive docstrings from tag rate limit helpers
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
f94d3ea4a1
commit
fbc2d42fcd
2 changed files with 0 additions and 11 deletions
|
|
@ -571,7 +571,6 @@ def _tag_rate_limit_descriptor(tag: str, limit: TagRateLimit, window_size: int)
|
|||
|
||||
|
||||
async def resolve_tag_rate_limits_from_db(tag_names: Sequence[str]) -> Mapping[str, TagRateLimit]:
|
||||
"""Read the rpm/tpm limits stored on each tag's budget row, served from the tag object cache."""
|
||||
from litellm.proxy.auth.auth_checks import get_tag_objects_batch
|
||||
from litellm.proxy.proxy_server import prisma_client, user_api_key_cache
|
||||
|
||||
|
|
@ -2731,7 +2730,6 @@ class _PROXY_MaxParallelRequestsHandler_v3(CustomLogger):
|
|||
return descriptors
|
||||
|
||||
async def _create_tag_rate_limit_descriptors(self, data: Mapping[str, object]) -> tuple[RateLimitDescriptor, ...]:
|
||||
"""One ``tag`` descriptor per request tag whose tag object carries an rpm or tpm limit."""
|
||||
tags: Final = tuple(dict.fromkeys(get_tags_from_request_body(data)))
|
||||
if not tags:
|
||||
return ()
|
||||
|
|
|
|||
|
|
@ -5014,10 +5014,6 @@ def _static_tag_limits(limits: dict[str, TagRateLimit]):
|
|||
|
||||
@pytest.mark.asyncio
|
||||
async def test_tag_object_rpm_limit_enforced_v3(monkeypatch):
|
||||
"""
|
||||
rpm_limit stored on the tag object (via /tag/new) is enforced for every key
|
||||
sending that tag, independently of any key-level tag_rpm_limit metadata.
|
||||
"""
|
||||
monkeypatch.setenv("LITELLM_RATE_LIMIT_WINDOW_SIZE", "60")
|
||||
_request_stash.set(None)
|
||||
resolver, calls = _static_tag_limits({"cell-1": TagRateLimit(rpm_limit=2, tpm_limit=None)})
|
||||
|
|
@ -5050,10 +5046,6 @@ async def test_tag_object_rpm_limit_enforced_v3(monkeypatch):
|
|||
|
||||
@pytest.mark.asyncio
|
||||
async def test_tag_object_tpm_limit_enforced_v3(monkeypatch):
|
||||
"""
|
||||
tpm_limit stored on the tag object is charged from actual usage on success
|
||||
and blocks the tag once exhausted, while untagged traffic keeps flowing.
|
||||
"""
|
||||
monkeypatch.setenv("LITELLM_RATE_LIMIT_WINDOW_SIZE", "60")
|
||||
monkeypatch.setenv("LITELLM_TPM_TOKEN_RESERVATION_ENABLED", "false")
|
||||
_request_stash.set(None)
|
||||
|
|
@ -5095,7 +5087,6 @@ async def test_tag_object_tpm_limit_enforced_v3(monkeypatch):
|
|||
|
||||
@pytest.mark.asyncio
|
||||
async def test_resolve_tag_rate_limits_from_db_reads_budget_row(monkeypatch):
|
||||
"""Only tags whose budget row carries an rpm or tpm limit are returned."""
|
||||
from litellm.models.budget import LiteLLM_BudgetTable
|
||||
from litellm.models.tag import LiteLLM_TagTable
|
||||
from litellm.proxy import proxy_server
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue