branch: externals/vecdb
commit 13f3184469f174ff4827df3b48589ad541eea081
Merge: 813c62fb14 6b0150ec80
Author: Andrew Hyatt <ahy...@gmail.com>
Commit: Andrew Hyatt <ahy...@gmail.com>

    Merge branch 'main' into psql
---
 .elpaignore               |  1 +
 .gitignore                |  5 ++++
 README.org                |  2 +-
 vecdb-integration-test.el | 66 +++++++++++++++++++++++------------------------
 4 files changed, 39 insertions(+), 35 deletions(-)

diff --git a/.elpaignore b/.elpaignore
new file mode 100644
index 0000000000..80299444c8
--- /dev/null
+++ b/.elpaignore
@@ -0,0 +1 @@
+*test.el
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..0c06f1b338
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.elc
+
+# ELPA-generated files
+/vecdb-autoloads.el
+/vecdb-pkg.el
diff --git a/README.org b/README.org
index a73f5ed6ce..b5e2768c59 100644
--- a/README.org
+++ b/README.org
@@ -46,7 +46,7 @@ an integer is the best choice.
 
 These can be deleted with ~vecdb-delete-item~ and retrieved by ID with 
~vecdb-get-item~.
 
-IDs used in =vecdb= *must* be =uint64= values.  If you have another ID you 
need to use to tie it together with other storage, that should go into the 
=payload=.
+IDs used in =vecdb= *must* be =uint64= values.  If you have another ID you 
need to use to tie it together with other storage, that should go into the 
=payload=.  Also, each item passed in must set the same payload fields.
 * Querying data
 Querying the database can be done with ~vecdb-search-by-vector~, passing it a 
vector and optionally a number of results to return (10 is the default).
 
diff --git a/vecdb-integration-test.el b/vecdb-integration-test.el
index 755e0702e1..ed5829a740 100644
--- a/vecdb-integration-test.el
+++ b/vecdb-integration-test.el
@@ -56,32 +56,30 @@
   "Initialize and return a list of available `vecdb-provider' structs.
 Reads configuration from environment variables.
 Skips tests if no providers are configured."
-  (let ((providers (list)))
-    ;; ChromaDB Configuration
-    (let ((chroma-url (getenv "CHROMA_URL")))
-      (when chroma-url
-        (add-to-list 'providers
-                     (make-vecdb-chroma-provider
-                      :url chroma-url
-                      :tenant (or (getenv "CHROMA_TENANT") "default")
-                      :database (or (getenv "CHROMA_DATABASE") "default"))
-                     t)))
-
-    ;; Qdrant Configuration
-    (let ((qdrant-url (getenv "QDRANT_URL")))
-      (when qdrant-url
-        (let ((qdrant-api-key (getenv "QDRANT_API_KEY")))
-          (if qdrant-api-key
-              (add-to-list 'providers
-                           (make-vecdb-qdrant-provider
-                            :url qdrant-url
-                            :api-key qdrant-api-key)
-                           t)
-            (warn "QDRANT_URL is set, but QDRANT_API_KEY is missing. Qdrant 
provider will not be configured.")))))
-
-    (when (null providers)
-      (ert-skip "No vector database provider environment variables set. 
(CHROMA_URL or QDRANT_URL must be set)"))
-    providers))
+  (or
+   (delq nil
+         (list
+          ;; ChromaDB Configuration
+          (let ((chroma-url (getenv "CHROMA_URL")))
+            (when chroma-url
+              (make-vecdb-chroma-provider
+               :url chroma-url
+               :tenant (or (getenv "CHROMA_TENANT") "default")
+               :database (or (getenv "CHROMA_DATABASE") "default"))))
+
+          ;; Qdrant Configuration
+          (let ((qdrant-url (getenv "QDRANT_URL")))
+            (when qdrant-url
+              (let ((qdrant-api-key (getenv "QDRANT_API_KEY")))
+                (if qdrant-api-key
+                    (make-vecdb-qdrant-provider
+                     :url qdrant-url
+                     :api-key qdrant-api-key)
+                  (warn "QDRANT_URL is set, but QDRANT_API_KEY is missing. 
Qdrant provider will not be configured.")))))))
+
+   (progn
+     (ert-skip "No vector database provider environment variables set. 
(CHROMA_URL or QDRANT_URL must be set)")
+     nil)))
 
 (defmacro vecdb-test--deftest-for-providers (base-name body-function &optional 
docstring)
   "Define `ert-deftest` forms for BASE-NAME against Chroma and Qdrant 
providers.
@@ -119,7 +117,7 @@ itself might globally skip if no providers at all are 
configured)."
 CURRENT-PROVIDER is the provider instance.
 COLLECTION-VAR is the symbol to bind the collection struct to.
 COLLECTION-NAME-BASE is the base string for the collection name.
-OPTIONS is a plist, e.g., '(:vector-size 3).
+OPTIONS is a plist, e.g., (:vector-size 3).
 The full collection name is generated by appending the provider's name.
 The collection is created before BODY and deleted afterwards."
   (declare (indent 1) (debug t))
@@ -156,8 +154,8 @@ The collection is created before BODY and deleted 
afterwards."
         (vecdb-delete current-provider collection)))))
 
 (vecdb-test--deftest-for-providers vecdb-test-create-exists-delete-collection
-  #'vecdb-test-create-exists-delete-collection-body
-  "Test `vecdb-create', `vecdb-exists', and `vecdb-delete'.")
+                                   
#'vecdb-test-create-exists-delete-collection-body
+                                   "Test `vecdb-create', `vecdb-exists', and 
`vecdb-delete'.")
 
 (defun vecdb-test-upsert-get-delete-items-body (current-provider)
   "Core logic for testing upsert and get items."
@@ -181,8 +179,8 @@ The collection is created before BODY and deleted 
afterwards."
                             (should-not (vecdb-get-item current-provider 
current-collection (vecdb-item-id item)))))))
 
 (vecdb-test--deftest-for-providers vecdb-test-upsert-get-delete-items
-  #'vecdb-test-upsert-get-delete-items-body
-  "Test `vecdb-upsert-items', `vecdb-get-item' and `vecdb-delete-items'.")
+                                   #'vecdb-test-upsert-get-delete-items-body
+                                   "Test `vecdb-upsert-items', 
`vecdb-get-item' and `vecdb-delete-items'.")
 
 (defun vecdb-test-search-by-vector-body (current-provider)
   "Core logic for testing search by vector."
@@ -208,9 +206,9 @@ The collection is created before BODY and deleted 
afterwards."
                                               items))))))
 
 (vecdb-test--deftest-for-providers
-  vecdb-test-search-by-vector
-  #'vecdb-test-search-by-vector-body
-  "Test `vecdb-search-by-vector'.")
+ vecdb-test-search-by-vector
+ #'vecdb-test-search-by-vector-body
+ "Test `vecdb-search-by-vector'.")
 
 (provide 'vecdb-integration-test)
 

Reply via email to