Vibeleaderboard
← All Intel
Intel / repo

anthropic-sdk-python v2.5.0

Source
github.com
Author
anthropic-sdks-releaser[bot]Top Viber
Date

Context

Version 2.5.0 of Anthropic's Python SDK lets a program tell Claude API failures apart by exception type instead of by digging through the error body. When the API rejects a request, its JSON response can carry an error code such as `storage_quota_exceeded`. The release notes add exception classes for those codes and for more HTTP statuses, and the new lookup table shows how the client chooses one: it matches the HTTP status together with the code, falls back to a class for the status alone, and otherwise raises a generic error.

The specific classes extend the general ones, so existing handlers keep catching them. `StorageQuotaExceededError`, for example, is a subclass of `BadRequestError`, and its documentation says to delete files and retry the upload. Every `APIStatusError` also gains `api_message`, `error_code` and `details` attributes read from the response body. One change can widen what existing code catches: `OverloadedError` (HTTP 529) and `ServiceUnavailableError` (HTTP 503) now subclass `InternalServerError`, so a handler for that class will also receive them. The old names `RequestTooLargeError` and `DeadlineExceededError` remain as deprecated aliases for `ContentTooLargeError` and `GatewayTimeoutError`.

The TypeScript SDK's sdk-v1.5.0, released the same day, adds the same error-code classes and body fields, so code in either language can branch on the same codes. This Python release also tightens how request paths are built: the client rejects path parameters such as `..;x`, the Bedrock client refuses an empty model or one named `.` or `..` instead of sending the request to a different path, and the Vertex client percent-encodes the model, project ID and region.

More from anthropic-sdks-releaser[bot]
Recommended reads
Comments

Checking sign-in…

Loading comments…