3 ms·
While it presents txtai as a very neat framework for calculating and searching for embeddings the article doesn’t seem to mention anything about a database serv
by wodenokoto 5y ago
While it presents txtai as a very neat framework for calculating and searching for embeddings the article doesn’t seem to mention anything about a database server, except for the drawing at top.
The code looks like it is doing an in-memory search.
When searching an embedding space, it is quite common to look for the closest angle of the query vector against amongst the search vectors.
That is a calculation I don’t know how to make a sql server perform and given the headline I thought the article would show a neat trick for doing this.
- neumll 5y agoMore information on how txtai builds SQL statements can be found here: https://neuml.github.io/txtai/embeddings/query/#sql https://neuml.github.io/txtai/embeddings/query/#sql There is also an example notebook: https://colab.research.google.com/github/neuml/txtai/blob/master/examples/24_Whats_new_in_txtai_4_0.ipynb https://colab.research.google.com/github/neuml/txtai/blob/ma... At a high level, txtai uses a similar clause embedded in SQL statements. For example, "SELECT id, text, score FROM txtai WHERE similar('feel good story') AND text LIKE '%good%'". This statement is parsed and the similar clause runs against the approximate nearest neighbor index. The result ids are then loaded into a temporary table and the SQL statement is dynamically rewritten to change the similar clause into "id IN <temporary table>".