From cc893307dffa48ed251ba302ff71a7819ba27a34 Mon Sep 17 00:00:00 2001 From: Niklas Nielsen Date: Tue, 30 Jan 2024 13:29:03 -0800 Subject: [PATCH] Formatting --- log10/load.py | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/log10/load.py b/log10/load.py index 0395cab5..230dedad 100644 --- a/log10/load.py +++ b/log10/load.py @@ -28,9 +28,7 @@ # log10, bigquery target_service = os.environ.get("LOG10_DATA_STORE", "log10") if target_service == "bigquery": - raise NotImplementedError( - "For big query support, please get in touch with us at support@log10.io" - ) + raise NotImplementedError("For big query support, please get in touch with us at support@log10.io") def is_openai_v1() -> bool: @@ -105,9 +103,7 @@ def get_session_id(): try: sessionID = res.json().get("sessionID") except Exception as e: - logger.warning( - f"LOG10: failed to get session ID. Error: {e}. Skipping session scope recording." - ) + logger.warning(f"LOG10: failed to get session ID. Error: {e}. Skipping session scope recording.") return sessionID @@ -170,9 +166,7 @@ def wrapper(*args, **kwargs): organizationSlug = r.json().get("organizationSlug") last_completion_response = r.json() except Exception as e: - logger.warning( - f"LOG10: failed to get completion ID. Error: {e}. Skipping completion recording." - ) + logger.warning(f"LOG10: failed to get completion ID. Error: {e}. Skipping completion recording.") return func_with_backoff(func, *args, **kwargs) completion_url = f"{url}/api/completions/{completionID}" @@ -222,11 +216,7 @@ def wrapper(*args, **kwargs): duration = time.perf_counter() - start_time logger.debug(f"LOG10: failed - {e}") # todo: change with openai v1 update - if type( - e - ).__name__ == "InvalidRequestError" and "This model's maximum context length" in str( - e - ): + if type(e).__name__ == "InvalidRequestError" and "This model's maximum context length" in str(e): failure_kind = "ContextWindowExceedError" else: failure_kind = type(e).__name__ @@ -365,9 +355,7 @@ def log10(module, DEBUG_=False, USE_ASYNC_=True): logger.setLevel(logging.DEBUG if DEBUG else logging.WARNING) if USE_ASYNC_: - logger.debug( - "LOG10: USE_ASYNC is deprecated. Calls are synchronous by default." - ) + logger.debug("LOG10: USE_ASYNC is deprecated. Calls are synchronous by default.") # def intercept_nested_functions(obj): # for name, attr in vars(obj).items():