Skip to content

vectorstores/qdrant: add WithHTTPClient option - Issue #1249 - #1584

Open
Priya-9 wants to merge 1 commit into
tmc:mainfrom
Priya-9:vectorstores-qdrant-http-client
Open

Priya-9 wants to merge 1 commit into
tmc:mainfrom
Priya-9:vectorstores-qdrant-http-client

Conversation

@Priya-9

@Priya-9 Priya-9 commented Nov 24, 2026

Copy link
Copy Markdown

Adds a WithHTTPClient(*http.Client) option to vectorstores/qdrant, so callers can use their own HTTP client (timeouts, proxies, custom TLS, tracing transports). Today every request goes through httputil.DefaultClient, and there is no way to change it.

Changes

  • Store has a new httpClient field. New sets it to httputil.DefaultClient when the option is not used (or is passed nil), so existing behavior is unchanged.
  • AddDocuments and SimilaritySearch send their requests through the store's client.
  • The exported DoRequest keeps its signature and behavior (it still uses httputil.DefaultClient). It now delegates to an unexported doRequest that takes the client.

This follows the existing WithHTTPClient options in vectorstores/weaviate and vectorstores/azureaisearch.

Relation to #1249

#1249 asks for passing a *qdrant.Client from github.com/qdrant/go-client. This package talks to the Qdrant REST API directly, so that would need the migration in #1008. This PR is a smaller step: it lets callers control the HTTP client the store already uses. It does not close #1249.

Testing

  • TestOptions: new WithHTTPClient subtest.
  • TestNew_HTTPClient: the default client, and the fallback when nil is passed.
  • TestWithHTTPClient_IsUsed: an httptest server and a counting transport; checks that both the upsert and the search request go through the custom client. I confirmed this test fails if doRequest goes back to httputil.DefaultClient.
  • go vet, go test and go test -race on ./vectorstores/qdrant/ pass; golangci-lint v2.9.0 reports 0 issues.

Updates #1249

PR Checklist

  • Read the Contributing documentation.
  • Read the Code of conduct documentation.
  • Name your Pull Request title clearly, concisely, and prefixed with the name of the primarily affected package you changed according to Good commit messages (such as memory: add interfaces for X, Y or util: add whizzbang helpers).
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. Fixes #123).
  • Describes the source of new concepts.
  • References existing implementations as appropriate.
  • Contains test coverage for new functions.
  • Passes all golangci-lint checks.

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.

feature: qdrant.WithClient()

1 participant