2 ms·
I wrote up a little tutorial on how to do the last two with elasticsearch and my kotlin kt-search library here a while ago: https://jillesvangurp.github.io/kt-
by jillesvangurp 3y ago
I wrote up a little tutorial on how to do the last two with elasticsearch and my kotlin kt-search library here a while ago:
https://jillesvangurp.github.io/kt-search/manual/KnnSearch.html https://jillesvangurp.github.io/kt-search/manual/KnnSearch.h...
You index into an index with a dense vector field
And when you query, you generate embeddings for your query and run a knn vector similarity search.
It uses some embeddings I generated with openai. You could use something like easybert or one of the many OSS embeddings models instead. Basically you need some code that converts your text/images/whatever into lists of numbers using such a model.
So:
1) use some magical tool that given a thing returns embeddings. You use this to extract embeddings at index time from your content and at query time for your queries.
2) put your embeddings along with your things in an Elasticsearch index (or vector db of your choice, Opensearch works similar to Elasticsearch for this)
3) when querying, create embeddings for your queries and find the nearest match.
I built this tutorial as a quick POC to figure out how easy it is with my own library. I'm not an expert. Mission accomplished and it only took me a few hours. The results are not impressive as this model is probably not very appropriate for the demo content. But it vaguely works. There are a bunch of people that are smarter than me that suggest that most oss models struggle to outperform bm25, which is just doing simple text searches.
Btw. the embeddings are the hard part. The rest is just plumbing. And of course world + dog just glosses over that. There's an interesting article that I came across recently that goes a bit more in depth on this: https://blog.metarank.ai/from-zero-to-semantic-search-embedding-model-592e16d94b61 https://blog.metarank.ai/from-zero-to-semantic-search-embedd...