forked from phoenix/litellm-mirror
feat(proxy_server.py): exposes /organization/info
and /budget/info
endpoints
This commit is contained in:
parent
8d22ed762e
commit
8bb6897b46
2 changed files with 58 additions and 2 deletions
|
@ -358,6 +358,14 @@ class NewOrganizationResponse(LiteLLM_OrganizationTable):
|
||||||
updated_at: datetime
|
updated_at: datetime
|
||||||
|
|
||||||
|
|
||||||
|
class OrganizationRequest(LiteLLMBase):
|
||||||
|
organizations: List[str]
|
||||||
|
|
||||||
|
|
||||||
|
class BudgetRequest(LiteLLMBase):
|
||||||
|
budgets: List[str]
|
||||||
|
|
||||||
|
|
||||||
class KeyManagementSystem(enum.Enum):
|
class KeyManagementSystem(enum.Enum):
|
||||||
GOOGLE_KMS = "google_kms"
|
GOOGLE_KMS = "google_kms"
|
||||||
AZURE_KEY_VAULT = "azure_key_vault"
|
AZURE_KEY_VAULT = "azure_key_vault"
|
||||||
|
|
|
@ -5580,11 +5580,59 @@ async def delete_organization():
|
||||||
tags=["organization management"],
|
tags=["organization management"],
|
||||||
dependencies=[Depends(user_api_key_auth)],
|
dependencies=[Depends(user_api_key_auth)],
|
||||||
)
|
)
|
||||||
async def info_organization():
|
async def info_organization(data: OrganizationRequest):
|
||||||
"""
|
"""
|
||||||
Get the org specific information
|
Get the org specific information
|
||||||
"""
|
"""
|
||||||
pass
|
global prisma_client
|
||||||
|
|
||||||
|
if prisma_client is None:
|
||||||
|
raise HTTPException(status_code=500, detail={"error": "No db connected"})
|
||||||
|
|
||||||
|
if len(data.organizations) == 0:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=400,
|
||||||
|
detail={
|
||||||
|
"error": f"Specify list of organization id's to query. Passed in={data.organizations}"
|
||||||
|
},
|
||||||
|
)
|
||||||
|
response = await prisma_client.db.litellm_organizationtable.find_many(
|
||||||
|
where={"organization_id": {"in": data.organizations}},
|
||||||
|
include={"litellm_budget_table": True},
|
||||||
|
)
|
||||||
|
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
#### BUDGET TABLE MANAGEMENT ####
|
||||||
|
|
||||||
|
|
||||||
|
@router.post(
|
||||||
|
"/budget/info",
|
||||||
|
tags=["organization management"],
|
||||||
|
dependencies=[Depends(user_api_key_auth)],
|
||||||
|
)
|
||||||
|
async def info_budget(data: BudgetRequest):
|
||||||
|
"""
|
||||||
|
Get the budget id specific information
|
||||||
|
"""
|
||||||
|
global prisma_client
|
||||||
|
|
||||||
|
if prisma_client is None:
|
||||||
|
raise HTTPException(status_code=500, detail={"error": "No db connected"})
|
||||||
|
|
||||||
|
if len(data.budgets) == 0:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=400,
|
||||||
|
detail={
|
||||||
|
"error": f"Specify list of budget id's to query. Passed in={data.budgets}"
|
||||||
|
},
|
||||||
|
)
|
||||||
|
response = await prisma_client.db.litellm_budgettable.find_many(
|
||||||
|
where={"budget_id": {"in": data.budgets}},
|
||||||
|
)
|
||||||
|
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
#### MODEL MANAGEMENT ####
|
#### MODEL MANAGEMENT ####
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue