endee 0.1.7__py3-none-any.whl → 0.1.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- endee/index.py +47 -4
- {endee-0.1.7.dist-info → endee-0.1.8.dist-info}/METADATA +19 -1
- {endee-0.1.7.dist-info → endee-0.1.8.dist-info}/RECORD +6 -6
- {endee-0.1.7.dist-info → endee-0.1.8.dist-info}/WHEEL +0 -0
- {endee-0.1.7.dist-info → endee-0.1.8.dist-info}/licenses/LICENSE +0 -0
- {endee-0.1.7.dist-info → endee-0.1.8.dist-info}/top_level.txt +0 -0
endee/index.py
CHANGED
|
@@ -294,10 +294,24 @@ class Index:
|
|
|
294
294
|
f"Cannot insert more than {MAX_VECTORS_PER_BATCH} vectors at a time"
|
|
295
295
|
)
|
|
296
296
|
|
|
297
|
-
# Validate IDs upfront
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
# Validate IDs upfront and check for duplicates
|
|
298
|
+
seen_ids = set()
|
|
299
|
+
duplicate_ids = set()
|
|
300
|
+
|
|
301
|
+
for item in input_array:
|
|
302
|
+
id_val = item.get("id", "")
|
|
303
|
+
if not id_val or id_val is None:
|
|
304
|
+
raise ValueError("All vectors must have a non-empty ID")
|
|
305
|
+
|
|
306
|
+
if id_val in seen_ids:
|
|
307
|
+
duplicate_ids.add(id_val)
|
|
308
|
+
else:
|
|
309
|
+
seen_ids.add(id_val)
|
|
310
|
+
|
|
311
|
+
if duplicate_ids:
|
|
312
|
+
raise ValueError(
|
|
313
|
+
f"Duplicate IDs found in input array: {sorted(duplicate_ids)}"
|
|
314
|
+
)
|
|
301
315
|
|
|
302
316
|
is_hybrid = self.is_hybrid
|
|
303
317
|
|
|
@@ -584,6 +598,35 @@ class Index:
|
|
|
584
598
|
|
|
585
599
|
return response.text + " rows deleted"
|
|
586
600
|
|
|
601
|
+
def delete_with_filter(self, filter):
|
|
602
|
+
"""
|
|
603
|
+
Delete multiple vectors based on a filter.
|
|
604
|
+
|
|
605
|
+
Deletes all vectors that match the provided filter criteria.
|
|
606
|
+
|
|
607
|
+
Args:
|
|
608
|
+
filter: Dictionary containing filter criteria
|
|
609
|
+
|
|
610
|
+
Returns:
|
|
611
|
+
str: Server response with deletion details
|
|
612
|
+
|
|
613
|
+
Raises:
|
|
614
|
+
HTTPError: If deletion fails
|
|
615
|
+
"""
|
|
616
|
+
headers = {"Authorization": f"{self.token}", "Content-Type": "application/json"}
|
|
617
|
+
|
|
618
|
+
data = {"filter": filter}
|
|
619
|
+
|
|
620
|
+
url = f"{self.url}/index/{self.name}/vectors/delete"
|
|
621
|
+
|
|
622
|
+
http_client = self._get_session_client()
|
|
623
|
+
response = http_client.delete(url, headers=headers, json=data)
|
|
624
|
+
|
|
625
|
+
if response.status_code != 200:
|
|
626
|
+
raise_exception(response.status_code, response.text)
|
|
627
|
+
|
|
628
|
+
return response.text
|
|
629
|
+
|
|
587
630
|
def get_vector(self, id):
|
|
588
631
|
"""
|
|
589
632
|
Retrieve a single vector by ID.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: endee
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Summary: Endee is the Next-Generation Vector Database for Scalable, High-Performance AI
|
|
5
5
|
Home-page: https://endee.io
|
|
6
6
|
Author: Endee Labs
|
|
@@ -602,6 +602,23 @@ index = client.get_index(name="your-index-name")
|
|
|
602
602
|
index.delete_vector("vec1")
|
|
603
603
|
```
|
|
604
604
|
|
|
605
|
+
### Filtered Deletion
|
|
606
|
+
|
|
607
|
+
In cases where you don't know the exact vector `id`, but want to delete vectors based on filter fields, you can use filtered deletion. This is especially useful for:
|
|
608
|
+
|
|
609
|
+
- Bulk deleting vectors by tag, type, or timestamp
|
|
610
|
+
- Enforcing access control or data expiration policies
|
|
611
|
+
|
|
612
|
+
```python
|
|
613
|
+
from endee import Endee
|
|
614
|
+
|
|
615
|
+
client = Endee(token="your-token-here")
|
|
616
|
+
index = client.get_index(name="your-index-name")
|
|
617
|
+
|
|
618
|
+
# Delete all vectors matching filter conditions
|
|
619
|
+
index.delete_with_filter([{"tags": {"$eq": "important"}}])
|
|
620
|
+
```
|
|
621
|
+
|
|
605
622
|
### Index Deletion
|
|
606
623
|
|
|
607
624
|
Index deletion permanently removes the entire index and all vectors associated with it. This should be used when:
|
|
@@ -669,6 +686,7 @@ info = index.describe()
|
|
|
669
686
|
| `upsert(input_array)` | Insert or update vectors (max 1000 per batch) |
|
|
670
687
|
| `query(vector, top_k, filter, ef, include_vectors, sparse_indices, sparse_values)` | Search for similar vectors (sparse params optional for hybrid) |
|
|
671
688
|
| `delete_vector(id)` | Delete a vector by ID |
|
|
689
|
+
| `delete_with_filter(filter)` | Delete vectors matching a filter |
|
|
672
690
|
| `get_vector(id)` | Get a specific vector by ID |
|
|
673
691
|
| `describe()` | Get index statistics and configuration |
|
|
674
692
|
|
|
@@ -3,10 +3,10 @@ endee/compression.py,sha256=LiQiHiUslFe-jdJxGUIB-kFil99aRGo-_KFebA5mnt4,1219
|
|
|
3
3
|
endee/constants.py,sha256=wTKW99Uzg-sKlMx3HgSJcnHasl-KzKMJoe1JsvXjkuY,4316
|
|
4
4
|
endee/endee.py,sha256=vNq7lWmZUK3dzr4OAKLYyjpkQ-rLcEwwh8p-fozghJ8,20723
|
|
5
5
|
endee/exceptions.py,sha256=RTBm6dZ42tw6-PoodEC1W46DLjCmhHxlPj4EtYh-Su4,7499
|
|
6
|
-
endee/index.py,sha256=
|
|
6
|
+
endee/index.py,sha256=BHE1KmB0saXlhjYVtbeG0tJ-u1oDVPF--Ir6B-cCw68,24105
|
|
7
7
|
endee/utils.py,sha256=CFdr0Qsxo77y00cvtCiuuYHqImOkwtaUIaIqPX2BsyQ,1258
|
|
8
|
-
endee-0.1.
|
|
9
|
-
endee-0.1.
|
|
10
|
-
endee-0.1.
|
|
11
|
-
endee-0.1.
|
|
12
|
-
endee-0.1.
|
|
8
|
+
endee-0.1.8.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
endee-0.1.8.dist-info/METADATA,sha256=V44CzRW-AL38uay2qzP0ukN8RxAILkCGiZbP2HJQ_rI,24304
|
|
10
|
+
endee-0.1.8.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
11
|
+
endee-0.1.8.dist-info/top_level.txt,sha256=zOEvXIfzdm7vXJaVX_jq5OX3fTftKq14KzynxlAp8ZQ,6
|
|
12
|
+
endee-0.1.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|