googleapis / googleapis/google-cloud-node
Add similarity threshold to (.findNearest) queries in addition to returning similarity scores.
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
**Is your feature request related to a problem? Please describe.**
I'm trying to be able to add a thresold to my similarity search with vectors but it doesn't semm to be mentioned here anywhere?
https://firebase.google.com/docs/firestore/vector-search#node.js_2
**Describe the solution you'd like**
Adding a field called similarityThreshold to the vector search query would be perfect:
```js
const searchRes = await dbToUse.collection(`voiceglow/${agentData.ID}/kb_chunks`).findNearest("vector",
FieldValue.vector(searchVector), {
limit: 5,
distanceMeasure: 'COSINE',
similarityThresohold: 0.2 // add this (currently doesn't work)
}).get();
```
Also adding to the queryies of such types (.findNearest) the similarity score with the search vector is highly beneficial for debugging purposes, we're currenlty using pgvector on postgres but would love to migrate everything on firestore but these may be annoying to deal with.
**Describe alternatives you've considered**
There is nothing mentioned in the docs, I hope it's already implemented but not docuemented/typed properly?
Contributor guide
Assessment
This issue has not been assessed yet.