Skip to content

fix(api): build the Anthropic client's timeout with anthropic.Timeout - #4752

Merged
nicoloboschi merged 2 commits into
vectorize-io:mainfrom
drakeo338:claude/4683-fix
Sep 25, 2026
Merged

nicoloboschi merged 2 commits into
vectorize-io:mainfrom
drakeo338:claude/4683-fix

Conversation

@drakeo338

Copy link
Copy Markdown
Contributor

Fixes #4683.

build_sdk_timeout always built an httpx.Timeout and handed it to the Anthropic client. anthropic 1.x runs on httpx2 rather than httpx and doesn't accept that type, and on 1.0.x it fails every request instead with TypeError: unsupported operand type(s) for +: 'float' and 'Timeout', surfacing as APIConnectionError.

build_sdk_timeout now takes the SDK's own Timeout class as a parameter (defaulting to httpx.Timeout for the other transports), and AnthropicLLM passes anthropic.Timeout so the client gets a timeout its own SDK accepts. Added a regression test covering this.

drakeo338 and others added 2 commits September 25, 2026 00:55
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
@nicoloboschi

Copy link
Copy Markdown
Collaborator

Thanks! Pushed one small follow-up commit: updated the comments in llm_transport.py that still said both SDKs sit on httpx (anthropic 1.x uses httpx2). Running full CI before merge.

@nicoloboschi
nicoloboschi merged commit 148ba35 into vectorize-io:main Sep 25, 2026
226 of 228 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fact extraction fails with APIConnectionError wrapping "TypeError: unsupported operand type(s) for +: 'float' and 'Timeout'" (anthropic provider)

2 participants