LLMfyException
llmfy.exception.llmfy_exception
LLMfy Exception Handling
Documentation References:
- AWS Bedrock Converse API: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
- OpenAI Python SDK: https://github.com/openai/openai-python#handling-errors
- Google Gen AI SDK: https://github.com/googleapis/python-genai#error-handling
Example of catching and inspecting an error:
try:
# _call_llmfy
pass
except LLMfyException as e:
print(f"Error: {e.message}")
print(f"Status Code: {e.status_code}")
print(f"Provider: {e.provider}")
print(f"Raw Error: {e.raw_error}")
# Check specific exception type
if isinstance(e, RateLimitException):
print("Rate limited! Implement backoff...")
elif isinstance(e, TimeoutException):
print("Request timed out! Retry...")
LLMfyException
Bases: Exception
Base LLMfy Exception
Example of catching and inspecting an error:
try:
# _call_llmfy
pass
except LLMfyException as e:
print(f"Error: {e.message}")
print(f"Status Code: {e.status_code}")
print(f"Provider: {e.provider}")
print(f"Raw Error: {e.raw_error}")
# Check specific exception type
if isinstance(e, RateLimitException):
print("Rate limited! Implement backoff...")
elif isinstance(e, TimeoutException):
print("Request timed out! Retry...")
Source code in llmfy/exception/llmfy_exception.py
message = message
instance-attribute
status_code = status_code
instance-attribute
raw_error = raw_error
instance-attribute
provider = provider
instance-attribute
__init__(message, status_code=None, raw_error=None, provider=None)
Source code in llmfy/exception/llmfy_exception.py
RateLimitException
QuotaExceededException
TimeoutException
InvalidRequestException
AuthenticationException
PermissionDeniedException
ModelNotFoundException
Bases: LLMfyException
Model not found or unavailable
Source code in llmfy/exception/llmfy_exception.py
ServiceUnavailableException
Bases: LLMfyException
Service temporarily unavailable
Source code in llmfy/exception/llmfy_exception.py
ContentFilterException
Bases: LLMfyException
Content blocked by safety filters