Skip to content

Commit 5bd939d

Browse files
committed
test: add KNN tests for OpenAI and Voyage auto-embeddings
1 parent 81f1bca commit 5bd939d

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

test/clt-tests/mcl/auto-embeddings-openai-remote.rec

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,21 @@ Test API key environment variable handling
120120
if [ -n "$OPENAI_API_KEY" ] && [ "$OPENAI_API_KEY" != "dummy_key_for_testing" ]; then echo "API key is available for testing"; else echo "API key not available - using dummy for error testing"; fi
121121
––– output –––
122122
#!/(API key is available for testing|API key not available - using dummy for error testing)/!#
123+
––– comment –––
124+
Test KNN search with text query parameter (auto-embeddings approach)
125+
––– input –––
126+
mysql -h0 -P9306 -e "SELECT id, knn_dist() FROM test_openai_remote WHERE knn(embedding, 3, 'machine learning and artificial intelligence')"
127+
––– output –––
128+
#!/.*id.*knn_dist().*/!#
129+
#!/.*[12].*[0-9]+\.[0-9]+.*/!#
130+
#!/.*[12].*[0-9]+\.[0-9]+.*/!#
131+
––– comment –––
132+
Test KNN search with additional filtering
133+
––– input –––
134+
mysql -h0 -P9306 -e "SELECT COUNT(*) as count FROM test_openai_remote WHERE knn(embedding, 5, 'technology and AI') AND id > 0"
135+
––– output –––
136+
+-------+
137+
| count |
138+
+-------+
139+
| 2 |
140+
+-------+

test/clt-tests/mcl/auto-embeddings-voyage-remote.rec

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,21 @@ Test API key environment variable handling
120120
if [ -n "$VOYAGE_API_KEY" ] && [ "$VOYAGE_API_KEY" != "dummy_key_for_testing" ]; then echo "API key is available for testing"; else echo "API key not available - using dummy for error testing"; fi
121121
––– output –––
122122
#!/(API key is available for testing|API key not available - using dummy for error testing)/!#
123+
––– comment –––
124+
Test KNN search with text query parameter (auto-embeddings approach)
125+
––– input –––
126+
mysql -h0 -P9306 -e "SELECT id, knn_dist() FROM test_voyage_remote WHERE knn(embedding, 3, 'machine learning and artificial intelligence')"
127+
––– output –––
128+
#!/.*id.*knn_dist().*/!#
129+
#!/.*[12].*[0-9]+\.[0-9]+.*/!#
130+
#!/.*[12].*[0-9]+\.[0-9]+.*/!#
131+
––– comment –––
132+
Test KNN search with additional filtering
133+
––– input –––
134+
mysql -h0 -P9306 -e "SELECT COUNT(*) as count FROM test_voyage_remote WHERE knn(embedding, 5, 'technology and AI') AND id > 0"
135+
––– output –––
136+
+-------+
137+
| count |
138+
+-------+
139+
| 2 |
140+
+-------+

0 commit comments

Comments
 (0)