You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vector functions allow you to create `VECTOR` values, compute the similarity scores of vector pairs, and calculate the size of a vector.
6
+
Vector functions allow you to construct xref:values-and-types/vector.adoc[`VECTOR` values], compute the similarity and distance scores of vector pairs, and calculate the size of a vector.
| `vectorValue` | `STRING` \| `LIST<INTEGER \| FLOAT>` | The numeric values to create the vector coordinate from.
18
+
or `FLOAT` values, or a `STRING` defining the coordinates in the resulting `VECTOR`.
19
+
| `dimension` | `INTEGER` | The number of dimensions (coordinates) in the vector.
20
+
| `coordinateType` | `[INTEGER64, INTEGER32, INTEGER16, INTEGER8, FLOAT64, FLOAT32]` | The type of each coordinate in the vector.
21
+
| *Returns* 3+| `VECTOR`
22
+
|===
23
+
24
+
[NOTE]
25
+
The `VECTOR` values generated by the `vector()` function can be xref:values-and-types/vector.adoc#store-vector-properties[stored as properties].
26
+
As such, the `vector()` function can be used to store the embeddings generated by Neo4j's xref:genai-integrations.adoc[GenAI plugin] as `VECTOR` property values.
27
+
`VECTOR` properties can semantically searched by a xref:indexes/semantic-indexes/vector-indexes.adoc[vector index].
28
+
29
+
30
+
31
+
.Considerations
32
+
|===
33
+
34
+
| If a `STRING` is used in `vectorValue`, it must start and end with square brackets (`[]`).
35
+
The values inside the brackets must be a number represented in either decimal or scientific notation and must be comma separated.
36
+
| `null`, NaN, and infinity values are not allowed in `vectorValue`.
37
+
| If `vectorValue` contain elements that are not of the specified `coordinateType`, they will be coerced to that coordinate type if possible.
38
+
This includes the potential of lossy conversion in cases where a larger type, e.g. `INTEGER64` does not fit into the specified type, e.g. `FLOAT32`.
39
+
| If `dimension` is omitted, it is calculated by taking the size of the `vectorValue`.
40
+
For example a `vectorValue` with 1024 elements generates a `VECTOR` value with the dimension `1024`.
41
+
| `dimension` must be greater than `0` and less than or equal to `4096`.
42
+
| If `coordinateType` is omitted, the type will be determined by Cypher.
43
+
If the `LIST` used as `vectorValue` is mixed containing exclusively `INTEGER` values, then the largest of those types will be set as the `coordinateType`.
44
+
For example, `LIST<INTEGER64 \| INTEGER32`> generates a `VECTOR` value with a `coordinateType` of `INTEGER64`.
45
+
If the `vectorValue` contains both `FLOAT` and `INTEGER` values, then the `coordinateType` will be that of the largest `FLOAT` present in `vectorValue`.
46
+
For example, `LIST<INTEGER64 \| FLOAT64`> generates a `VECTOR` value with a `coordinateType` of `FLOAT64`.
47
+
| A `null` `vectorValue`, `dimension`, or `coordinateType` will return `null`.
* Returns a `FLOAT` representing the distance between the given vector and a vector of the same dimension with all coordinates set to zero, calculated using the specified `vectorDistanceMetric`.
| *Description* 3+| Returns a `FLOAT` representing the norm (distance) between the given vector and an origin vector of the same dimension with all coordinates set to zero, calculated using the specified `vectorDistanceMetric`.
Copy file name to clipboardExpand all lines: modules/ROOT/pages/indexes/semantic-indexes/vector-indexes.adoc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ Each word or token in a text is typically represented as high-dimensional vector
41
41
42
42
The embedding for a particular data object can be created by both proprietary (such as https://cloud.google.com/vertex-ai[Vertex AI] or https://openai.com/[OpenAI]) and open source (such as https://github.com/UKPLab/sentence-transformers[sentence-transformers]) embedding generators, which can produce vector embeddings with dimensions such as 256, 768, 1536, and 3072.
43
43
Vector embeddings are stored as `LIST<INTEGER | FLOAT>` properties on a node or relationship.
44
-
As of Neo4j 2025.xx, they can also be more efficiently stored as xref:values-and-types/vector.adoc[`VECTOR`types].
44
+
As of Neo4j 2025.xx, they can also be more efficiently stored as xref:values-and-types/vector.adoc[`VECTOR`] property types.
Copy file name to clipboardExpand all lines: modules/ROOT/pages/values-and-types/ordering-equality-comparison.adoc
+3-58Lines changed: 3 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,9 @@ For example, `1 > b` and `1 < b` are both `false` when `b` is NaN.
38
38
* xref:values-and-types/spatial.adoc[Spatial values] and xref:values-and-types/vector.adoc[`VECTOR`] values cannot be compared using the operators `\<=`, `<`,`>=`, `>`.
39
39
To compare spatial values within a specific range, use either the xref:functions/spatial.adoc#functions-withinBBox[`point.withinBBox()`] or the xref:functions/spatial.adoc#functions-point-wgs84-2d[`point()`] function.
40
40
41
+
[NOTE]
42
+
See also xref:values-and-types/vector.adoc#ordering-vector[`VECTOR` values -> Ordering `VECTOR` values].
43
+
41
44
[[value-hierarchy]]
42
45
=== Hierarchy of values
43
46
@@ -146,61 +149,3 @@ If they have the same time and offset but different named time zones, they are s
146
149
Since the length of a day, month, or year varies, Cypher does not define a strict ordering for durations.
147
150
As a result, comparing two durations `(e.g, duration1 < duration2)` will always return `null`.
148
151
149
-
[role=label--new-2025.xx]
150
-
[[ordering-vector]]
151
-
=== Vector values
152
-
153
-
`VECTOR` values with a defined coordinate type and no dimension are ordered before values with only a defined dimension.
154
-
Values with both a defined coordinate type and dimension are ordered according to the ordering of the vector coordinate types, listed in ascending order below:
155
-
156
-
* `INTEGER8`
157
-
* `INTEGER16`
158
-
* `INTEGER32`
159
-
* `INTEGER64`
160
-
* `FLOAT32`
161
-
* `FLOAT64`
162
-
163
-
Within the same coordinate type, `VECTOR` values are ordered by their dimension, with smaller values first.
164
-
`VECTOR` values of the same coordinate type and dimension are then ordered pairwise, similar to how `LIST` values are ordered.
165
-
166
-
.Ordering rules for `VECTOR` values
167
-
[cols="3,3,2,6", options="header"]
168
-
|===
169
-
| A | B | Ordered As | Reason
170
-
171
-
| `VECTOR<FLOAT32>(12345)`
172
-
| `VECTOR<FLOAT32>(123456)`
173
-
| A < B
174
-
| Same coordinate type, compare by dimension ascending.
175
-
176
-
| `VECTOR<INTEGER32>(1234)`
177
-
| `VECTOR<FLOAT32>(1234)`
178
-
| A < B
179
-
| Coordinate type order: `INTEGER32` < `FLOAT32`
180
-
181
-
| `VECTOR<INTEGER8>`
182
-
| `VECTOR(3)`
183
-
| A < B
184
-
| Coordinate type defined and no dimension < dimension defined and no coordinate type
185
-
186
-
| `VECTOR<INTEGER64>(123456)`
187
-
| `VECTOR<FLOAT32>(3)`
188
-
| A < B
189
-
| Coordinate type order: `INTEGER64` < `FLOAT32`, compare coordinate type first.
190
-
191
-
| `VECTOR<FLOAT64>(1234)`
192
-
| `VECTOR<FLOAT32>(1234)`
193
-
| B < A
194
-
| Coordinate type order: `FLOAT32` < `FLOAT64`
195
-
196
-
| `VECTOR<FLOAT32>([1, 2])`
197
-
| `VECTOR<FLOAT32>([2, 1])`
198
-
| A < B
199
-
| Same coordinate type and dimension, pairwise value comparison.
200
-
201
-
| `VECTOR<INTEGER16>(1234)`
202
-
| `LIST<INTEGER>`
203
-
| A < B
204
-
| `VECTOR` values are ordered before `LIST` values
0 commit comments