Skip to content

Feat: Add basic error handling to Barista Bot chat loop #704

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Rahul-Lashkari
Copy link

Fixes #703

Description:

This PR adds basic error handling (try...except) to the main chat loop in the examples/Agents_Function_Calling_Barista_Bot.ipynb notebook to improve robustness against potential API errors, as discussed in issue #703.

Problem:

Currently, if the chat.send_message() call fails (due to network issues, API errors, rate limits, safety blocks, etc.), the script can crash, providing a poor user experience for those running the example.

Solution:

The chat.send_message() call and subsequent response display are wrapped in a try...except Exception as e: block. If an error occurs:

  • The exception message is printed.
  • A user-friendly message indicating the issue is displayed.
  • A 'q' option allows the user to exit the loop gracefully.
  • The loop otherwise continues, allowing the user to try again.

Impact:

Improves the robustness and user-friendliness of the Barista Bot example by gracefully handling potential API errors instead of crashing.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:examples Issues/PR referencing examples folder labels Apr 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:examples Issues/PR referencing examples folder status:awaiting review PR awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Add basic error handling to Barista Bot example chat loop
1 participant