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

feat: add error handling and use EventSource for AI assistant #1265

Merged
merged 4 commits into from
Jun 12, 2023

Conversation

jczhong84
Copy link
Collaborator

  1. send errors through the event stream and show it on frontend with toast
  2. adopted the SSE stream format
  3. using EventSource on frontend to better handling the stream, instead of fetch

@jczhong84 jczhong84 changed the title feat: add error handling and use EventSource feat: add LLM error handling and use EventSource Jun 12, 2023
@jczhong84 jczhong84 changed the title feat: add LLM error handling and use EventSource feat: add error handling and use EventSource for AI assistant Jun 12, 2023
querybook/server/datasources/ai_assistant.py Show resolved Hide resolved
return func(self, *args, **kwargs)
except Exception as e:
LOG.error(e, exc_info=True)
callback_handler = kwargs.get("callback_handler")
Copy link
Collaborator

Choose a reason for hiding this comment

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

callback_handler is required, can you make it more explicit (not just in except)
it would be useful to note that callback_handler must be passed as kwargs not args

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actually callback_handler is not always required, only when it's a streaming function. and catch_error will also handle non streaming functions as well. will update

querybook/server/lib/ai_assistant/base_ai_assistant.py Outdated Show resolved Hide resolved
querybook/webapp/lib/datasource.ts Show resolved Hide resolved
querybook/webapp/lib/datasource.ts Outdated Show resolved Hide resolved
querybook/webapp/lib/datasource.ts Outdated Show resolved Hide resolved
@jczhong84 jczhong84 merged commit 4d7bb1b into pinterest:master Jun 12, 2023
4 checks passed
@jczhong84 jczhong84 deleted the feat/aierror branch June 28, 2023 06:34
aidenprice pushed a commit to arrowtail-precision/querybook that referenced this pull request Jan 3, 2024
…est#1265)

* feat: add error handling and use EventSource

* fix linter

* address comments

* raise from
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.

None yet

2 participants