Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Better ErrorEvents #155

Closed
wants to merge 6 commits into from
Closed

[Feature] Better ErrorEvents #155

wants to merge 6 commits into from

Conversation

siyangqiu
Copy link
Contributor

📥 Pull Request

📘 Description
We are currently not recording the error types anywhere and instead loading it into the details field. This change makes use of the error types field and automatically captures stack traces.

Need recommendations for names for the Langchain handler!

@HowieG, are all of the fields in ErrorEvent sent to the API server? Is there a way for us to create an exceptions field that auto populates the error_type and details fields (if they aren't provided)?

@siyangqiu siyangqiu changed the title Better ErrorEvents [Feature] Better ErrorEvents Apr 19, 2024
@siyangqiu siyangqiu marked this pull request as ready for review April 19, 2024 18:12
@@ -80,7 +80,7 @@ def on_llm_error(
llm_event: LLMEvent = self.events.llm[str(run_id)]
self.ao_client.record(llm_event)

error_event = ErrorEvent(trigger_event=llm_event, details=str(error), timestamp=get_ISO_time())
error_event = ErrorEvent(trigger_event=llm_event, error_type=type(error).__name__, details=str(error), timestamp=get_ISO_time())
Copy link
Contributor

@bboynton97 bboynton97 Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking more like

error_event = ErrorEvent(trigger_event=llm_event, error=error)

and then the ErrorEvent constructor does the rest:

def __init__(self, trigger_event, error):
  self.error_type = error_type=type(error).__name__
  self.details = str(error)
  self.timestamp = get_ISO_time()

it's less work for the developer to have to do. more magic

Copy link
Contributor

@bboynton97 bboynton97 Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or actually maybe like this

def __init__(self, trigger_event, error, error_type = None, details = None, timestamp = None):
  self.error_type = error_type or error_type=type(error).__name__
  self.details =  details or str(error)
  self.timestamp = timestamp or get_ISO_time()

@siyangqiu
Copy link
Contributor Author

Howard is doing a better version

@siyangqiu siyangqiu closed this Apr 19, 2024
@siyangqiu siyangqiu deleted the error-handling branch April 19, 2024 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants