endee 0.1.7__tar.gz → 0.1.8__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: endee
3
- Version: 0.1.7
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
 
@@ -558,6 +558,23 @@ index = client.get_index(name="your-index-name")
558
558
  index.delete_vector("vec1")
559
559
  ```
560
560
 
561
+ ### Filtered Deletion
562
+
563
+ 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:
564
+
565
+ - Bulk deleting vectors by tag, type, or timestamp
566
+ - Enforcing access control or data expiration policies
567
+
568
+ ```python
569
+ from endee import Endee
570
+
571
+ client = Endee(token="your-token-here")
572
+ index = client.get_index(name="your-index-name")
573
+
574
+ # Delete all vectors matching filter conditions
575
+ index.delete_with_filter([{"tags": {"$eq": "important"}}])
576
+ ```
577
+
561
578
  ### Index Deletion
562
579
 
563
580
  Index deletion permanently removes the entire index and all vectors associated with it. This should be used when:
@@ -625,6 +642,7 @@ info = index.describe()
625
642
  | `upsert(input_array)` | Insert or update vectors (max 1000 per batch) |
626
643
  | `query(vector, top_k, filter, ef, include_vectors, sparse_indices, sparse_values)` | Search for similar vectors (sparse params optional for hybrid) |
627
644
  | `delete_vector(id)` | Delete a vector by ID |
645
+ | `delete_with_filter(filter)` | Delete vectors matching a filter |
628
646
  | `get_vector(id)` | Get a specific vector by ID |
629
647
  | `describe()` | Get index statistics and configuration |
630
648
 
@@ -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
- ids = [item.get("id", "") for item in input_array]
299
- if any(not id_val or id_val is None for id_val in ids):
300
- raise ValueError("All vectors must have a non-empty ID")
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.7
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
 
@@ -15,7 +15,7 @@ with open("README.md", encoding="utf-8") as f:
15
15
  setup(
16
16
  # Package Metadata
17
17
  name="endee",
18
- version="0.1.7",
18
+ version="0.1.8",
19
19
  author="Endee Labs",
20
20
  author_email="dev@endee.io",
21
21
  description=(
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes