Repository navigation
fix(api): build the Anthropic client's timeout with anthropic.Timeout - #4752
Merged
Merged
Conversation
build_sdk_timeout always returned an httpx.Timeout. anthropic 1.x runs on
httpx2, so the Anthropic provider broke on any fresh install: 1.8.0 refuses
to construct the client ("this SDK uses `httpx2`"), and 1.0.0 accepts it but
fails every request with "unsupported operand type(s) for +: 'float' and
'Timeout'", surfaced as APIConnectionError.
build_sdk_timeout now takes the Timeout class to build, defaulting to
httpx.Timeout, and the Anthropic provider passes anthropic.Timeout. That is
httpx.Timeout on 0.x and httpx2.Timeout on 1.x, so both keep the capped
connect phase. The OpenAI clients are unchanged: openai 3.x converts a
legacy httpx.Timeout itself.
Fixes vectorize-io#4683
…httpx2 Review fixes: - module docstring said both SDKs sit on httpx; anthropic 1.x uses httpx2 - httpx import comment listed anthropic unconditionally - build_sdk_timeout docstring called the result an httpx timeout
Collaborator
|
Thanks! Pushed one small follow-up commit: updated the comments in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4683.
build_sdk_timeoutalways built anhttpx.Timeoutand handed it to the Anthropic client. anthropic 1.x runs onhttpx2rather thanhttpxand doesn't accept that type, and on 1.0.x it fails every request instead withTypeError: unsupported operand type(s) for +: 'float' and 'Timeout', surfacing asAPIConnectionError.build_sdk_timeoutnow takes the SDK's ownTimeoutclass as a parameter (defaulting tohttpx.Timeoutfor the other transports), andAnthropicLLMpassesanthropic.Timeoutso the client gets a timeout its own SDK accepts. Added a regression test covering this.