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: pgvector search_type of similarity_score_threshold not working #7771

Conversation

wwwbbb8510
Copy link
Contributor

  • Description: VectorStoreRetriever->similarity_score_threshold with search_type of "similarity_score_threshold" not working with the following two minor issues,
  • Issue: 1. In line 237 of vectorstores/base.py, "score_threshold" is passed to _similarity_search_with_relevance_scores as in the kwargs, while score_threshold is not a valid argument of this method. As a fix, before calling _similarity_search_with_relevance_scores, score_threshold is popped from kwargs. 2. In line 596 to 607 of vectorstores/pgvector.py, it's checking the distance_strategy against the string in Enum. However, self.distance_strategy will get the property of distance_strategy from line 316, where the callable function is passed. To solve this issue, self.distance_strategy is changed to self._distance_strategy to avoid calling the property method.,
  • Dependencies: No,
  • Tag maintainer: @rlancemartin, @eyurtsev,
  • Twitter handle: No

…e of "similarity_score_threshold" not working with the following two issues:

1. In line 237 of `vectorstores/base.py`, "score_threshold" is passed to `_similarity_search_with_relevance_scores` as in the kwargs, while score_threshold is not a valid argument of this method. As a fix, before calling `_similarity_search_with_relevance_scores`, score_threshold is popped from kwargs.
2. In line 596 to 607 of `vectorstores/pgvector.py`, it's checking the distance_strategy against the string in Enum. However, self.distance_strategy will get the property of distance_strategy from line 316, where the callable function is passed. To solve this issue, self.distance_strategy is changed to self._distance_strategy to avoid calling the property method.
@vercel
Copy link

vercel bot commented Jul 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Jul 16, 2023 8:47am

@dosubot dosubot bot added Ɑ: vector store Related to vector store module 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Jul 16, 2023
@wwwbbb8510
Copy link
Contributor Author

Hi @rlancemartin and @eyurtsev
As all checks have passed, what will be the estimated time frame for the pull request to be merged. I really need this in our application on prod. If this can't be merged soon, we will need to find alternative approach to use it on prod.
Looking forward to your reply.
Thanks

@baskaryan
Copy link
Collaborator

thanks @wwwbbb8510!

@baskaryan baskaryan merged commit b65102b into langchain-ai:master Jul 19, 2023
@wwwbbb8510 wwwbbb8510 deleted the fix/bug-pgvector-search-type-similarity-score-threshold branch July 22, 2023 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: vector store Related to vector store module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants