Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
nqn committed Jan 30, 2024
1 parent 24bfb12 commit cc89330
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions log10/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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__
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit cc89330

Please sign in to comment.