fix import loc

This commit is contained in:
Ishaan Jaff 2025-04-23 17:33:29 -07:00
parent b965f1a306
commit a40ecc3fe4
380 changed files with 1491 additions and 1208 deletions

View file

@ -17,7 +17,7 @@ This function is called just before a litellm completion call is made, and allow
```python ```python
from litellm.integrations.custom_logger import CustomLogger from litellm.integrations.custom_logger import CustomLogger
import litellm import litellm
from litellm_proxy.proxy_server import UserAPIKeyAuth, DualCache from litellm_proxy_extras.litellm_proxy.proxy_server import UserAPIKeyAuth, DualCache
from typing import Optional, Literal from typing import Optional, Literal
# This file includes the custom callbacks for LiteLLM Proxy # This file includes the custom callbacks for LiteLLM Proxy

View file

@ -9,7 +9,7 @@ Here's how:
Make sure the response type follows the `UserAPIKeyAuth` pydantic object. This is used by for logging usage specific to that user key. Make sure the response type follows the `UserAPIKeyAuth` pydantic object. This is used by for logging usage specific to that user key.
```python ```python
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
async def user_api_key_auth(request: Request, api_key: str) -> UserAPIKeyAuth: async def user_api_key_auth(request: Request, api_key: str) -> UserAPIKeyAuth:
try: try:

View file

@ -20,12 +20,12 @@ Make sure the response type follows the `SSOUserDefinedValues` pydantic object.
from fastapi import Request from fastapi import Request
from fastapi_sso.sso.base import OpenID from fastapi_sso.sso.base import OpenID
from litellm_proxy._types import LitellmUserRoles, SSOUserDefinedValues from litellm_proxy_extras.litellm_proxy._types import LitellmUserRoles, SSOUserDefinedValues
from litellm_proxy.management_endpoints.internal_user_endpoints import ( from litellm_proxy_extras.litellm_proxy.management_endpoints.internal_user_endpoints import (
new_user, new_user,
user_info, user_info,
) )
from litellm_proxy.management_endpoints.team_endpoints import add_new_member from litellm_proxy_extras.litellm_proxy.management_endpoints.team_endpoints import add_new_member
async def custom_sso_handler(userIDPInfo: OpenID) -> SSOUserDefinedValues: async def custom_sso_handler(userIDPInfo: OpenID) -> SSOUserDefinedValues:

View file

@ -29,8 +29,8 @@ import litellm
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
from litellm.caching.caching import DualCache from litellm.caching.caching import DualCache
from litellm.integrations.custom_guardrail import CustomGuardrail from litellm.integrations.custom_guardrail import CustomGuardrail
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
from litellm_proxy.guardrails.guardrail_helpers import should_proceed_based_on_metadata from litellm_proxy_extras.litellm_proxy.guardrails.guardrail_helpers import should_proceed_based_on_metadata
from litellm.types.guardrails import GuardrailEventHooks from litellm.types.guardrails import GuardrailEventHooks
@ -449,7 +449,7 @@ import litellm
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
from litellm.caching.caching import DualCache from litellm.caching.caching import DualCache
from litellm.integrations.custom_guardrail import CustomGuardrail from litellm.integrations.custom_guardrail import CustomGuardrail
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
class myCustomGuardrail(CustomGuardrail): class myCustomGuardrail(CustomGuardrail):
def __init__(self, **kwargs): def __init__(self, **kwargs):

View file

@ -14,11 +14,11 @@ sys.path.insert(
from typing import Optional, Literal, Any from typing import Optional, Literal, Any
import litellm import litellm
import sys import sys
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
from litellm.integrations.custom_guardrail import CustomGuardrail from litellm.integrations.custom_guardrail import CustomGuardrail
from fastapi import HTTPException from fastapi import HTTPException
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
from litellm_proxy.guardrails.guardrail_helpers import should_proceed_based_on_metadata from litellm_proxy_extras.litellm_proxy.guardrails.guardrail_helpers import should_proceed_based_on_metadata
from litellm.litellm_core_utils.logging_utils import ( from litellm.litellm_core_utils.logging_utils import (
convert_litellm_response_object_to_str, convert_litellm_response_object_to_str,
) )
@ -140,7 +140,7 @@ class AporiaGuardrail(CustomGuardrail):
user_api_key_dict: UserAPIKeyAuth, user_api_key_dict: UserAPIKeyAuth,
response, response,
): ):
from litellm_proxy.common_utils.callback_utils import ( from litellm_proxy_extras.litellm_proxy.common_utils.callback_utils import (
add_guardrail_to_applied_guardrails_header, add_guardrail_to_applied_guardrails_header,
) )
@ -176,7 +176,7 @@ class AporiaGuardrail(CustomGuardrail):
"responses", "responses",
], ],
): ):
from litellm_proxy.common_utils.callback_utils import ( from litellm_proxy_extras.litellm_proxy.common_utils.callback_utils import (
add_guardrail_to_applied_guardrails_header, add_guardrail_to_applied_guardrails_header,
) )

View file

@ -10,7 +10,7 @@
from typing import Literal from typing import Literal
import litellm import litellm
from litellm.caching.caching import DualCache from litellm.caching.caching import DualCache
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
from litellm.integrations.custom_logger import CustomLogger from litellm.integrations.custom_logger import CustomLogger
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
from fastapi import HTTPException from fastapi import HTTPException

View file

@ -9,9 +9,9 @@
from typing import Optional, Literal from typing import Optional, Literal
import litellm import litellm
from litellm_proxy.utils import PrismaClient from litellm_proxy_extras.litellm_proxy.utils import PrismaClient
from litellm.caching.caching import DualCache from litellm.caching.caching import DualCache
from litellm_proxy._types import UserAPIKeyAuth, LiteLLM_EndUserTable from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth, LiteLLM_EndUserTable
from litellm.integrations.custom_logger import CustomLogger from litellm.integrations.custom_logger import CustomLogger
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
from fastapi import HTTPException from fastapi import HTTPException

View file

@ -9,7 +9,7 @@
from typing import Literal from typing import Literal
import litellm import litellm
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
from litellm.integrations.custom_logger import CustomLogger from litellm.integrations.custom_logger import CustomLogger
from fastapi import HTTPException from fastapi import HTTPException
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger

View file

@ -17,7 +17,7 @@ sys.path.insert(
from typing import Optional, Literal from typing import Optional, Literal
import litellm import litellm
import sys import sys
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
from litellm.integrations.custom_logger import CustomLogger from litellm.integrations.custom_logger import CustomLogger
from fastapi import HTTPException from fastapi import HTTPException
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger

View file

@ -9,7 +9,7 @@
from typing import Optional, Literal from typing import Optional, Literal
import litellm import litellm
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
from litellm.integrations.custom_logger import CustomLogger from litellm.integrations.custom_logger import CustomLogger
from fastapi import HTTPException from fastapi import HTTPException
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger

View file

@ -14,7 +14,7 @@ sys.path.insert(
from typing import Literal from typing import Literal
import litellm import litellm
import sys import sys
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
from litellm.integrations.custom_logger import CustomLogger from litellm.integrations.custom_logger import CustomLogger
from fastapi import HTTPException from fastapi import HTTPException
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
@ -50,7 +50,7 @@ class _ENTERPRISE_OpenAI_Moderation(CustomLogger):
if "content" in m and isinstance(m["content"], str): if "content" in m and isinstance(m["content"], str):
text += m["content"] text += m["content"]
from litellm_proxy.proxy_server import llm_router from litellm_proxy_extras.litellm_proxy.proxy_server import llm_router
if llm_router is None: if llm_router is None:
return return

View file

@ -19,7 +19,7 @@ import tempfile
from litellm.integrations.custom_guardrail import CustomGuardrail from litellm.integrations.custom_guardrail import CustomGuardrail
if TYPE_CHECKING: if TYPE_CHECKING:
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
else: else:
UserAPIKeyAuth = Any UserAPIKeyAuth = Any

View file

@ -13,8 +13,8 @@ from pydantic import ConfigDict, ValidationError
from litellm._logging import verbose_logger from litellm._logging import verbose_logger
from litellm.constants import MCP_TOOL_NAME_PREFIX from litellm.constants import MCP_TOOL_NAME_PREFIX
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
from litellm_proxy.auth.user_api_key_auth import user_api_key_auth from litellm_proxy_extras.litellm_proxy.auth.user_api_key_auth import user_api_key_auth
from litellm.types.mcp_server.mcp_server_manager import MCPInfo from litellm.types.mcp_server.mcp_server_manager import MCPInfo
from litellm.types.utils import StandardLoggingMCPToolCall from litellm.types.utils import StandardLoggingMCPToolCall
from litellm.utils import client from litellm.utils import client
@ -288,7 +288,7 @@ if MCP_AVAILABLE:
""" """
REST API to call a specific MCP tool with the provided arguments REST API to call a specific MCP tool with the provided arguments
""" """
from litellm_proxy.proxy_server import add_litellm_data_to_request, proxy_config from litellm_proxy_extras.litellm_proxy.proxy_server import add_litellm_data_to_request, proxy_config
data = await request.json() data = await request.json()
data = await add_litellm_data_to_request( data = await add_litellm_data_to_request(

View file

@ -2,7 +2,7 @@ import json
from typing import Any, Callable, Dict, List, Optional from typing import Any, Callable, Dict, List, Optional
from litellm._logging import verbose_logger from litellm._logging import verbose_logger
from litellm_proxy.types_utils.utils import get_instance_fn from litellm_proxy_extras.litellm_proxy.types_utils.utils import get_instance_fn
from litellm.types.mcp_server.tool_registry import MCPTool from litellm.types.mcp_server.tool_registry import MCPTool

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 742 B

After

Width:  |  Height:  |  Size: 742 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 728 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 619 B

After

Width:  |  Height:  |  Size: 619 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 937 B

After

Width:  |  Height:  |  Size: 937 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 629 B

After

Width:  |  Height:  |  Size: 629 B

Before After
Before After

View file

@ -5,8 +5,8 @@ from typing import List, Optional
import fastapi import fastapi
from fastapi import APIRouter, Depends, HTTPException, status from fastapi import APIRouter, Depends, HTTPException, status
from litellm_proxy._types import * from litellm_proxy_extras.litellm_proxy._types import *
from litellm_proxy.auth.user_api_key_auth import user_api_key_auth from litellm_proxy_extras.litellm_proxy.auth.user_api_key_auth import user_api_key_auth
router = APIRouter() router = APIRouter()
@ -61,7 +61,7 @@ async def get_global_activity(
start_date_obj = datetime.strptime(start_date, "%Y-%m-%d") start_date_obj = datetime.strptime(start_date, "%Y-%m-%d")
end_date_obj = datetime.strptime(end_date, "%Y-%m-%d") end_date_obj = datetime.strptime(end_date, "%Y-%m-%d")
from litellm_proxy.proxy_server import prisma_client from litellm_proxy_extras.litellm_proxy.proxy_server import prisma_client
try: try:
if prisma_client is None: if prisma_client is None:

View file

@ -12,12 +12,12 @@ from fastapi.responses import StreamingResponse
import litellm import litellm
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
from litellm_proxy._types import * from litellm_proxy_extras.litellm_proxy._types import *
from litellm_proxy.auth.user_api_key_auth import user_api_key_auth from litellm_proxy_extras.litellm_proxy.auth.user_api_key_auth import user_api_key_auth
from litellm_proxy.common_request_processing import ProxyBaseLLMRequestProcessing from litellm_proxy_extras.litellm_proxy.common_request_processing import ProxyBaseLLMRequestProcessing
from litellm_proxy.common_utils.http_parsing_utils import _read_request_body from litellm_proxy_extras.litellm_proxy.common_utils.http_parsing_utils import _read_request_body
from litellm_proxy.litellm_pre_call_utils import add_litellm_data_to_request from litellm_proxy_extras.litellm_proxy.litellm_pre_call_utils import add_litellm_data_to_request
from litellm_proxy.utils import ProxyLogging from litellm_proxy_extras.litellm_proxy.utils import ProxyLogging
router = APIRouter() router = APIRouter()
@ -88,7 +88,7 @@ async def anthropic_response( # noqa: PLR0915
This was a BETA endpoint that calls 100+ LLMs in the anthropic format. This was a BETA endpoint that calls 100+ LLMs in the anthropic format.
""" """
from litellm_proxy.proxy_server import ( from litellm_proxy_extras.litellm_proxy.proxy_server import (
general_settings, general_settings,
llm_router, llm_router,
proxy_config, proxy_config,

View file

@ -22,7 +22,7 @@ from litellm.caching.caching import DualCache
from litellm.caching.dual_cache import LimitedSizeOrderedDict from litellm.caching.dual_cache import LimitedSizeOrderedDict
from litellm.constants import DEFAULT_IN_MEMORY_TTL from litellm.constants import DEFAULT_IN_MEMORY_TTL
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
from litellm_proxy._types import ( from litellm_proxy_extras.litellm_proxy._types import (
RBAC_ROLES, RBAC_ROLES,
CallInfo, CallInfo,
LiteLLM_EndUserTable, LiteLLM_EndUserTable,
@ -40,9 +40,9 @@ from litellm_proxy._types import (
SpecialModelNames, SpecialModelNames,
UserAPIKeyAuth, UserAPIKeyAuth,
) )
from litellm_proxy.auth.route_checks import RouteChecks from litellm_proxy_extras.litellm_proxy.auth.route_checks import RouteChecks
from litellm_proxy.route_llm_request import route_request from litellm_proxy_extras.litellm_proxy.route_llm_request import route_request
from litellm_proxy.utils import PrismaClient, ProxyLogging, log_db_metrics from litellm_proxy_extras.litellm_proxy.utils import PrismaClient, ProxyLogging, log_db_metrics
from litellm.router import Router from litellm.router import Router
from .auth_checks_organization import organization_role_based_access_check from .auth_checks_organization import organization_role_based_access_check
@ -179,7 +179,7 @@ async def common_checks(
_request_metadata: dict = request_body.get("metadata", {}) or {} _request_metadata: dict = request_body.get("metadata", {}) or {}
if _request_metadata.get("guardrails"): if _request_metadata.get("guardrails"):
# check if team allowed to modify guardrails # check if team allowed to modify guardrails
from litellm_proxy.guardrails.guardrail_helpers import can_modify_guardrails from litellm_proxy_extras.litellm_proxy.guardrails.guardrail_helpers import can_modify_guardrails
can_modify: bool = can_modify_guardrails(team_object) can_modify: bool = can_modify_guardrails(team_object)
if can_modify is False: if can_modify is False:

View file

@ -6,7 +6,7 @@ from typing import Dict, List, Optional, Tuple
from fastapi import status from fastapi import status
from litellm_proxy._types import * from litellm_proxy_extras.litellm_proxy._types import *
def organization_role_based_access_check( def organization_role_based_access_check(

View file

@ -9,9 +9,9 @@ from fastapi import HTTPException, Request, status
import litellm import litellm
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
from litellm_proxy._types import ProxyErrorTypes, ProxyException, UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import ProxyErrorTypes, ProxyException, UserAPIKeyAuth
from litellm_proxy.auth.auth_utils import _get_request_ip_address from litellm_proxy_extras.litellm_proxy.auth.auth_utils import _get_request_ip_address
from litellm_proxy.db.exception_handler import PrismaDBExceptionHandler from litellm_proxy_extras.litellm_proxy.db.exception_handler import PrismaDBExceptionHandler
from litellm.types.services import ServiceTypes from litellm.types.services import ServiceTypes
if TYPE_CHECKING: if TYPE_CHECKING:
@ -46,7 +46,7 @@ class UserAPIKeyAuthExceptionHandler:
Raises: Raises:
- Orignal Exception in all other cases - Orignal Exception in all other cases
""" """
from litellm_proxy.proxy_server import ( from litellm_proxy_extras.litellm_proxy.proxy_server import (
general_settings, general_settings,
litellm_proxy_admin_name, litellm_proxy_admin_name,
proxy_logging_obj, proxy_logging_obj,

View file

@ -7,7 +7,7 @@ from fastapi import HTTPException, Request, status
from litellm import Router, provider_list from litellm import Router, provider_list
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
from litellm_proxy._types import * from litellm_proxy_extras.litellm_proxy._types import *
from litellm.types.router import CONFIGURABLE_CLIENTSIDE_AUTH_PARAMS from litellm.types.router import CONFIGURABLE_CLIENTSIDE_AUTH_PARAMS
@ -195,7 +195,7 @@ async def pre_db_read_auth_checks(
Raises: Raises:
- HTTPException if request fails initial auth checks - HTTPException if request fails initial auth checks
""" """
from litellm_proxy.proxy_server import general_settings, llm_router, premium_user from litellm_proxy_extras.litellm_proxy.proxy_server import general_settings, llm_router, premium_user
# Check 1. request size # Check 1. request size
await check_if_request_size_is_safe(request=request) await check_if_request_size_is_safe(request=request)
@ -262,7 +262,7 @@ def route_in_additonal_public_routes(current_route: str):
""" """
# check if user is premium_user - if not do nothing # check if user is premium_user - if not do nothing
from litellm_proxy.proxy_server import general_settings, premium_user from litellm_proxy_extras.litellm_proxy.proxy_server import general_settings, premium_user
try: try:
if premium_user is not True: if premium_user is not True:
@ -317,7 +317,7 @@ async def check_if_request_size_is_safe(request: Request) -> bool:
ProxyException: If the request size is too large ProxyException: If the request size is too large
""" """
from litellm_proxy.proxy_server import general_settings, premium_user from litellm_proxy_extras.litellm_proxy.proxy_server import general_settings, premium_user
max_request_size_mb = general_settings.get("max_request_size_mb", None) max_request_size_mb = general_settings.get("max_request_size_mb", None)
@ -382,7 +382,7 @@ async def check_response_size_is_safe(response: Any) -> bool:
""" """
from litellm_proxy.proxy_server import general_settings, premium_user from litellm_proxy_extras.litellm_proxy.proxy_server import general_settings, premium_user
max_response_size_mb = general_settings.get("max_response_size_mb", None) max_response_size_mb = general_settings.get("max_response_size_mb", None)
if max_response_size_mb is not None: if max_response_size_mb is not None:
@ -465,7 +465,7 @@ def should_run_auth_on_pass_through_provider_route(route: str) -> bool:
- User is premium_user - User is premium_user
- User has enabled litellm_setting.use_client_credentials_pass_through_routes - User has enabled litellm_setting.use_client_credentials_pass_through_routes
""" """
from litellm_proxy.proxy_server import general_settings, premium_user from litellm_proxy_extras.litellm_proxy.proxy_server import general_settings, premium_user
if premium_user is not True: if premium_user is not True:
return False return False

View file

@ -19,7 +19,7 @@ from litellm._logging import verbose_proxy_logger
from litellm.caching.caching import DualCache from litellm.caching.caching import DualCache
from litellm.litellm_core_utils.dot_notation_indexing import get_nested_value from litellm.litellm_core_utils.dot_notation_indexing import get_nested_value
from litellm.llms.custom_httpx.httpx_handler import HTTPHandler from litellm.llms.custom_httpx.httpx_handler import HTTPHandler
from litellm_proxy._types import ( from litellm_proxy_extras.litellm_proxy._types import (
RBAC_ROLES, RBAC_ROLES,
JWKKeyValue, JWKKeyValue,
JWTAuthBuilderResult, JWTAuthBuilderResult,
@ -33,8 +33,8 @@ from litellm_proxy._types import (
ScopeMapping, ScopeMapping,
Span, Span,
) )
from litellm_proxy.auth.auth_checks import can_team_access_model from litellm_proxy_extras.litellm_proxy.auth.auth_checks import can_team_access_model
from litellm_proxy.utils import PrismaClient, ProxyLogging from litellm_proxy_extras.litellm_proxy.utils import PrismaClient, ProxyLogging
from .auth_checks import ( from .auth_checks import (
_allowed_routes_check, _allowed_routes_check,

View file

@ -4,7 +4,7 @@ from typing import Dict, List, Optional, Set
import litellm import litellm
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
from litellm_proxy._types import SpecialModelNames, UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import SpecialModelNames, UserAPIKeyAuth
from litellm.router import Router from litellm.router import Router
from litellm.types.router import LiteLLM_Params from litellm.types.router import LiteLLM_Params
from litellm.utils import get_valid_models from litellm.utils import get_valid_models

View file

@ -1,4 +1,4 @@
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
async def check_oauth2_token(token: str) -> UserAPIKeyAuth: async def check_oauth2_token(token: str) -> UserAPIKeyAuth:
@ -23,8 +23,8 @@ async def check_oauth2_token(token: str) -> UserAPIKeyAuth:
get_async_httpx_client, get_async_httpx_client,
httpxSpecialProvider, httpxSpecialProvider,
) )
from litellm_proxy._types import CommonProxyErrors from litellm_proxy_extras.litellm_proxy._types import CommonProxyErrors
from litellm_proxy.proxy_server import premium_user from litellm_proxy_extras.litellm_proxy.proxy_server import premium_user
if premium_user is not True: if premium_user is not True:
raise ValueError( raise ValueError(

View file

@ -3,14 +3,14 @@ from typing import Any, Dict
from fastapi import Request from fastapi import Request
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
from litellm_proxy._types import UserAPIKeyAuth from litellm_proxy_extras.litellm_proxy._types import UserAPIKeyAuth
async def handle_oauth2_proxy_request(request: Request) -> UserAPIKeyAuth: async def handle_oauth2_proxy_request(request: Request) -> UserAPIKeyAuth:
""" """
Handle request from oauth2 proxy. Handle request from oauth2 proxy.
""" """
from litellm_proxy.proxy_server import general_settings from litellm_proxy_extras.litellm_proxy.proxy_server import general_settings
verbose_proxy_logger.debug("Handling oauth2 proxy request") verbose_proxy_logger.debug("Handling oauth2 proxy request")
# Define the OAuth2 config mappings # Define the OAuth2 config mappings

View file

@ -4,7 +4,7 @@ from typing import List, Optional
from fastapi import HTTPException, Request, status from fastapi import HTTPException, Request, status
from litellm._logging import verbose_proxy_logger from litellm._logging import verbose_proxy_logger
from litellm_proxy._types import ( from litellm_proxy_extras.litellm_proxy._types import (
CommonProxyErrors, CommonProxyErrors,
LiteLLM_UserTable, LiteLLM_UserTable,
LiteLLMRoutes, LiteLLMRoutes,
@ -161,7 +161,7 @@ class RouteChecks:
@staticmethod @staticmethod
def custom_admin_only_route_check(route: str): def custom_admin_only_route_check(route: str):
from litellm_proxy.proxy_server import general_settings, premium_user from litellm_proxy_extras.litellm_proxy.proxy_server import general_settings, premium_user
if "admin_only_routes" in general_settings: if "admin_only_routes" in general_settings:
if premium_user is not True: if premium_user is not True:

View file

@ -22,8 +22,8 @@ from litellm._logging import verbose_logger, verbose_proxy_logger
from litellm._service_logger import ServiceLogging from litellm._service_logger import ServiceLogging
from litellm.caching import DualCache from litellm.caching import DualCache
from litellm.litellm_core_utils.dd_tracing import tracer from litellm.litellm_core_utils.dd_tracing import tracer
from litellm_proxy._types import * from litellm_proxy_extras.litellm_proxy._types import *
from litellm_proxy.auth.auth_checks import ( from litellm_proxy_extras.litellm_proxy.auth.auth_checks import (
_cache_key_object, _cache_key_object,
_get_user_role, _get_user_role,
_is_user_proxy_admin, _is_user_proxy_admin,
@ -37,8 +37,8 @@ from litellm_proxy.auth.auth_checks import (
get_user_object, get_user_object,
is_valid_fallback_model, is_valid_fallback_model,
) )
from litellm_proxy.auth.auth_exception_handler import UserAPIKeyAuthExceptionHandler from litellm_proxy_extras.litellm_proxy.auth.auth_exception_handler import UserAPIKeyAuthExceptionHandler
from litellm_proxy.auth.auth_utils import ( from litellm_proxy_extras.litellm_proxy.auth.auth_utils import (
get_end_user_id_from_request_body, get_end_user_id_from_request_body,
get_request_route, get_request_route,
is_pass_through_provider_route, is_pass_through_provider_route,
@ -46,11 +46,11 @@ from litellm_proxy.auth.auth_utils import (
route_in_additonal_public_routes, route_in_additonal_public_routes,
should_run_auth_on_pass_through_provider_route, should_run_auth_on_pass_through_provider_route,
) )
from litellm_proxy.auth.handle_jwt import JWTAuthManager, JWTHandler from litellm_proxy_extras.litellm_proxy.auth.handle_jwt import JWTAuthManager, JWTHandler
from litellm_proxy.auth.oauth2_check import check_oauth2_token from litellm_proxy_extras.litellm_proxy.auth.oauth2_check import check_oauth2_token
from litellm_proxy.auth.oauth2_proxy_hook import handle_oauth2_proxy_request from litellm_proxy_extras.litellm_proxy.auth.oauth2_proxy_hook import handle_oauth2_proxy_request
from litellm_proxy.common_utils.http_parsing_utils import _read_request_body from litellm_proxy_extras.litellm_proxy.common_utils.http_parsing_utils import _read_request_body
from litellm_proxy.utils import PrismaClient, ProxyLogging from litellm_proxy_extras.litellm_proxy.utils import PrismaClient, ProxyLogging
from litellm.types.services import ServiceTypes from litellm.types.services import ServiceTypes
user_api_key_service_logger_obj = ServiceLogging() # used for tracking latency on OTEL user_api_key_service_logger_obj = ServiceLogging() # used for tracking latency on OTEL
@ -227,7 +227,7 @@ async def _user_api_key_auth_builder( # noqa: PLR0915
azure_apim_header: Optional[str], azure_apim_header: Optional[str],
request_data: dict, request_data: dict,
) -> UserAPIKeyAuth: ) -> UserAPIKeyAuth:
from litellm_proxy.proxy_server import ( from litellm_proxy_extras.litellm_proxy.proxy_server import (
general_settings, general_settings,
jwt_handler, jwt_handler,
litellm_proxy_admin_name, litellm_proxy_admin_name,
@ -330,7 +330,7 @@ async def _user_api_key_auth_builder( # noqa: PLR0915
if general_settings.get("enable_oauth2_auth", False) is True: if general_settings.get("enable_oauth2_auth", False) is True:
# return UserAPIKeyAuth object # return UserAPIKeyAuth object
# helper to check if the api_key is a valid oauth2 token # helper to check if the api_key is a valid oauth2 token
from litellm_proxy.proxy_server import premium_user from litellm_proxy_extras.litellm_proxy.proxy_server import premium_user
if premium_user is not True: if premium_user is not True:
raise ValueError( raise ValueError(
@ -344,7 +344,7 @@ async def _user_api_key_auth_builder( # noqa: PLR0915
return await handle_oauth2_proxy_request(request=request) return await handle_oauth2_proxy_request(request=request)
if general_settings.get("enable_jwt_auth", False) is True: if general_settings.get("enable_jwt_auth", False) is True:
from litellm_proxy.proxy_server import premium_user from litellm_proxy_extras.litellm_proxy.proxy_server import premium_user
if premium_user is not True: if premium_user is not True:
raise ValueError( raise ValueError(

Some files were not shown because too many files have changed in this diff Show more