Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remaining org CRUD endpoints + support deleting orgs on UI #8561

Merged
merged 13 commits into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion litellm/proxy/_experimental/out/onboarding.html

This file was deleted.

46 changes: 44 additions & 2 deletions litellm/proxy/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union

import httpx
from pydantic import BaseModel, ConfigDict, Field, Json, model_validator
from pydantic import (
BaseModel,
ConfigDict,
Field,
Json,
field_validator,
model_validator,
)
from typing_extensions import Required, TypedDict

from litellm.types.integrations.slack_alerting import AlertType
Expand Down Expand Up @@ -393,6 +400,7 @@ class LiteLLMRoutes(enum.Enum):
"/organization/info",
"/organization/delete",
"/organization/member_add",
"/organization/member_update",
]

# All routes accesible by an Org Admin
Expand Down Expand Up @@ -1110,6 +1118,10 @@ class OrganizationRequest(LiteLLMPydanticObjectBase):
organizations: List[str]


class DeleteOrganizationRequest(LiteLLMPydanticObjectBase):
organization_ids: List[str] # required


class KeyManagementSystem(enum.Enum):
GOOGLE_KMS = "google_kms"
AZURE_KEY_VAULT = "azure_key_vault"
Expand Down Expand Up @@ -1494,6 +1506,18 @@ class LiteLLM_OrganizationTable(LiteLLMPydanticObjectBase):
updated_by: str


class LiteLLM_OrganizationTableUpdate(LiteLLMPydanticObjectBase):
"""Represents user-controllable params for a LiteLLM_OrganizationTable record"""

organization_id: Optional[str] = None
organization_alias: Optional[str] = None
budget_id: Optional[str] = None
spend: Optional[float] = None
metadata: Optional[dict] = None
models: Optional[List[str]] = None
updated_by: Optional[str] = None


class LiteLLM_OrganizationTableWithMembers(LiteLLM_OrganizationTable):
"""Returned by the /organization/info endpoint and /organization/list endpoint"""

Expand Down Expand Up @@ -2097,8 +2121,26 @@ class OrganizationMemberDeleteRequest(MemberDeleteRequest):
organization_id: str


ROLES_WITHIN_ORG = [
LitellmUserRoles.ORG_ADMIN,
LitellmUserRoles.INTERNAL_USER,
LitellmUserRoles.INTERNAL_USER_VIEW_ONLY,
]


class OrganizationMemberUpdateRequest(OrganizationMemberDeleteRequest):
max_budget_in_organization: float
max_budget_in_organization: Optional[float] = None
role: Optional[LitellmUserRoles] = None

@field_validator("role")
def validate_role(
cls, value: Optional[LitellmUserRoles]
) -> Optional[LitellmUserRoles]:
if value is not None and value not in ROLES_WITHIN_ORG:
raise ValueError(
f"Invalid role. Must be one of: {[role.value for role in ROLES_WITHIN_ORG]}"
)
return value


class OrganizationMemberUpdateResponse(MemberUpdateResponse):
Expand Down
Loading