forked from phoenix/litellm-mirror
(feat) support headers for generic API logger
This commit is contained in:
parent
b3f5402017
commit
3e90acb750
2 changed files with 16 additions and 1 deletions
|
@ -31,10 +31,24 @@ class GenericAPILogger:
|
|||
# Class variables or attributes
|
||||
def __init__(self, endpoint=None, headers=None):
|
||||
try:
|
||||
verbose_logger.debug(f"in init GenericAPILogger, endpoint {endpoint}")
|
||||
if endpoint == None:
|
||||
# check env for "GENERIC_LOGGER_ENDPOINT"
|
||||
if os.getenv("GENERIC_LOGGER_ENDPOINT"):
|
||||
# Do something with the endpoint
|
||||
endpoint = os.getenv("GENERIC_LOGGER_ENDPOINT")
|
||||
else:
|
||||
# Handle the case when the endpoint is not found in the environment variables
|
||||
raise ValueError(
|
||||
f"endpoint not set for GenericAPILogger, GENERIC_LOGGER_ENDPOINT not found in environment variables"
|
||||
)
|
||||
headers = headers or litellm.generic_logger_headers
|
||||
self.endpoint = endpoint
|
||||
self.headers = headers
|
||||
|
||||
verbose_logger.debug(
|
||||
f"in init GenericAPILogger, endpoint {self.endpoint}, headers {self.headers}"
|
||||
)
|
||||
|
||||
pass
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
@ -146,6 +146,7 @@ model_cost_map_url: str = "https://raw.githubusercontent.com/BerriAI/litellm/mai
|
|||
suppress_debug_info = False
|
||||
dynamodb_table_name: Optional[str] = None
|
||||
s3_callback_params: Optional[Dict] = None
|
||||
generic_logger_headers: Optional[Dict] = None
|
||||
default_key_generate_params: Optional[Dict] = None
|
||||
upperbound_key_generate_params: Optional[Dict] = None
|
||||
default_team_settings: Optional[List] = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue