@@ -24,28 +24,28 @@ gainsboro | 0.908
2424gray | 0.908
2525;
2626
27- # TODO Need to implement a conversion function to convert a non-foldable row to a dense_vector
28- similarityWithRow-Ignore
29- required_capability: cosine_vector_similarity_function
27+ similarityAsPartOfExpression
28+ required_capability: cosine_vector_similarity_function
3029
31- row vector = [1, 2, 3]
32- | eval similarity = round(v_cosine(vector, [0, 1, 2]), 3)
33- | sort similarity desc, color asc
34- | limit 10
35- | keep color, similarity
36- ;
30+ from colors
31+ | where color != "black"
32+ | eval score = round((1 + v_cosine(rgb_vector, [0, 255, 255]) / 2), 3)
33+ | sort score desc, color asc
34+ | limit 10
35+ | keep color, score
36+ ;
3737
38- color:text | similarity :double
39- cyan | 1.0
40- teal | 1.0
41- turquoise | 0.989
42- aqua marine | 0.965
43- azure | 0.916
44- lavender | 0.914
45- honeydew | 0.912
46- mint cream | 0.912
47- gainsboro | 0.908
48- gray | 0.908
38+ color:text | score :double
39+ cyan | 1.5
40+ teal | 1.5
41+ turquoise | 1.495
42+ aqua marine | 1.482
43+ azure | 1.458
44+ lavender | 1.457
45+ honeydew | 1.456
46+ mint cream | 1.456
47+ gainsboro | 1.454
48+ gray | 1.454
4949;
5050
5151similarityWithLiteralVectors
@@ -56,6 +56,34 @@ row a = 1
5656| keep similarity
5757;
5858
59+ similarity:double
60+ 0.978
61+ ;
62+
63+ similarityWithStats
64+ required_capability: cosine_vector_similarity_function
65+
66+ from colors
67+ | where color != "black"
68+ | eval similarity = round(v_cosine(rgb_vector, [0, 255, 255]), 3)
69+ | stats avg = round(avg(similarity), 3), min = min(similarity), max = max(similarity)
70+ ;
71+
72+ avg:double | min:double | max:double
73+ 0.832 | 0.5 | 1.0
74+ ;
75+
76+ # TODO Need to implement a conversion function to convert a non-foldable row to a dense_vector
77+ similarityWithRow-Ignore
78+ required_capability: cosine_vector_similarity_function
79+
80+ row vector = [1, 2, 3]
81+ | eval similarity = round(v_cosine(vector, [0, 1, 2]), 3)
82+ | sort similarity desc, color asc
83+ | limit 10
84+ | keep color, similarity
85+ ;
86+
5987similarity:double
60880.978
6189;
0 commit comments