Guides
Error Handling
Handling exceptions in Celeste.
Error Handling
Celeste provides a hierarchy of exceptions to help you handle errors gracefully. All exceptions inherit from celeste.exceptions.Error.
Exception Hierarchy
Error: Base class for all Celeste errors.ModelErrorModelNotFoundError: The requested model (or a default) could not be found.
ClientErrorClientNotFoundError: No client implementation exists for the provider/modality.ModalityNotFoundError: No client registered for the requested modality.
CredentialsErrorMissingCredentialsError: API key is missing.UnsupportedProviderError: Provider is not configured in the credential system.
ValidationErrorConstraintViolationError: A parameter value violates model constraints (e.g., temperature > 2.0).UnsupportedParameterError: The model doesn't support a passed parameter.
StreamingErrorStreamingNotSupportedError: The model doesn't support streaming.StreamNotExhaustedError: Accessed.outputbefore stream finished.StreamEmptyError: Stream produced no chunks.
httpx.HTTPStatusError: Underlying HTTP errors from providers (400, 401, 429, 500).
Example
import celeste
from celeste.exceptions import MissingCredentialsError, ModelNotFoundError
import httpx
try:
response = await celeste.text.generate(
model="gpt-4o",
prompt="Hello"
)
except MissingCredentialsError:
print("Please set your OPENAI_API_KEY.")
except ModelNotFoundError:
print("The requested model isn't available.")
except httpx.HTTPStatusError as e:
print(f"Provider API error: {e.response.status_code} - {e.response.text}")