Skip to content

Commit

Permalink
Merge pull request #55 from log10-io/exception-handling
Browse files Browse the repository at this point in the history
Exception handling
  • Loading branch information
nqn authored Sep 1, 2023
2 parents d9a0388 + 6f6ed42 commit 189f991
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
21 changes: 21 additions & 0 deletions examples/logging/long_context_exception.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
from log10.load import log10
import openai

log10(openai)

openai.api_key = os.getenv("OPENAI_API_KEY")

text_to_repeat = "What is the meaning of life?" * 1000

response = openai.Completion.create(
model="text-davinci-003",
prompt=text_to_repeat,
temperature=0,
max_tokens=1024,
top_p=1,
frequency_penalty=0,
presence_penalty=0,
)

print(response)
3 changes: 2 additions & 1 deletion log10/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ def wrapper(*args, **kwargs):
f"LOG10: failed to insert in Bigquery: {log_row} with error {e}"
)
except Exception as e:
logging.error("LOG10: failed", e)
logging.debug("LOG10: failed", e)
raise e

return output

Expand Down

0 comments on commit 189f991

Please sign in to comment.