aboutsummaryrefslogtreecommitdiff
path: root/R2R/r2r/vecs/exc.py
diff options
context:
space:
mode:
Diffstat (limited to 'R2R/r2r/vecs/exc.py')
-rwxr-xr-xR2R/r2r/vecs/exc.py83
1 files changed, 83 insertions, 0 deletions
diff --git a/R2R/r2r/vecs/exc.py b/R2R/r2r/vecs/exc.py
new file mode 100755
index 00000000..0ae4500c
--- /dev/null
+++ b/R2R/r2r/vecs/exc.py
@@ -0,0 +1,83 @@
+__all__ = [
+ "VecsException",
+ "CollectionAlreadyExists",
+ "CollectionNotFound",
+ "ArgError",
+ "FilterError",
+ "IndexNotFound",
+ "Unreachable",
+]
+
+
+class VecsException(Exception):
+ """
+ Base exception class for the 'vecs' package.
+ All custom exceptions in the 'vecs' package should derive from this class.
+ """
+
+ ...
+
+
+class CollectionAlreadyExists(VecsException):
+ """
+ Exception raised when attempting to create a collection that already exists.
+ """
+
+ ...
+
+
+class CollectionNotFound(VecsException):
+ """
+ Exception raised when attempting to access or manipulate a collection that does not exist.
+ """
+
+ ...
+
+
+class ArgError(VecsException):
+ """
+ Exception raised for invalid arguments when calling a method.
+ """
+
+ ...
+
+
+class MismatchedDimension(ArgError):
+ """
+ Exception raised when multiple sources of truth for a collection's embedding dimension do not match.
+ """
+
+ ...
+
+
+class FilterError(VecsException):
+ """
+ Exception raised when there's an error related to filter usage in a query.
+ """
+
+ ...
+
+
+class IndexNotFound(VecsException):
+ """
+ Exception raised when attempting to access an index that does not exist.
+ """
+
+ ...
+
+
+class Unreachable(VecsException):
+ """
+ Exception raised when an unreachable part of the code is executed.
+ This is typically used for error handling in cases that should be logically impossible.
+ """
+
+ ...
+
+
+class MissingDependency(VecsException, ImportError):
+ """
+ Exception raised when attempting to access a feature that requires an optional dependency when the optional dependency is not present.
+ """
+
+ ...