@@ -631,3 +631,41 @@ def resp(res: Response) -> bool:
631631 error_msg = "Property may not exist" ,
632632 status_codes = _ExpectedStatusCodes (ok_in = [200 ], error = "property exists" ),
633633 )
634+
635+ def delete_vector_index (
636+ self ,
637+ vector_name : str ,
638+ ) -> executor .Result [bool ]:
639+ """Delete a vector index from the collection in Weaviate.
640+
641+ This is a destructive operation. The index will
642+ need to be regenerated if you wish to use it again.
643+
644+ Args:
645+ vector_name: The name of the vector whose index to delete.
646+
647+ Raises:
648+ weaviate.exceptions.WeaviateConnectionError: If the network connection to Weaviate fails.
649+ weaviate.exceptions.UnexpectedStatusCodeError: If Weaviate reports a non-OK status.
650+ weaviate.exceptions.WeaviateInvalidInputError: If the vector does not exist.
651+ """
652+ _validate_input (
653+ [_ValidateArgument (expected = [str ], name = "vector_name" , value = vector_name )]
654+ )
655+
656+ path = (
657+ f"/schema/{ _capitalize_first_letter (self ._name )} "
658+ + f"/vectors/{ vector_name } "
659+ + "/index"
660+ )
661+
662+ def resp (res : Response ) -> bool :
663+ return res .status_code == 200
664+
665+ return executor .execute (
666+ response_callback = resp ,
667+ method = self ._connection .delete ,
668+ path = path ,
669+ error_msg = "Vector may not exist" ,
670+ status_codes = _ExpectedStatusCodes (ok_in = [200 ], error = "vector exists" ),
671+ )
0 commit comments