(feat) disable logging per request

This commit is contained in:
ishaan-jaff 2024-03-08 16:25:54 -08:00
parent 321769a74d
commit 986a526790
2 changed files with 11 additions and 6 deletions

View file

@ -563,6 +563,7 @@ def completion(
"caching_groups", "caching_groups",
"ttl", "ttl",
"cache", "cache",
"no-log",
] ]
default_params = openai_params + litellm_params default_params = openai_params + litellm_params
non_default_params = { non_default_params = {
@ -2417,6 +2418,7 @@ def embedding(
"caching_groups", "caching_groups",
"ttl", "ttl",
"cache", "cache",
"no-log",
] ]
default_params = openai_params + litellm_params default_params = openai_params + litellm_params
non_default_params = { non_default_params = {

View file

@ -2985,12 +2985,15 @@ def client(original_function):
print_verbose( print_verbose(
f"Async Wrapper: Completed Call, calling async_success_handler: {logging_obj.async_success_handler}" f"Async Wrapper: Completed Call, calling async_success_handler: {logging_obj.async_success_handler}"
) )
asyncio.create_task( # check if user does not want this to be logged
logging_obj.async_success_handler(result, start_time, end_time) if kwargs.get("no-log", False) == False:
) asyncio.create_task(
threading.Thread( logging_obj.async_success_handler(result, start_time, end_time)
target=logging_obj.success_handler, args=(result, start_time, end_time) )
).start() threading.Thread(
target=logging_obj.success_handler,
args=(result, start_time, end_time),
).start()
# RETURN RESULT # RETURN RESULT
if hasattr(result, "_hidden_params"): if hasattr(result, "_hidden_params"):