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

6: Alexa tells when and why gpt is unavailable #18

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

paulotruta
Copy link
Owner

Trying to handle better possible errors coming from both the ChatGPT service as well as operational errors of the library we are using to communicate with it.

chatgpt.reset_chat()
# Uses the session_token to get a new bearer token
chatgpt.refresh_session()
Copy link
Owner Author

Choose a reason for hiding this comment

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

This is not needed. Looking at the revChatGPT lib Chatbot class, we an see:

class Chatbot:
    """
    Initializes the chatbot

    See wiki for the configuration json:
    https://github.com/acheong08/ChatGPT/wiki/Setup

    :param config: The configuration json
    :type config: :obj:`json`

    :param conversation_id: The conversation ID
    :type conversation_id: :obj:`str`, optional
    
    :param parent_id: The parent ID
    :type parent_id: :obj:`str`, optional

    :param debug: Whether to enable debug mode
    :type debug: :obj:`bool`, optional

    :param refresh: Whether to refresh the session
    :type refresh: :obj:`bool`, optional

    :return: None or Exception
    """
    (...)
     def __init__(self, config, conversation_id=None, parent_id=None, debug=False, refresh=True) -> Exception:
     (...)

This is automatically part of the instantiation of the class. So I guess not needed here?

inverse
inverse previously approved these changes Dec 11, 2022
Copy link
Collaborator

@inverse inverse left a comment

Choose a reason for hiding this comment

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

Minor comments, but looks good 👍

lambda/utils.py Outdated Show resolved Hide resolved
lambda/utils.py Outdated Show resolved Hide resolved
if chat_response:
logger.info("ChatGPT says: " + chat_response)
return chat_response
else:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Else redundant

paulotruta and others added 2 commits December 12, 2022 09:04
Removed default value from response error message fetching

Co-authored-by: Malachi Soord <inverse.chi@gmail.com>
Using f string instead of string concat

Co-authored-by: Malachi Soord <inverse.chi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When communication with chatGPT is not possible, Alexa should be more detailed about it (and the why)
2 participants