Skip to content

Enhancement: Add basic error handling to Barista Bot example chat loop #703

@Rahul-Lashkari

Description

@Rahul-Lashkari

Description of the feature request:

The chat loop in the examples/Agents_Function_Calling_Barista_Bot.ipynb notebook currently lacks error handling for the chat.send_message() API call.

What problem are you trying to solve with this feature?

If the API call fails (e.g., due to network issues, rate limits, API errors, safety blocks), the script crashes abruptly. This provides a suboptimal user experience for anyone running this interactive example.

Any other information you'd like to share?

Proposed Solution:

Wrap the chat.send_message() call within a try...except Exception as e: block. This will allow the script to catch potential errors, print a user-friendly message about the issue, and allow the user to either retry their input or exit the chat gracefully (e.g., by typing 'q').

Benefit:

This change will make the Barista Bot example more robust and user-friendly by preventing unexpected crashes due to common API or network problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions