Release v2.0.3-beta

This commit is contained in:
SMKRV
2024-11-29 00:15:27 +03:00
parent ae8f8bda03
commit 3d064f5b9d
2 changed files with 6 additions and 1 deletions
@@ -106,6 +106,11 @@ class APIClient:
return await self._create_openai_completion(
model, messages, temperature, max_tokens
)
except (KeyError, IndexError) as e:
if "'choices'" in str(e) or "'message'" in str(e):
raise HomeAssistantError("Failed to get a response from the AI model. Please check your internet connection and try again later.")
else:
raise
except Exception as e:
_LOGGER.error("API request failed: %s", str(e))
raise HomeAssistantError(f"API request failed: {str(e)}")