Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vectorstores:weaviate|pinecone): do not return error when zero documents are retrieved #1077

Merged
merged 5 commits into from
Jan 7, 2025

Conversation

mdelapenya
Copy link
Contributor

@mdelapenya mdelapenya commented Nov 28, 2024

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.

What is this PR doing?

It reverse the logic in Weaviate and Pinecone stores to not return an error if zero docs are retrieved from a SimilaritySearch.

Closes #1065

@FluffyKebab
Copy link
Collaborator

FluffyKebab commented Jan 4, 2025

@mdelapenya it looks like pinecone also returns error when no documents are found:

if len(queryResult.Matches) == 0 {

Can you also change the implementation there before we merge?

@mdelapenya
Copy link
Contributor Author

Sure thing, will add a commit with that ASAP

Thanks for your work here

* main:
  Comment should end in a period
  handle callbacks
  comment public symbols
  gofmt
  review changes
  add doc.go
  api key as option
  fix lint
  fix data race for accessToken
  add fail test case to r/w accessToken from some goroutines
  chains_test: use mutex to lock
  openaiclient: fix data race at createChat
  ci: add -race flat go test in CI
  Implement perplexity agent tool
@mdelapenya mdelapenya changed the title fix(vectorstores:weaviate): do not return error when zero documents are retrieved fix(vectorstores:weaviate|pinecone): do not return error when zero documents are retrieved Jan 7, 2025
@mdelapenya
Copy link
Contributor Author

@FluffyKebab I added the changes to pinecone too. PLMK if you need anything else 🙏

Cheers!

@@ -22,6 +22,7 @@ var (
ErrEmbedderWrongNumberVectors = errors.New(
"number of vectors from embedder does not match number of documents",
)
// Deprecated: ErrEmptyResponse is not used anymore and will be removed in the future.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not removing this field although it's not used anymore, but as public API, I thought the deprecation path is the way to go.

In any case, PLMK if I should proceed in any other way

@FluffyKebab FluffyKebab merged commit bc77e45 into tmc:main Jan 7, 2025
3 checks passed
@mdelapenya mdelapenya deleted the weaviate-return-no-errors branch January 7, 2025 09:21
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.

[weaviate store] Similarity search returns an error if there are no docs in the response
2 participants