Repository navigation
Conversation
This branch has not been deployed
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.
Adds a
WithHTTPClient(*http.Client)option tovectorstores/qdrant, so callers can use their own HTTP client (timeouts, proxies, custom TLS, tracing transports). Today every request goes throughhttputil.DefaultClient, and there is no way to change it.Changes
Storehas a newhttpClientfield.Newsets it tohttputil.DefaultClientwhen the option is not used (or is passednil), so existing behavior is unchanged.AddDocumentsandSimilaritySearchsend their requests through the store's client.DoRequestkeeps its signature and behavior (it still useshttputil.DefaultClient). It now delegates to an unexporteddoRequestthat takes the client.This follows the existing
WithHTTPClientoptions invectorstores/weaviateandvectorstores/azureaisearch.Relation to #1249
#1249 asks for passing a
*qdrant.Clientfromgithub.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: newWithHTTPClientsubtest.TestNew_HTTPClient: the default client, and the fallback whennilis passed.TestWithHTTPClient_IsUsed: anhttptestserver and a counting transport; checks that both the upsert and the search request go through the custom client. I confirmed this test fails ifdoRequestgoes back tohttputil.DefaultClient.go vet,go testandgo test -raceon./vectorstores/qdrant/pass;golangci-lintv2.9.0 reports 0 issues.Updates #1249
PR Checklist
memory: add interfaces for X, Yorutil: add whizzbang helpers).Fixes #123).golangci-lintchecks.