Errors#

This page documents the exception classes for error handling.

Note

Swift Equivalent: GenerationError cooresponds to the the LanguageModelSession.GenerationError in the Swift Foundation Models Framework. ToolCallError corresponds to the LanguageModelSession.ToolCallError in the Swift Foundation Models Framework. InvalidGenerationSchemaError is unique to the Python SDK and does not have a direct Swift equivalent since it means a schema failed to compile in the underlying Swift.

Base Exceptions#

FoundationModelsError#

Generation Errors#

GenerationError#

ExceededContextWindowSizeError#

AssetsUnavailableError#

GuardrailViolationError#

UnsupportedGuideError#

UnsupportedLanguageOrLocaleError#

DecodingFailureError#

RateLimitedError#

ConcurrentRequestsError#

RefusalError#

Schema Errors#

InvalidGenerationSchemaError#

Tool Errors#

ToolCallError#