Org Flow Improvements (#8549)

* refactor(organization.tsx): initial commit with orgs tab refactor

make it similar to 'Teams' tab - simplifies org management actions

* fix(page.tsx): pass user orgs to component

* fix(organization_view.tsx): fix to pull info from org info endpoint

* feat(organization_endpoints.py): return org members when calling /org/info

* fix(organization_view.tsx): show org members on info page

* feat(organization_view.tsx): allow adding user to org via user email

Resolves https://github.com/BerriAI/litellm/issues/8330

* fix(organization_endpoints.py): raise better error when duplicate user_email found in db

* fix(organization_view.tsx): cleanup user_email for now

not in initial org info - will need to prefetch

* fix(page.tsx): fix getting user models on page load

allows passing down the user models to org

* fix(organizations.tsx): fix creating org on ui

* fix(proxy/_types.py): include org created at and updated at

cleans up ui

* fix(navbar.tsx): cleanup

* fix(organizations.tsx): fix tpm/rpm limits on org

* fix(organizations.tsx): fix linting error

* fix(organizations.tsx): fix linting \

* (Feat) - Add `/bedrock/meta.llama3-3-70b-instruct-v1:0` tool calling support + cost tracking + base llm unit test for tool calling (#8545)

* Add support for bedrock meta.llama3-3-70b-instruct-v1:0 tool calling (#8512)

* fix(converse_transformation.py): fixing bedrock meta.llama3-3-70b tool calling

* test(test_bedrock_completion.py): adding llama3.3 tool compatibility check

* add TestBedrockTestSuite

* add bedrock llama 3.3 to base llm class

* us.meta.llama3-3-70b-instruct-v1:0

* test_basic_tool_calling

* TestAzureOpenAIO1

* test_basic_tool_calling

* test_basic_tool_calling

---------

Co-authored-by: miraclebakelaser <65143272+miraclebakelaser@users.noreply.github.com>

* fix(general_settings.tsx): filter out empty dictionaries post fallback delete (#8550)

Fixes https://github.com/BerriAI/litellm/issues/8331

* bump: version 1.61.3 → 1.61.4

* (perf) Fix memory leak on `/completions` route (#8551)

* initial mem util test

* fix _cached_get_model_info_helper

* test memory usage

* fix tests

* fix mem usage

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
Co-authored-by: miraclebakelaser <65143272+miraclebakelaser@users.noreply.github.com>
This commit is contained in:
Krish Dholakia 2025-02-14 19:49:03 -08:00 committed by GitHub
parent 510e8cd754
commit b516cf21cb
10 changed files with 940 additions and 301 deletions

View file

@ -16,6 +16,7 @@ from typing import List, Optional, Tuple
from fastapi import APIRouter, Depends, HTTPException, Request, status
from litellm._logging import verbose_proxy_logger
from litellm.proxy._types import *
from litellm.proxy.auth.user_api_key_auth import user_api_key_auth
from litellm.proxy.management_helpers.utils import (
@ -250,14 +251,46 @@ async def list_organization(
return response
@router.get(
"/organization/info",
tags=["organization management"],
dependencies=[Depends(user_api_key_auth)],
response_model=LiteLLM_OrganizationTableWithMembers,
)
async def info_organization(organization_id: str):
"""
Get the org specific information
"""
from litellm.proxy.proxy_server import prisma_client
if prisma_client is None:
raise HTTPException(status_code=500, detail={"error": "No db connected"})
response: Optional[LiteLLM_OrganizationTableWithMembers] = (
await prisma_client.db.litellm_organizationtable.find_unique(
where={"organization_id": organization_id},
include={"litellm_budget_table": True, "members": True, "teams": True},
)
)
if response is None:
raise HTTPException(status_code=404, detail={"error": "Organization not found"})
response_pydantic_obj = LiteLLM_OrganizationTableWithMembers(
**response.model_dump()
)
return response_pydantic_obj
@router.post(
"/organization/info",
tags=["organization management"],
dependencies=[Depends(user_api_key_auth)],
)
async def info_organization(data: OrganizationRequest):
async def deprecated_info_organization(data: OrganizationRequest):
"""
Get the org specific information
DEPRECATED: Use GET /organization/info instead
"""
from litellm.proxy.proxy_server import prisma_client
@ -378,6 +411,7 @@ async def organization_member_add(
updated_organization_memberships=updated_organization_memberships,
)
except Exception as e:
verbose_proxy_logger.exception(f"Error adding member to organization: {e}")
if isinstance(e, HTTPException):
raise ProxyException(
message=getattr(e, "detail", f"Authentication Error({str(e)})"),
@ -418,12 +452,17 @@ async def add_member_to_organization(
where={"user_id": member.user_id}
)
if member.user_email is not None:
existing_user_email_row = (
await prisma_client.db.litellm_usertable.find_unique(
where={"user_email": member.user_email}
if existing_user_id_row is None and member.user_email is not None:
try:
existing_user_email_row = (
await prisma_client.db.litellm_usertable.find_unique(
where={"user_email": member.user_email}
)
)
except Exception as e:
raise ValueError(
f"Potential NON-Existent or Duplicate user email in DB: Error finding a unique instance of user_email={member.user_email} in LiteLLM_UserTable.: {e}"
)
)
## If user does not exist, create a new user
if existing_user_id_row is None and existing_user_email_row is None:
@ -477,4 +516,9 @@ async def add_member_to_organization(
return user_object, organization_membership
except Exception as e:
raise ValueError(f"Error adding member to organization: {e}")
import traceback
traceback.print_exc()
raise ValueError(
f"Error adding member={member} to organization={organization_id}: {e}"
)