diff --git a/api.md b/api.md index 7f5698f1..44f97ac8 100644 --- a/api.md +++ b/api.md @@ -95,7 +95,7 @@ Methods: - client.messages.batches.list(\*\*params) -> SyncPage[MessageBatch] - client.messages.batches.delete(message_batch_id) -> DeletedMessageBatch - client.messages.batches.cancel(message_batch_id) -> MessageBatch -- client.messages.batches.results(message_batch_id) -> BinaryAPIResponse +- client.messages.batches.results(message_batch_id) -> JSONLDecoder[MessageBatchIndividualResponse] # Models @@ -218,4 +218,4 @@ Methods: - client.beta.messages.batches.list(\*\*params) -> SyncPage[BetaMessageBatch] - client.beta.messages.batches.delete(message_batch_id) -> BetaDeletedMessageBatch - client.beta.messages.batches.cancel(message_batch_id) -> BetaMessageBatch -- client.beta.messages.batches.results(message_batch_id) -> BinaryAPIResponse +- client.beta.messages.batches.results(message_batch_id) -> JSONLDecoder[MessageBatchIndividualResponse] diff --git a/src/anthropic/_response.py b/src/anthropic/_response.py index 32104410..830bee51 100644 --- a/src/anthropic/_response.py +++ b/src/anthropic/_response.py @@ -226,7 +226,9 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if origin == APIResponse: raise RuntimeError("Unexpected state - cast_to is `APIResponse`") - if inspect.isclass(origin) and issubclass(origin, httpx.Response): + if inspect.isclass( + origin # pyright: ignore[reportUnknownArgumentType] + ) and issubclass(origin, httpx.Response): # Because of the invariance of our ResponseT TypeVar, users can subclass httpx.Response # and pass that class to our request functions. We cannot change the variance to be either # covariant or contravariant as that makes our usage of ResponseT illegal. We could construct