forked from phoenix/litellm-mirror
feat(lago.py): adding support for usage-based billing with lago
Closes https://github.com/BerriAI/litellm/issues/3639
This commit is contained in:
parent
00b9f1290e
commit
e273e66618
6 changed files with 198 additions and 12 deletions
|
@ -2,7 +2,7 @@ import sys, os, platform, time, copy, re, asyncio, inspect
|
|||
import threading, ast
|
||||
import shutil, random, traceback, requests
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from typing import Optional, List, Callable
|
||||
from typing import Optional, List, Callable, get_args
|
||||
import secrets, subprocess
|
||||
import hashlib, uuid
|
||||
import warnings
|
||||
|
@ -2207,8 +2207,18 @@ class ProxyConfig:
|
|||
elif key == "callbacks":
|
||||
if isinstance(value, list):
|
||||
imported_list: List[Any] = []
|
||||
known_compatible_callbacks = list(
|
||||
get_args(
|
||||
litellm._custom_logger_compatible_callbacks_literal
|
||||
)
|
||||
)
|
||||
for callback in value: # ["presidio", <my-custom-callback>]
|
||||
if isinstance(callback, str) and callback == "presidio":
|
||||
if (
|
||||
isinstance(callback, str)
|
||||
and callback in known_compatible_callbacks
|
||||
):
|
||||
imported_list.append(callback)
|
||||
elif isinstance(callback, str) and callback == "presidio":
|
||||
from litellm.proxy.hooks.presidio_pii_masking import (
|
||||
_OPTIONAL_PresidioPIIMasking,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue