Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 85a4955

Browse files
Bolt 6.0 support with vector types (#1214)
Introduce Bolt 6.0 support, which includes vector types. Example: ```python 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()) ```
1 parent 23f8242 commit 85a4955

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+5946
-48
lines changed

‎docs/source/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# If extensions (or modules to document with autodoc) are in another directory,
2323
# add these directories to sys.path here. If the directory is relative to the
2424
# documentation root, use os.path.abspath to make it absolute, like shown here.
25-
sys.path.insert(0, os.path.abspath(os.path.join("..", "..")))
25+
sys.path.insert(0, os.path.abspath(os.path.join("..", "..", "src")))
2626

2727

2828
from neo4j import __version__ as project_version
@@ -345,6 +345,9 @@ def setup(app):
345345
intersphinx_mapping = {
346346
"python": ("https://docs.python.org/3", None),
347347
"dateutil": ("https://dateutil.readthedocs.io/en/stable/", None),
348+
"numpy": ("https://numpy.org/doc/stable/", None),
349+
"pandas": ("https://pandas.pydata.org/docs/", None),
350+
"pyarrow": ("https://arrow.apache.org/docs/", None),
348351
}
349352

350353
autodoc_default_options = {

‎docs/source/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Bolt protocol versions supported:
99

1010
.. # [bolt-version-bump] search tag when changing bolt version support
1111
12+
* Bolt 6.0
1213
* Bolt 5.0 - 5.8
1314
* Bolt 4.4
1415

@@ -36,6 +37,8 @@ Topics
3637

3738
+ :ref:`temporal-data-types`
3839

40+
+ :ref:`vector-data-types`
41+
3942
+ :ref:`breaking-changes`
4043

4144

@@ -47,6 +50,7 @@ Topics
4750
async_api.rst
4851
types/spatial.rst
4952
types/temporal.rst
53+
types/vector.rst
5054
breaking_changes.rst
5155

5256

‎docs/source/types/vector.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.. _vector-data-types:
2+
3+
*****************
4+
Vector Data Types
5+
*****************
6+
7+
.. autoclass:: neo4j.vector.Vector
8+
:members:
9+
10+
11+
.. autoclass:: neo4j.vector.VectorEndian
12+
:show-inheritance:
13+
:members:
14+
15+
16+
.. autoclass:: neo4j.vector.VectorDType
17+
:show-inheritance:
18+
:members:

‎pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ Forum = "https://community.neo4j.com/c/drivers-stacks/python/"
5454
Discord = "https://discord.com/invite/neo4j"
5555

5656
[project.optional-dependencies]
57-
numpy = ["numpy >= 1.7.0, < 3.0.0"]
57+
numpy = ["numpy >= 1.21.2, < 3.0.0"]
5858
pandas = [
5959
"pandas >= 1.1.0, < 3.0.0",
60-
"numpy >= 1.7.0, < 3.0.0",
60+
"numpy >= 1.21.2, < 3.0.0",
6161
]
62-
pyarrow = ["pyarrow >= 1.0.0"]
62+
pyarrow = ["pyarrow >= 6.0.0, < 21.0.0"]
6363

6464

6565
[build-system]
@@ -207,8 +207,9 @@ asyncio_default_fixture_loop_scope="function"
207207
[[tool.mypy.overrides]]
208208
module = [
209209
"pandas.*",
210-
"neo4j._codec.packstream._rust",
211-
"neo4j._codec.packstream._rust.*",
210+
"pyarrow.*",
211+
"neo4j._rust",
212+
"neo4j._rust.*",
212213
]
213214
ignore_missing_imports = true
214215

‎src/neo4j/_async/io/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
_bolt3,
3838
_bolt4,
3939
_bolt5,
40+
_bolt6,
4041
)
4142
from ._bolt import AsyncBolt
4243
from ._common import ConnectionErrorHandler

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /