kuzu
kuzu copied to clipboard
Binder exception: Cannot retrieve child type of type ANY. LIST or ARRAY is expected.
Hi team. I'm trying to use Kuzu for semantic search using array_cosine_similarity
and can't get it working. This looks like a bug to me.
Here is the minimal repro:
import kuzu
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('sentence-transformers/all-MiniLM-L12-v2')
embedded = model.encode(["test"])[0].tolist() # list of 384 float numbers
db = kuzu.Database("./demo_db")
conn = kuzu.Connection(db)
conn.execute("CREATE NODE TABLE MyNode(id STRING, embedding DOUBLE[384], PRIMARY KEY(id))")
conn.execute("CREATE (d:MyNode {id: 'test', embedding: $emb})", {"emb": embedded})
response = conn.execute(
"""
MATCH (d:MyNode)
RETURN d.id, array_cosine_similarity(d.embedding, $emb)
""", {"emb": embedded}
)
# Here I get exception
# RuntimeError: Binder exception: Cannot retrieve child type of type ANY. LIST or ARRAY is expected.
Kuzu 0.4.2 Python 3.11.9