Skip to content

Commit d73fcf4

Browse files
Merge pull request #3975 from manticoresoftware/test/add-knn-tests-for-auto-embeddings
test: add KNN tests for OpenAI and Voyage auto-embeddings
2 parents 8a3046a + c7f10a4 commit d73fcf4

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,24 @@ 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')\G"
127+
––– output –––
128+
*************************** 1. row ***************************
129+
id: %{NUMBER}
130+
knn_dist(): #!/[0-9]+\.[0-9]+/!#
131+
*************************** 2. row ***************************
132+
id: %{NUMBER}
133+
knn_dist(): #!/[0-9]+\.[0-9]+/!#
134+
––– comment –––
135+
Test KNN search with additional filtering
136+
––– input –––
137+
mysql -h0 -P9306 -e "SELECT COUNT(*) as count FROM test_openai_remote WHERE knn(embedding, 5, 'technology and AI') AND id > 0"
138+
––– output –––
139+
+-------+
140+
| count |
141+
+-------+
142+
| 2 |
143+
+-------+

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,24 @@ 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')\G"
127+
––– output –––
128+
*************************** 1. row ***************************
129+
id: %{NUMBER}
130+
knn_dist(): #!/[0-9]+\.[0-9]+/!#
131+
*************************** 2. row ***************************
132+
id: %{NUMBER}
133+
knn_dist(): #!/[0-9]+\.[0-9]+/!#
134+
––– comment –––
135+
Test KNN search with additional filtering
136+
––– input –––
137+
mysql -h0 -P9306 -e "SELECT COUNT(*) as count FROM test_voyage_remote WHERE knn(embedding, 5, 'technology and AI') AND id > 0"
138+
––– output –––
139+
+-------+
140+
| count |
141+
+-------+
142+
| 2 |
143+
+-------+

0 commit comments

Comments
 (0)