[FR] Support using a similarity threshold in Firestore retriever
Is your feature request related to a problem? Please describe.
Firestore retriever does not support using a similarity threshold (instead of k) when retrieving documents.
Describe the solution you'd like
An optional threshold config that lets developers specify a threshold for the retrieved documents.
Describe alternatives you've considered Existing workaround:
- Manually implement a cutoff mechanism as a post-retrieval step.
Consider extending this support to other retrievers.
Additional context See Discord
I don't think Firestore generally supports threshold-based querying (see docs) which makes it difficult to add to the Firestore retriever.
/cc @MarkDuckworth for viz
@mbleigh Yes, this is not natively supported in Firestore. Which means that this should be handled in the retriever definition after Firestore returns the appropriate documents.
This is a feature we are considering implementing natively.
This is now natively supported in Firestore https://firebase.google.com/docs/firestore/vector-search#distance-threshold
Fixed in https://github.com/firebase/genkit/pull/2246