Skip to content

fix(search): preserve partial results after transport errors - #714

Open
DivyamTalwar wants to merge 1 commit into
VectifyAI:mainfrom
DivyamTalwar:fix/return-partial-search-after-transport-error
Open

DivyamTalwar wants to merge 1 commit into
VectifyAI:mainfrom
DivyamTalwar:fix/return-partial-search-after-transport-error

Conversation

@DivyamTalwar

Copy link
Copy Markdown

Problem

PageSearchClient.search() fans out page searches across the most relevant documents. It already returns partial results when one search returns an HTTP API error, except for HTTP 402. When a connection drops or a response times out instead, Requests raises inside the worker and the SDK loses results and usage already returned by other documents.

Changes

  • Report individual connection, timeout and interrupted-response failures in failed_documents when other documents succeed.
  • Keep the original exception if every selected document fails and preserve HTTP 402 as a failure of the whole search. The SDK's aggregation does not resend any search.
  • Clarify that aggregate usage reflects the responses received.

Validation

  • A loopback HTTP test with the real Requests adapter confirmed the behavior. The server accepted both page-search requests, disconnected one without a response and returned a valid result for the second. On main the caller got ConnectionError. The patch returns the second result and reports the first document as failed. Each endpoint received one request.
  • python -m pytest tests/test_client.py -q -k 'search or classify or extract' --tb=short passed all 34 selected tests.

AI-assisted implementation and testing.

This branch has not been deployed

No deployments
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.

1 participant