mindsdb_sql
mindsdb_sql copied to clipboard
Support of embedding related operators in postgres
Example:
SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5;
SELECT (embedding <#> '[3,1,2]') * -1 AS inner_product FROM items;
SELECT 1 - (embedding <=> '[3,1,2]') AS cosine_similarity FROM items;
Currently if we write these queries directly, the parser will try to parse it as AST tree, which causes an error since <->
, <#>
, <=>
are not supported operators.
Might need to add those column in the lexer, and modify renderer.