ankane / neighbor

Nearest neighbor search for Rails
MIT License
590 stars 14 forks source link

Accuracy #17

Closed danielfriis closed 7 months ago

danielfriis commented 7 months ago

This might not be the right place to ask this question, in which case, feel free to close the issue!

I'm using neighbor to build a RAG system using a vector db (pgvector).

I have a bunch of very different documents where I need to find an answer, but I struggle to retrieve the correct chunk.

Are there any best practices for making the results better?

ankane commented 7 months ago

Hi @danielfriis, the nearest neighbor search should have 100% accuracy if there's not an approximate index. I'd double check the query is correct (if you have a default_scope on the model, it'll take precedence until 0.4.0) as well as the distance function (you'll typically want to use cosine). For general best practices for RAG, it'd be better to use other resources.

Edit: You may also want to try different embedding models and chunking strategies to see if it makes a difference.

danielfriis commented 6 months ago

@ankane thanks a lot. That makes 100p sense!