You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: interpreter/core/respond.py
+17-5Lines changed: 17 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -101,10 +101,11 @@ def respond(interpreter):
101
101
# Provide extra information on how to change API keys, if we encounter that error
102
102
# (Many people writing GitHub issues were struggling with this)
103
103
exceptExceptionase:
104
+
error_message=str(e).lower()
104
105
if (
105
106
interpreter.offline==False
106
-
and"auth"instr(e).lower()
107
-
or"api key"instr(e).lower()
107
+
and"auth"inerror_message
108
+
or"api key"inerror_message
108
109
):
109
110
output=traceback.format_exc()
110
111
raiseException(
@@ -113,9 +114,20 @@ def respond(interpreter):
113
114
elif (
114
115
interpreter.offline==Falseand"not have access"instr(e).lower()
115
116
):
116
-
response=input(
117
-
f" You do not have access to {interpreter.llm.model}. You will need to add a payment method and purchase credits for the OpenAI API billing page (different from ChatGPT) to use `GPT-4`.\n\nhttps://platform.openai.com/account/billing/overview\n\nWould you like to try GPT-3.5-TURBO instead? (y/n)\n\n "
118
-
)
117
+
"""
118
+
Check for invalid model in error message and then fallback to groq, then OpenAI.
119
+
"""
120
+
if (
121
+
"invalid model"inerror_message
122
+
or"model does not exist"inerror_message
123
+
):
124
+
provider_message=f" The model '{interpreter.llm.model}' does not exist or is invalid. Please check the model name and try again.\n\nWould you like to try an alternative model instead? (y/n)\n\n "
125
+
elif"groq"inerror_message:
126
+
provider_message=f" You do not have access to {interpreter.llm.model}. Please check with Groq for more details.\n\nWould you like to try an alternative model instead? (y/n)\n\n "
127
+
else:
128
+
provider_message=f" You do not have access to {interpreter.llm.model}. You will need to add a payment method and purchase credits for the OpenAI API billing page (different from ChatGPT) to use `GPT-4`.\n\nhttps://platform.openai.com/account/billing/overview\n\nWould you like to try GPT-3.5-TURBO instead? (y/n)\n\n "
0 commit comments