Debian Codegraph @

hass_nabucasa/llm/errors.py

raw
1 """Custom LLM errors."""
2
3 from __future__ import annotations
4
5 from ..api import CloudApiError
6
7
8 class LLMError(CloudApiError):
9 """Base exception for LLM-related errors."""
10
11
12 class LLMRequestError(LLMError):
13 """Base error for LLM generation failures."""
14
15
16 class LLMAuthenticationError(LLMRequestError):
17 """Raised when LLM authentication fails."""
18
19
20 class LLMRateLimitError(LLMRequestError):
21 """Raised when LLM requests are rate limited."""
22
23
24 class LLMServiceError(LLMRequestError):
25 """Raised when LLM requests fail due to service issues."""
26
27
28 class LLMResponseError(LLMRequestError):
29 """Raised when LLM responses are unexpected."""
30
31
32 class LLMStreamEventError(LLMError):
33 """Base error for LLM stream event processing."""
34
35
36 class LLMStreamEventParseError(LLMStreamEventError):
37 """Raised when a stream event payload has an unexpected shape."""