Put link to explanation for message: Error Code 429 - You exceeded your current quota, please check your plan and billing details.
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ from io import StringIO
|
|
| 23 |
import sys
|
| 24 |
import re
|
| 25 |
|
| 26 |
-
from openai.error import AuthenticationError, InvalidRequestError
|
| 27 |
|
| 28 |
# Pertains to Express-inator functionality
|
| 29 |
from langchain.prompts import PromptTemplate
|
|
@@ -211,6 +211,7 @@ def set_openai_api_key(api_key):
|
|
| 211 |
llm = OpenAI(temperature=0, openai_api_key=api_key, max_tokens=MAX_TOKENS)
|
| 212 |
chain, express_chain = load_chain(TOOLS_DEFAULT_LIST, llm)
|
| 213 |
return chain, express_chain, llm
|
|
|
|
| 214 |
|
| 215 |
|
| 216 |
def run_chain(chain, inp, capture_hidden_text):
|
|
@@ -226,6 +227,8 @@ def run_chain(chain, inp, capture_hidden_text):
|
|
| 226 |
output = chain.run(input=inp)
|
| 227 |
except AuthenticationError as ae:
|
| 228 |
error_msg = AUTH_ERR_MSG
|
|
|
|
|
|
|
| 229 |
except ValueError as ve:
|
| 230 |
error_msg = "\n\nValueError, " + str(ve)
|
| 231 |
except InvalidRequestError as ire:
|
|
|
|
| 23 |
import sys
|
| 24 |
import re
|
| 25 |
|
| 26 |
+
from openai.error import AuthenticationError, InvalidRequestError, RateLimitError
|
| 27 |
|
| 28 |
# Pertains to Express-inator functionality
|
| 29 |
from langchain.prompts import PromptTemplate
|
|
|
|
| 211 |
llm = OpenAI(temperature=0, openai_api_key=api_key, max_tokens=MAX_TOKENS)
|
| 212 |
chain, express_chain = load_chain(TOOLS_DEFAULT_LIST, llm)
|
| 213 |
return chain, express_chain, llm
|
| 214 |
+
return None, None, None
|
| 215 |
|
| 216 |
|
| 217 |
def run_chain(chain, inp, capture_hidden_text):
|
|
|
|
| 227 |
output = chain.run(input=inp)
|
| 228 |
except AuthenticationError as ae:
|
| 229 |
error_msg = AUTH_ERR_MSG
|
| 230 |
+
except RateLimitError as rle:
|
| 231 |
+
error_msg = "\n\nRateLimitError, " + str(rle) + "\n\nPlease see https://help.openai.com/en/articles/6891831-error-code-429-you-exceeded-your-current-quota-please-check-your-plan-and-billing-details for more information."
|
| 232 |
except ValueError as ve:
|
| 233 |
error_msg = "\n\nValueError, " + str(ve)
|
| 234 |
except InvalidRequestError as ire:
|