Skip to content

Commit

Permalink
community[patch]: FAISS: ValueError mentions normalize_score_fn isnte…
Browse files Browse the repository at this point in the history
…ad of relevance_score_fn (langchain-ai#25225)

Thank you for contributing to LangChain!

- [X] **PR title**: "community: fix valueerror mentions wrong argument
missing"
- Where "package" is whichever of langchain, community, core,
experimental, etc. is being modified. Use "docs: ..." for purely docs
changes, "templates: ..." for template changes, "infra: ..." for CI
changes.
  - Example: "community: add foobar LLM"


- [X] **PR message**: ***Delete this entire checklist*** and replace
with
- **Description:** when faiss.py has a None relevance_score_fn it raises
a ValueError that says a normalize_fn_score argument is needed.

Co-authored-by: ccurme <[email protected]>
  • Loading branch information
thiswillbeyourgithub and ccurme authored Aug 9, 2024
1 parent 4825dc0 commit a2b4c33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/community/langchain_community/vectorstores/faiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ def _similarity_search_with_relevance_scores(
relevance_score_fn = self._select_relevance_score_fn()
if relevance_score_fn is None:
raise ValueError(
"normalize_score_fn must be provided to"
"relevance_score_fn must be provided to"
" FAISS constructor to normalize scores"
)
docs_and_scores = self.similarity_search_with_score(
Expand Down Expand Up @@ -1317,7 +1317,7 @@ async def _asimilarity_search_with_relevance_scores(
relevance_score_fn = self._select_relevance_score_fn()
if relevance_score_fn is None:
raise ValueError(
"normalize_score_fn must be provided to"
"relevance_score_fn must be provided to"
" FAISS constructor to normalize scores"
)
docs_and_scores = await self.asimilarity_search_with_score(
Expand Down

0 comments on commit a2b4c33

Please sign in to comment.