fix - working filter by tag query

This commit is contained in:
Ishaan Jaff 2024-06-03 15:12:09 -07:00
parent 2ac8f1c6ec
commit 45cb899687
2 changed files with 81 additions and 23 deletions

View file

@ -8297,19 +8297,23 @@ async def global_view_spend_tags(
default=None,
description="Time till which to view key spend",
),
tags: Optional[str] = fastapi.Query(
default=None,
description="comman separated tags to filter on",
),
):
"""
LiteLLM Enterprise - View Spend Per Request Tag. Used by LiteLLM UI
Example Request:
```
curl -X GET "http://0.0.0.0:8000/spend/tags" \
curl -X GET "http://0.0.0.0:4000/spend/tags" \
-H "Authorization: Bearer sk-1234"
```
Spend with Start Date and End Date
```
curl -X GET "http://0.0.0.0:8000/spend/tags?start_date=2022-01-01&end_date=2022-02-01" \
curl -X GET "http://0.0.0.0:4000/spend/tags?start_date=2022-01-01&end_date=2022-02-01" \
-H "Authorization: Bearer sk-1234"
```
"""
@ -8331,7 +8335,10 @@ async def global_view_spend_tags(
code=status.HTTP_400_BAD_REQUEST,
)
response = await ui_get_spend_by_tags(
start_date=start_date, end_date=end_date, prisma_client=prisma_client
start_date=start_date,
end_date=end_date,
tags_str=tags,
prisma_client=prisma_client,
)
return response