SundayT1998/milvus-client/entity does not have a README file

    SchemaError

    pub(all) suberror SchemaError {
    SchemaError(String)
    } derive(Eq,
    Debug
    )

    Errors raised when a collection schema is malformed.

    The message text is the observable behaviour of this module, so it is phrased after the pymilvus wording where the two check the same thing.

    SchemaError::equal

    #deprecated("`SchemaError::equal` is deprecated, use `Eq::equal` instead.")
    fn SchemaError::equal(SchemaError, SchemaError) -> Bool

    SchemaError::not_equal

    #deprecated("`SchemaError::not_equal` is deprecated, use `Eq::not_equal` instead.")
    fn SchemaError::not_equal(x : SchemaError, y : SchemaError) -> Bool

    SchemaError::to_repr

    #deprecated("`SchemaError::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn SchemaError::to_repr(SchemaError) ->
    Repr

    BFloat16Vector

    pub(all) struct BFloat16Vector {
    dim : Int
    values : Array[Float]
    } derive(
    Debug
    )

    A dense vector of dim bfloat16 values, kept widened to float32 so that arithmetic on them stays exact.

    BFloat16Vector::to_repr

    #deprecated("`BFloat16Vector::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn BFloat16Vector::to_repr(BFloat16Vector) ->
    Repr

    BinaryVector

    pub(all) struct BinaryVector {
    dim : Int
    data : Bytes
    } derive(
    Debug
    )

    A dense binary vector of dim bits, packed 8 bits per byte the way VectorField.binary_vector expects. dim is always a multiple of 8, so the byte count is dim / 8.

    BinaryVector::to_repr

    #deprecated("`BinaryVector::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn BinaryVector::to_repr(BinaryVector) ->
    Repr

    CollectionSchema

    pub(all) struct CollectionSchema {
    fields : Array[Field]
    description : String
    enable_dynamic_field : Bool
    } derive(
    Debug
    )

    A collection schema: the fields plus the collection-level description and the enable_dynamic_field switch from CollectionSchema in schema.proto.

    CollectionSchema::field

    fn CollectionSchema::field(self : CollectionSchema, name : String) -> Field?

    The field with the given name, if any.

    CollectionSchema::from_field

    fn CollectionSchema::from_field(field : Field) -> CollectionSchema

    A schema with a single field, for the common one-field case.

    CollectionSchema::new

    A schema with the given fields, no dynamic field.

    CollectionSchema::primary_key

    fn CollectionSchema::primary_key(self : CollectionSchema) -> Field?

    The primary key field, if the schema declares one.

    CollectionSchema::to_repr

    #deprecated("`CollectionSchema::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn CollectionSchema::to_repr(CollectionSchema) ->
    Repr

    CollectionSchema::validate

    fn CollectionSchema::validate(self : CollectionSchema) -> Unit raise SchemaError

    Validates the whole schema: at least one field, exactly one primary key of an auto-ID-capable type, no duplicate names, and every field individually valid.

    CollectionSchema::vector_fields

    fn CollectionSchema::vector_fields(self : CollectionSchema) -> Array[Field]

    All vector fields, in declaration order.

    CollectionSchema::with_auto_id_primary

    fn CollectionSchema::with_auto_id_primary(fields : Array[Field]) -> CollectionSchema

    A schema with one auto ID Int64 primary key named id, plus the given fields. This is the shape most examples use.

    CollectionSchema::with_description

    fn CollectionSchema::with_description(self : CollectionSchema, description : String) -> CollectionSchema

    Sets the collection description.

    CollectionSchema::with_dynamic_field

    fn CollectionSchema::with_dynamic_field(self : CollectionSchema, enabled : Bool) -> CollectionSchema

    Enables or disables the $meta dynamic field.

    CollectionSchema::with_field

    fn CollectionSchema::with_field(self : CollectionSchema, field : Field) -> CollectionSchema

    Appends a field.

    DataType

    pub(all) enum DataType {
    None
    Bool
    Int8
    Int16
    Int32
    Int64
    Float
    Double
    String
    VarChar
    Array
    Json
    Geometry
    Text
    Timestamptz
    Mol
    Date
    Time
    Decimal
    Uuid
    BinaryVector
    FloatVector
    Float16Vector
    BFloat16Vector
    SparseFloatVector
    Int8Vector
    ArrayOfVector
    ArrayOfStruct
    Struct
    } derive(Eq,
    Debug
    )

    Milvus field data types.

    The enum members mirror milvus.proto.schema.DataType one to one, and the numeric values are pinned by DataType::to_int (see entity_wbtest.mbt). They are part of the wire protocol, so neither the spelling nor the value may drift from the upstream .proto.

    DataType::equal

    #deprecated("`DataType::equal` is deprecated, use `Eq::equal` instead.")
    fn DataType::equal(DataType, DataType) -> Bool

    DataType::from_int

    fn DataType::from_int(value : Int) -> DataType?

    Inverse of DataType::to_int; None for values this client does not know.

    DataType::is_dense_vector_type

    fn DataType::is_dense_vector_type(self : DataType) -> Bool

    Whether rows of the type have a fixed byte width derived from dim. Sparse vectors do not: they store only the non-zero entries of each row.

    DataType::is_vector_type

    fn DataType::is_vector_type(self : DataType) -> Bool

    Whether the type is any vector kind, dense or sparse.

    DataType::name

    fn DataType::name(self : DataType) -> String

    The enum constant name, as spelled in schema.proto.

    DataType::not_equal

    #deprecated("`DataType::not_equal` is deprecated, use `Eq::not_equal` instead.")
    fn DataType::not_equal(x : DataType, y : DataType) -> Bool

    DataType::to_int

    fn DataType::to_int(self : DataType) -> Int

    The DataType enum value from schema.proto.

    DataType::to_repr

    #deprecated("`DataType::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn DataType::to_repr(DataType) ->
    Repr

    DataType::vector_bytes_per_dim

    fn DataType::vector_bytes_per_dim(self : DataType) -> Int?

    Bytes each dimension takes for dense, non-packed vector types. None for binary vectors (packed, 8 dimensions per byte) and for every non-vector type.

    Field

    pub(all) struct Field {
    name : String
    data_type : DataType
    field_id : Int64
    is_primary_key : Bool
    auto_id : Bool
    description : String
    is_dynamic : Bool
    is_partition_key : Bool
    is_clustering_key : Bool
    nullable : Bool
    element_type : DataType?
    dim : Int?
    max_length : Int?
    type_params : Array[(String, String)]
    } derive(
    Debug
    )

    One field of a collection schema.

    dim and max_length are not FieldSchema fields in schema.proto; the server reads them out of type_params, which is why they are kept here as keys plus an escape hatch (type_params) for the remaining entries such as enable_analyzer.

    Field::as_auto_id

    fn Field::as_auto_id(self : Field) -> Field

    Enables server-side ID generation for a primary key field.

    Field::as_nullable

    fn Field::as_nullable(self : Field) -> Field

    Allows null values for the field.

    Field::as_partition_key

    fn Field::as_partition_key(self : Field) -> Field

    Enables logic partitions on the field.

    Field::as_primary_key

    fn Field::as_primary_key(self : Field) -> Field

    Marks the field as the collection's primary key.

    Field::is_sparse_vector

    fn Field::is_sparse_vector(self : Field) -> Bool

    Whether the field is a sparse float vector field, which is the one vector kind that has no dimension.

    Field::new

    fn Field::new(name : String, data_type : DataType) -> Field

    A field with no optional attribute set: not a primary key, not auto ID, not dynamic, not nullable, no dimension and no max length.

    Field::to_repr

    #deprecated("`Field::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn Field::to_repr(Field) ->
    Repr

    Field::type_params_pairs

    fn Field::type_params_pairs(self : Field) -> Array[(String, String)]

    The type_params entries schema.proto expects for this field: the dimension for vectors, the max length for string fields.

    Field::validate

    fn Field::validate(self : Field) -> Unit raise SchemaError

    Validates one field: a dimension on every dense vector field and on none of the others, an auto ID only on the primary key, and a partition key only on an Int64 or VarChar field.

    Field::with_dim

    fn Field::with_dim(self : Field, dim : Int) -> Field raise SchemaError

    Sets the dimension of a vector field.

    Field::with_element_type

    fn Field::with_element_type(self : Field, element_type : DataType) -> Field

    Sets the element type of an Array field.

    Field::with_max_length

    fn Field::with_max_length(self : Field, max_length : Int) -> Field raise SchemaError

    Sets the maximum length of a VarChar (or Text) field.

    Field::with_type_param

    fn Field::with_type_param(self : Field, key : String, value : String) -> Field

    Adds an arbitrary type_params entry, e.g. enable_analyzer=true.

    Float16Vector

    pub(all) struct Float16Vector {
    dim : Int
    values : Array[Float]
    } derive(
    Debug
    )

    A dense vector of dim IEEE-754 half-precision values. The values are kept as floats and narrowed on the wire, where each one takes two bytes.

    Float16Vector::to_repr

    #deprecated("`Float16Vector::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn Float16Vector::to_repr(Float16Vector) ->
    Repr

    FloatVector

    pub(all) struct FloatVector {
    dim : Int
    values : Array[Float]
    } derive(
    Debug
    )

    A dense vector of dim float32 values.

    FloatVector::to_repr

    #deprecated("`FloatVector::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn FloatVector::to_repr(FloatVector) ->
    Repr

    Int8Vector

    pub(all) struct Int8Vector {
    dim : Int
    data : Bytes
    } derive(
    Debug
    )

    A dense vector of dim signed bytes.

    Int8Vector::to_repr

    #deprecated("`Int8Vector::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn Int8Vector::to_repr(Int8Vector) ->
    Repr

    SparseFloatVector

    pub(all) struct SparseFloatVector {
    indices : Array[UInt]
    values : Array[Float]
    } derive(Eq,
    Debug
    )

    A sparse float vector: the value of each stored coordinate, keyed by coordinate. The server sizes a sparse row by its largest index, not by a declared dimension, so there is no dim here.

    Indices are UInt because SparseFloatVector coordinates are uint32 on the wire. The .proto bounds the row by uint32 and the per-entry encoding by varint, so an index at or above 2^32 - 1 is rejected the same way upstream rejects it.

    SparseFloatVector::equal

    #deprecated("`SparseFloatVector::equal` is deprecated, use `Eq::equal` instead.")
    fn SparseFloatVector::equal(SparseFloatVector, SparseFloatVector) -> Bool

    SparseFloatVector::from_bytes

    fn SparseFloatVector::from_bytes(bytes : Bytes) -> SparseFloatVector raise SchemaError

    The sparse row that a payload written by SparseFloatVector::to_bytes stands for: little-endian uint32 index followed by little-endian float32 value, 8 bytes an entry. Named after the upstream entity.DeserializeSliceSparseEmbedding.

    A byte count that is not a multiple of 8, or a NaN value, is rejected the same way the write side rejects it, so a payload round-trips or fails loudly at the boundary.

    SparseFloatVector::from_entry

    fn SparseFloatVector::from_entry(index : UInt, value : Float) -> SparseFloatVector

    A sparse row with a single entry.

    SparseFloatVector::inferred_dim

    fn SparseFloatVector::inferred_dim(self : SparseFloatVector) -> Int

    The dimension the server will infer for this row: the largest index plus one, or 0 for an empty row.

    SparseFloatVector::new

    fn SparseFloatVector::new(indices : Array[UInt], values : Array[Float]) -> SparseFloatVector raise SchemaError

    A sparse row from parallel index/value arrays. Both arrays must be the same length; neither may hold a NaN value.

    SparseFloatVector::not_equal

    #deprecated("`SparseFloatVector::not_equal` is deprecated, use `Eq::not_equal` instead.")
    fn SparseFloatVector::not_equal(x : SparseFloatVector, y : SparseFloatVector) -> Bool

    SparseFloatVector::to_bytes

    fn SparseFloatVector::to_bytes(self : SparseFloatVector) -> Bytes raise SchemaError

    Encodes the row as index/value pairs, each a little-endian uint32 followed by a little-endian float32. Entries are sorted by index, which is the order upstream writes and the order Milvus persists.

    SparseFloatVector::to_repr

    #deprecated("`SparseFloatVector::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn SparseFloatVector::to_repr(SparseFloatVector) ->
    Repr

    SparseFloatVector::validate

    fn SparseFloatVector::validate(self : SparseFloatVector) -> Unit raise SchemaError

    Validates the row against the encoding the server accepts: equal lengths, indices below 2^32 - 1, and no NaN.

    bfloat16_from_float

    fn bfloat16_from_float(value : Float) -> UInt

    The BFloat16 bit pattern of each float, in the same order as the input.

    BFloat16 is the top 16 bits of an IEEE-754 float32, so the conversion is a truncation plus a round-to-nearest-even step. The rounding constant is 0x7FFF + lsb: adding the low bit of the target makes an exact tie round up only when that bit is already odd, which is round-half-to-even without a branch. Carrying into the exponent is intended — it is how the mantissa overflows into the next binade (0x3F7FFFFF -> 0x3F80, i.e. 1.0), and the same carry turns a float32 infinity into a bfloat16 infinity.

    The result is compared against upstream ml_dtypes.bfloat16 over the whole 32-bit space in the report that accompanies this module; see proto/REPORT.md for the tooling it was checked with.

    bfloat16_from_floats

    fn bfloat16_from_floats(values : Array[Float]) -> Array[UInt]

    The BFloat16 bit pattern of each float, in input order.

    bfloat16_to_float

    fn bfloat16_to_float(bits : UInt) -> Float

    The float that a BFloat16 bit pattern stands for. Exact: every bfloat16 value is a float32 value, so the widening is a shift with no rounding.

    bfloat16_vector_bytes

    fn bfloat16_vector_bytes(values : Array[Float]) -> Bytes

    The little-endian, two-bytes-per-value encoding of floats as BFloat16, which is what VectorField.bfloat16_vector carries on the wire.

    bfloat16_vector_from_bytes

    fn bfloat16_vector_from_bytes(bytes : Bytes) -> Array[Float] raise SchemaError

    Decodes little-endian BFloat16 bytes back into floats. An odd byte count is a malformed payload and is rejected rather than silently truncated.

    dim_key

    let dim_key : String

    Key of the dim entry written into type_params.

    float16_from_float

    fn float16_from_float(value : Float) -> UInt

    The float16 (IEEE-754 binary16) bit pattern of a float32, rounded half-to-even.

    Split by the value of e = exponent - 127, the unbiased exponent:

    • e > 15 overflows binary16 and lands on infinity;
    • e < -14 is subnormal territory, where the implicit leading 1 turns explicit and every step left the value takes costs one bit of the mantissa. Below e = -24 the value rounds to a signed zero;
    • otherwise it is a normal number and the biased exponent moves from 127 to 15, with the 23-bit mantissa narrowed to 10 by one round-half-even step.

    Rounding to nearest even is done on the integer mantissa rather than on the value, so no intermediate is ever held in a wider float: this is what the read side in @column inverts, bit for bit.

    float16_vector_bytes

    fn float16_vector_bytes(values : Array[Float]) -> Bytes

    The little-endian, two-bytes-per-value encoding of floats as float16, which is what VectorField.float16_vector carries on the wire.

    max_length_key

    let max_length_key : String

    Key of the max_length entry written into type_params.