Coverage for .venv/lib/python3.13/site-packages/litellm/proxy/management_endpoints/callback_management_endpoints.py: 100%

18 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 12:01 +0000

1""" 

2Endpoints for managing callbacks 

3""" 

4 

5import json 

6import os 

7from typing import Final 

8 

9from fastapi import APIRouter, Depends 

10 

11from litellm.litellm_core_utils.logging_callback_manager import CallbacksByType 

12from litellm.proxy.auth.user_api_key_auth import user_api_key_auth 

13 

14router: Final = APIRouter() 

15 

16 

17@router.get( 

18 "/callbacks/list", 

19 tags=["Logging Callbacks"], 

20 dependencies=[Depends(user_api_key_auth)], 

21 response_model=CallbacksByType, 

22) 

23async def list_callbacks(): 

24 """ 

25 View List of Active Logging Callbacks 

26 """ 

27 from litellm import logging_callback_manager 

28 

29 # Get callbacks organized by type using the callback manager utility 

30 callbacks_by_type: Final = logging_callback_manager.get_callbacks_by_type() 

31 

32 return callbacks_by_type 

33 

34 

35@router.get( 

36 "/callbacks/configs", 

37 tags=["Logging Callbacks"], 

38 dependencies=[Depends(user_api_key_auth)], 

39) 

40async def get_callback_configs(): 

41 """ 

42 Get Available Callback Configurations 

43 

44 Returns the configuration details for all available logging callbacks, 

45 including supported parameters, field types, and descriptions. 

46 """ 

47 config_path: Final = os.path.join( 

48 os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 

49 "integrations", 

50 "callback_configs.json", 

51 ) 

52 

53 with open(config_path, "r") as f: 

54 configs: Final = json.load(f) 

55 

56 return configs