Bolty.Types.Vector (Bolty v0.1.0)

Copy Markdown

A typed vector of floating-point values, as introduced in Bolt 6.0 (Neo4j 2026.05+).

Requires a connection negotiated at Bolt 6.0 or later — packing a Vector over an older connection raises Bolty.Error with code :vector_requires_bolt_6.

Fields

  • type — element precision: :float32 (IEEE-754 single) or :float64 (IEEE-754 double)
  • data — list of float values

Example

alias Bolty.Types.Vector

# Pass a vector as a query parameter (works on Community Edition):
embedding = Vector.new(:float32, [0.1, 0.2, 0.3])
[%{"v" => result}] = Bolty.query!(conn, "RETURN $v AS v", %{v: embedding})

# Storing vectors as node properties requires Neo4j Enterprise Edition:
Bolty.query!(conn, "CREATE (n:Item {embedding: $v})", %{v: embedding})

Summary

Types

element_type()

@type element_type() :: :float32 | :float64

t()

@type t() :: %Bolty.Types.Vector{data: [float()], type: element_type()}

Functions

new(type, data)

@spec new(:float32 | :float64, [float()]) :: t()