3 ms·
More information on how txtai builds SQL statements can be found here: https://neuml.github.io/txtai/embeddings/query/#sql https://neuml.github.io/txtai/embeddi
by neumll 5y ago
More 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>".