Spaces:
Build error
Build error
AppleBotzz
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -55,7 +55,7 @@ def generate_response(endpoint, api_key, model, user_prompt):
|
|
55 |
response_text = response.content[0].text
|
56 |
except Exception as e:
|
57 |
print(e)
|
58 |
-
response_text = "An error occurred while generating the response. Check that your API key is correct!"
|
59 |
else:
|
60 |
try:
|
61 |
# Generate a response using the selected OpenAI model
|
@@ -70,7 +70,7 @@ def generate_response(endpoint, api_key, model, user_prompt):
|
|
70 |
response_text = response.choices[0].message.content
|
71 |
except Exception as e:
|
72 |
print(e)
|
73 |
-
response_text = "An error occurred while generating the response. Check that your API key is correct!"
|
74 |
|
75 |
json_string, json_json = extract_json(response_text)
|
76 |
json_file = json_string if json_string else None
|
@@ -151,7 +151,7 @@ def generate_second_response(endpoint, api_key, model, generated_output):
|
|
151 |
response_text = response.content[0].text
|
152 |
except Exception as e:
|
153 |
print(e)
|
154 |
-
response_text = "An error occurred while generating the response. Check that your API key is correct!"
|
155 |
else:
|
156 |
try:
|
157 |
# Generate a response using the selected OpenAI model
|
@@ -166,7 +166,7 @@ def generate_second_response(endpoint, api_key, model, generated_output):
|
|
166 |
response_text = response.choices[0].message.content
|
167 |
except Exception as e:
|
168 |
print(e)
|
169 |
-
response_text = "An error occurred while generating the response. Check that your API key is correct!"
|
170 |
|
171 |
return response_text
|
172 |
|
|
|
55 |
response_text = response.content[0].text
|
56 |
except Exception as e:
|
57 |
print(e)
|
58 |
+
response_text = f"An error occurred while generating the response. Check that your API key is correct! More info: {e}"
|
59 |
else:
|
60 |
try:
|
61 |
# Generate a response using the selected OpenAI model
|
|
|
70 |
response_text = response.choices[0].message.content
|
71 |
except Exception as e:
|
72 |
print(e)
|
73 |
+
response_text = f"An error occurred while generating the response. Check that your API key is correct! More info: {e}"
|
74 |
|
75 |
json_string, json_json = extract_json(response_text)
|
76 |
json_file = json_string if json_string else None
|
|
|
151 |
response_text = response.content[0].text
|
152 |
except Exception as e:
|
153 |
print(e)
|
154 |
+
response_text = f"An error occurred while generating the response. Check that your API key is correct! More info: {e}"
|
155 |
else:
|
156 |
try:
|
157 |
# Generate a response using the selected OpenAI model
|
|
|
166 |
response_text = response.choices[0].message.content
|
167 |
except Exception as e:
|
168 |
print(e)
|
169 |
+
response_text = f"An error occurred while generating the response. Check that your API key is correct! More info: {e}"
|
170 |
|
171 |
return response_text
|
172 |
|