Skip to content

Conversation

@mssalvatore
Copy link
Contributor

Description

The type hint for FAISS.__init__()'s relevance_score_fn parameter allowed the parameter to be set to None. However, a default function is provided by the constructor. This led to an unnecessary check in the code, as well as a test to verify this check.

ASSUMPTION: There's no reason to ever set relevance_score_fn to None.

This PR changes the type hint and removes the unnecessary code.

Tag Maintainer

@rlancemartin @eyurtsev

Previously, if the `relevance_score_fn` parameter passed to to
`FAISS.__init__()` was `None`, a `ValueError` would be raised during
search. Since a default value is provided for this parameter in the
constructor, there's not reason to ever set the function to `None`.
@vercel
Copy link

vercel bot commented Jul 3, 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 3, 2023 3:21pm

@baskaryan
Copy link
Collaborator

thanks @mssalvatore!

@baskaryan baskaryan merged commit d0c7f7c into langchain-ai:master Jul 3, 2023
@mssalvatore mssalvatore deleted the faiss-default-relevance-score-fn branch July 3, 2023 16:25
vowelparrot pushed a commit that referenced this pull request Jul 4, 2023
## Description

The type hint for `FAISS.__init__()`'s `relevance_score_fn` parameter
allowed the parameter to be set to `None`. However, a default function
is provided by the constructor. This led to an unnecessary check in the
code, as well as a test to verify this check.

**ASSUMPTION**: There's no reason to ever set `relevance_score_fn` to
`None`.

This PR changes the type hint and removes the unnecessary code.
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.

2 participants