Skip to content

Commit

Permalink
add retry for openai chatbot
Browse files Browse the repository at this point in the history
  • Loading branch information
ElmiraGhorbani committed Jul 25, 2023
1 parent 0509350 commit fee7cde
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chatgpt_long_term_memory/openai_engine/openai_chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, openai_chatbot_config: OpenAIChatConfig, **kw):
'gpt-3.5-turbo-16k': 16384
}

# @retry_on_openai_errors(max_retry=3)
@retry_on_openai_errors(max_retry=3)
def chat(self, user_input, chat_history=[]):
"""
This function serves as a wrapper for the OpenAI API, allowing the chatbot to generate a response to a user's query.
Expand All @@ -73,7 +73,7 @@ def chat(self, user_input, chat_history=[]):
7. The API returns a response that contains the generated message from the language model.
8. The chatbot extracts the assistant's response from the API response and returns it as the final output.
"""

if chat_history:
history = "\n".join(chat_history)
else:
Expand Down

0 comments on commit fee7cde

Please sign in to comment.