firebase / genkit

An open source framework for building AI-powered apps with familiar code-centric patterns. Genkit makes it easy to integrate, test, and deploy sophisticated AI features to Firebase or Google Cloud.
Apache License 2.0
595 stars 73 forks source link

[FR] Support using a similarity threshold in Firestore retriever #653

Open ssbushi opened 1 month ago

ssbushi commented 1 month ago

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:

Consider extending this support to other retrievers.

Additional context See Discord

mbleigh commented 1 month ago

I don't think Firestore generally supports threshold-based querying (see docs) which makes it difficult to add to the Firestore retriever.

peterfriese commented 1 month ago

/cc @MarkDuckworth for viz

ssbushi commented 1 month ago

@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.

MarkDuckworth commented 1 month ago

This is a feature we are considering implementing natively.