Classes
List
Internal Instances of theList class are used to represent lists of values in TopK.
Usually created using data constructors such as f32_list(), i32_list(), etc.
SparseVector
Internal Instances of theSparseVector class are used to represent sparse vectors in TopK.
Usually created using data constructors such as f32_sparse_vector() or u8_sparse_vector().
Matrix
Internal Instances of theMatrix class are used to represent matrices in TopK.
Usually created using data constructors such as matrix().
Struct
Internal Instances of theStruct class are used to represent nested object values in TopK.
Usually created using the struct() helper.
Functions
f8_vector()
| Parameter | Type |
|---|---|
data | list[float] |
List
f16_vector()
| Parameter | Type |
|---|---|
data | list[float] |
List
f32_vector()
| Parameter | Type |
|---|---|
data | list[float] |
List
u8_vector()
| Parameter | Type |
|---|---|
data | list[int] |
List
i8_vector()
| Parameter | Type |
|---|---|
data | list[int] |
List
binary_vector()
| Parameter | Type |
|---|---|
data | list[int] |
List
f32_sparse_vector()
| Parameter | Type |
|---|---|
data | dict[int, float] |
SparseVector
u8_sparse_vector()
| Parameter | Type |
|---|---|
data | dict[int, int] |
SparseVector
bytes()
| Parameter | Type |
|---|---|
data | list[int] | bytes |
List
u32_list()
| Parameter | Type |
|---|---|
data | list[int] |
List
i32_list()
| Parameter | Type |
|---|---|
data | list[int] |
List
i64_list()
| Parameter | Type |
|---|---|
data | list[int] |
List
f32_list()
| Parameter | Type |
|---|---|
data | list[float] |
List
f64_list()
| Parameter | Type |
|---|---|
data | list[float] |
List
string_list()
| Parameter | Type |
|---|---|
data | list[str] |
List
struct()
| Parameter | Type |
|---|---|
fields | dict[str, Any] |
Struct
matrix()
values parameter can be a list of lists or a numpy array. When passing a numpy array,
the matrix type is inferred from the array’s dtype (float32, float16, uint8, int8).
When passing a list of lists, the optional value_type parameter specifies the matrix type.
If value_type is not provided, the matrix defaults to f32.
| Parameter | Type |
|---|---|
values | list[list[float]] | list[list[int]] | numpy.ndarray |
value_type | Optional[Literal[‘f32’, ‘f16’, ‘f8’, ‘u8’, ‘i8’]] |
Matrix