Types
zvec.typing
This module contains the basic data types of Zvec
Modules:
| Name | Description |
|---|---|
enum |
|
Classes:
| Name | Description |
|---|---|
DataType |
Enumeration of supported data types in Zvec. |
IndexType |
Enumeration of supported index types in Zvec. |
MetricType |
Enumeration of supported distance/similarity metrics. |
QuantizeType |
Enumeration of supported quantization types for vector compression. |
Status |
Represents the outcome of a Zvec operation. |
StatusCode |
Enumeration of possible status codes for Zvec operations. |
Classes
DataType
DataType(value: SupportsInt)
Enumeration of supported data types in Zvec.
Includes scalar types, dense/sparse vector types, and array types.
Examples:
>>> import zvec
>>> print(zvec.DataType.FLOAT)
DataType.FLOAT
>>> print(zvec.DataType.VECTOR_FP32)
DataType.VECTOR_FP32
Members:
STRING
BOOL
INT32
INT64
FLOAT
DOUBLE
UINT32
UINT64
VECTOR_FP16
VECTOR_FP32
VECTOR_FP64
VECTOR_INT8
SPARSE_VECTOR_FP32
SPARSE_VECTOR_FP16
ARRAY_STRING
ARRAY_INT32
ARRAY_INT64
ARRAY_FLOAT
ARRAY_DOUBLE
ARRAY_BOOL
ARRAY_UINT32
ARRAY_UINT64
IndexType
IndexType(value: SupportsInt)
Enumeration of supported index types in Zvec.
Examples:
>>> import zvec
>>> print(zvec.IndexType.HNSW)
IndexType.HNSW
Members:
UNDEFINED
HNSW
IVF
FLAT
INVERT
MetricType
MetricType(value: SupportsInt)
Enumeration of supported distance/similarity metrics.
- COSINE: Cosine similarity.
- IP: Inner product (dot product).
- L2: Euclidean distance (L2 norm).
Examples:
>>> import zvec
>>> print(zvec.MetricType.COSINE)
MetricType.COSINE
Members:
COSINE
IP
L2
QuantizeType
QuantizeType(value: SupportsInt)
Enumeration of supported quantization types for vector compression.
Examples:
>>> import zvec
>>> print(zvec.QuantizeType.INT8)
QuantizeType.INT8
Members:
UNDEFINED
FP16
INT8
INT4
Status
Represents the outcome of a Zvec operation.
A Status object is either OK (success) or carries an error code and message.
Examples:
>>> from zvec.typing import Status, StatusCode
>>> s = Status()
>>> print(s.ok())
True
>>> s = Status(StatusCode.INVALID_ARGUMENT, "Field not found")
>>> print(s.code() == StatusCode.INVALID_ARGUMENT)
True
>>> print(s.message())
Field not found
Methods:
| Name | Description |
|---|---|
OK |
Create an OK status. |
code |
StatusCode: Returns the status code. |
message |
str: Returns the error message (may be empty). |
ok |
bool: Returns True if the status is OK. |
Functions
message
message() -> str
str: Returns the error message (may be empty).
ok
ok() -> bool
bool: Returns True if the status is OK.
StatusCode
StatusCode(value: SupportsInt)
Enumeration of possible status codes for Zvec operations.
Used by the Status class to indicate success or failure reason.
Members:
OK
NOT_FOUND
ALREADY_EXISTS
INVALID_ARGUMENT
PERMISSION_DENIED
FAILED_PRECONDITION
RESOURCE_EXHAUSTED
UNAVAILABLE
INTERNAL_ERROR
NOT_SUPPORTED
UNKNOWN