OpenAI to not speak out whole errors (#126409)

* OpenAI to not speak out whole errors

* Update snapshot
This commit is contained in:
Paulus Schoutsen 2024-09-22 21:26:33 -04:00 committed by GitHub
parent c759512c70
commit ba48a86156
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -148,7 +148,7 @@ class OpenAIConversationEntity(
LOGGER.error("Error getting LLM API: %s", err)
intent_response.async_set_error(
intent.IntentResponseErrorCode.UNKNOWN,
f"Error preparing LLM API: {err}",
"Error preparing LLM API",
)
return conversation.ConversationResult(
response=intent_response, conversation_id=user_input.conversation_id
@ -208,7 +208,7 @@ class OpenAIConversationEntity(
intent_response = intent.IntentResponse(language=user_input.language)
intent_response.async_set_error(
intent.IntentResponseErrorCode.UNKNOWN,
f"Sorry, I had a problem with my template: {err}",
"Sorry, I had a problem with my template",
)
return conversation.ConversationResult(
response=intent_response, conversation_id=conversation_id
@ -248,10 +248,11 @@ class OpenAIConversationEntity(
user=conversation_id,
)
except openai.OpenAIError as err:
LOGGER.error("Error talking to OpenAI: %s", err)
intent_response = intent.IntentResponse(language=user_input.language)
intent_response.async_set_error(
intent.IntentResponseErrorCode.UNKNOWN,
f"Sorry, I had a problem talking to OpenAI: {err}",
"Sorry, I had a problem talking to OpenAI",
)
return conversation.ConversationResult(
response=intent_response, conversation_id=conversation_id

View File

@ -20,7 +20,7 @@
speech=dict({
'plain': dict({
'extra_data': None,
'speech': 'Error preparing LLM API: API non-existing not found',
'speech': 'Error preparing LLM API',
}),
}),
speech_slots=dict({