Step - nearest

nearest ยท category: Vectors

Exact top-k: the k inputs whose vector property is closest to q, best first; a text q is embedded by the model the schema declares for the property.

Forms

nearest(arg1: any, arg2: any, arg3: i64)
nearest(arg1: any, arg2: any, arg3: i64, arg4: map)

Example

g.inject(#{n: 1, emb: vector([1.0, 0.0])}, #{n: 2, emb: vector([0.0, 1.0])}).nearest("emb", vector([0.0, 1.0]), 1).select("n").next()   // 2