lunary-ai / lunary-py

Lunary AI Python Client (Analytics, monitoring and evaluations for GenAI apps)
https://lunary.ai/docs/py
19 stars 15 forks source link

Add TemplateNotFoundError #45

Open thatnerdjosh opened 3 months ago

thatnerdjosh commented 3 months ago

Context: When loading a prompt from Lunary, it would output an error without letting me know which template it is. I saw there was an Exception raised, it was just being contained within the library. This allows the user to do as they wish with error handling.

Feel free to adjust as necessary - re-raising in every scenario probably isn't ideal - I kept the scope of the changes to the __init__.py and limited to what seemed to be public interface.

  1. Adds TemplateNotFoundError.
  2. Re-raises errors to allow the client to handle them.
  3. Uses logger across the board.
  4. Adds .editorconfig for formatting.
thatnerdjosh commented 3 months ago

@hughcrt - for review :)

thatnerdjosh commented 3 months ago

@hughcrt - note - this PR is made with the intention on being able to act on (from the end user side) error conditions in Lunary.

When reviewing, please consider this. It's less about re-raising, or specific implementation details, and more about the ability to act on error conditions directly rather than side effects thereof.

thatnerdjosh commented 3 months ago

Closing