mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
fix: fix linting error
This commit is contained in:
parent
b472f97435
commit
d2ec9e4328
2 changed files with 14 additions and 11 deletions
|
@ -101,6 +101,19 @@ def update_breakdown_metrics(
|
||||||
return breakdown
|
return breakdown
|
||||||
|
|
||||||
|
|
||||||
|
async def get_api_key_metadata(
|
||||||
|
prisma_client: PrismaClient,
|
||||||
|
api_keys: set[str],
|
||||||
|
) -> Dict[str, Dict[str, Any]]:
|
||||||
|
"""Update api key metadata for a single record."""
|
||||||
|
key_records = await prisma_client.db.litellm_verificationtoken.find_many(
|
||||||
|
where={"token": {"in": list(api_keys)}}
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
k.token: {"key_alias": k.key_alias, "team_id": k.team_id} for k in key_records
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async def get_daily_activity(
|
async def get_daily_activity(
|
||||||
prisma_client: Optional[PrismaClient],
|
prisma_client: Optional[PrismaClient],
|
||||||
table_name: str,
|
table_name: str,
|
||||||
|
@ -177,15 +190,7 @@ async def get_daily_activity(
|
||||||
model_metadata: Dict[str, Dict[str, Any]] = {}
|
model_metadata: Dict[str, Dict[str, Any]] = {}
|
||||||
provider_metadata: Dict[str, Dict[str, Any]] = {}
|
provider_metadata: Dict[str, Dict[str, Any]] = {}
|
||||||
if api_keys:
|
if api_keys:
|
||||||
key_records = await prisma_client.db.litellm_verificationtoken.find_many(
|
api_key_metadata = await get_api_key_metadata(prisma_client, api_keys)
|
||||||
where={"token": {"in": list(api_keys)}}
|
|
||||||
)
|
|
||||||
api_key_metadata.update(
|
|
||||||
{
|
|
||||||
k.token: {"key_alias": k.key_alias, "team_id": k.team_id}
|
|
||||||
for k in key_records
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Process results
|
# Process results
|
||||||
results = []
|
results = []
|
||||||
|
|
|
@ -36,8 +36,6 @@ from litellm.proxy.management_helpers.utils import management_endpoint_wrapper
|
||||||
from litellm.proxy.utils import handle_exception_on_proxy
|
from litellm.proxy.utils import handle_exception_on_proxy
|
||||||
from litellm.types.proxy.management_endpoints.common_daily_activity import (
|
from litellm.types.proxy.management_endpoints.common_daily_activity import (
|
||||||
BreakdownMetrics,
|
BreakdownMetrics,
|
||||||
DailySpendData,
|
|
||||||
DailySpendMetadata,
|
|
||||||
KeyMetadata,
|
KeyMetadata,
|
||||||
KeyMetricWithMetadata,
|
KeyMetricWithMetadata,
|
||||||
LiteLLM_DailyUserSpend,
|
LiteLLM_DailyUserSpend,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue