Skip to content

Commit 89a6c64

Browse files
authored
Merge pull request #712 from Pythagora-io/development
Development
2 parents b741e9e + e1c5a00 commit 89a6c64

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pilot/utils/llm_connection.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,15 @@ def return_result(result_data, lines_printed):
442442

443443
if response.status_code == 401 and 'BricksLLM' in response.text:
444444
print("", type='keyExpired')
445-
raise ApiError("Trial Expired", response=response)
445+
msg = "Trial Expired"
446+
key = os.getenv("OPENAI_API_KEY")
447+
endpoint = os.getenv("OPENAI_ENDPOINT")
448+
if key:
449+
msg += f"\n\n(using key ending in ...{key[-4:]}):"
450+
if endpoint:
451+
msg += f"\n(using endpoint: {endpoint}):"
452+
msg += f"\n\nError details: {response.text}"
453+
raise ApiError(msg, response=response)
446454

447455
if response.status_code != 200:
448456
project.dot_pilot_gpt.log_chat_completion(endpoint, model, req_type, data['messages'], response.text)

0 commit comments

Comments
 (0)