Skip to content

Conversation

robsdedude
Copy link
Member

@robsdedude robsdedude commented Jun 25, 2025

Introduce Bolt 6.0 support, which includes vector types.

Example:

from neo4j.vector import Vector

# Create a vector (raw big-endian byte buffer by default)
v = Vector(b"\x00\x01\x02\x03", "i16")
# or (less performant, but much more user-friendly)
v = Vector.from_native([1, 513], "i16")
# `v` can now be used as query parameter

# Get a vector
v = driver.execute_query(
    "MATCH (d:Doc) RETURN d.embedding AS v LIMIT 1",
    database_="neo4j",
).records[0]["v"]
# Working with the vector
print(f"Got vector of type {v.dtype} with {len(v)} elements: {v}")
print("raw bytes:", v.raw())
print("python list:", v.to_native())
print("as numpy array:", v.to_numpy())

@robsdedude robsdedude marked this pull request as ready for review July 15, 2025 12:58
Copy link
Contributor

@MaxAake MaxAake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor comments

Copy link
Contributor

@MaxAake MaxAake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robsdedude robsdedude merged commit 85a4955 into neo4j:6.x Jul 21, 2025
20 checks passed
@robsdedude robsdedude deleted the vector-types branch July 21, 2025 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants