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
Copy file name to clipboardExpand all lines: documentation/src/main/asciidoc/quickstart/guides/obtaining.adoc
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,7 @@ transitive dependencies based on the features being used or not.
43
43
|hibernate-envers| Entity versioning and auditing
44
44
|hibernate-spatial| Support for spatial/GIS data types using https://github.com/GeoLatte/geolatte-geom[GeoLatte]
45
45
|hibernate-jpamodelgen| An annotation processor that generates a JPA-compliant metamodel, plus optional Hibernate extras
46
+
|hibernate-vector| Support for mathematical vector types and functions useful for AI/ML topics like vector similarity search and Retrieval-Augmented Generation (RAG)
46
47
|===
47
48
48
49
[cols="40m,~"]
@@ -53,6 +54,7 @@ transitive dependencies based on the features being used or not.
53
54
|hibernate-hikaricp| Support for https://github.com/brettwooldridge/HikariCP/[HikariCP] connection pooling
54
55
|hibernate-vibur| Support for https://www.vibur.org/[Vibur DBCP] connection pooling
55
56
|hibernate-proxool| Support for https://proxool.sourceforge.net/[Proxool] connection pooling
57
+
|hibernate-ucp| Support for https://docs.oracle.com/en/database/oracle/oracle-database/23/jjucp/intro.html[Universal Connection Pool] connection pooling
56
58
|hibernate-jcache| Integration with https://jcp.org/en/jsr/detail?id=107$$[JCache], allowing any compliant implementation as a second-level cache provider
57
59
|hibernate-graalvm| Experimental extension to make it easier to compile applications as a https://www.graalvm.org/[GraalVM] native image
58
60
|hibernate-micrometer| Integration with https://micrometer.io[Micrometer] metrics
Copy file name to clipboardExpand all lines: documentation/src/main/asciidoc/userguide/chapters/query/extensions/Vector.adoc
+30-9Lines changed: 30 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,13 @@
9
9
=== Overview
10
10
11
11
The Hibernate ORM Vector module contains support for mathematical vector types and functions.
12
-
This is useful for AI/ML topics like vector similarity search.
13
-
The module comes with support for a special `vector` data type that essentially represents an array of floats.
12
+
This is useful for AI/ML topics like vector similarity search and Retrieval-Augmented Generation (RAG).
13
+
The module comes with support for a special `vector` data type that essentially represents an array of bytes, floats, or doubles.
14
14
15
-
So far, only the PostgreSQL extension `pgvector` is supported, but in theory,
15
+
So far, both the PostgreSQL extension `pgvector` and the Oracle database 23ai+ `AI Vector Search` feature are supported, but in theory,
16
16
the vector specific functions could be implemented to work with every database that supports arrays.
17
17
18
-
For further details, refer to the https://github.com/pgvector/pgvector#querying[pgvector documentation].
18
+
For further details, refer to the https://github.com/pgvector/pgvector#querying[pgvector documentation] or the https://docs.oracle.com/en/database/oracle/oracle-database/23/vecse/overview-node.html[AI Vector Search documentation].
19
19
20
20
[[vector-module-setup]]
21
21
=== Setup
@@ -44,6 +44,15 @@ so no further configuration is necessary to make the features available.
44
44
45
45
Annotate a persistent attribute with `@JdbcTypeCode(SqlTypes.VECTOR)` and specify the vector length with `@Array(length = ...)`.
46
46
47
+
[WARNING]
48
+
====
49
+
As Oracle AI Vector Search supports different types of elements (to ensure better performance and compatibility with embedding models), you can also use:
50
+
51
+
- `@JdbcTypeCode(SqlTypes.VECTOR_INT8)` for `byte[]`
52
+
- `@JdbcTypeCode(SqlTypes.VECTOR_FLOAT32)` for `float[]`
53
+
- `@JdbcTypeCode(SqlTypes.VECTOR_FLOAT64)` for `double[]`.
54
+
====
55
+
47
56
[[vector-module-usage-example]]
48
57
====
49
58
[source, JAVA, indent=0]
@@ -63,18 +72,30 @@ Expressions of the vector type can be used with various vector functions.
63
72
|===
64
73
| Function | Purpose
65
74
66
-
| `cosine_distance()` | Computes the https://en.wikipedia.org/wiki/Cosine_similarity[cosine distance] between two vectors. Maps to the `<``=``>` operator
67
-
| `euclidean_distance()` | Computes the https://en.wikipedia.org/wiki/Euclidean_distance[euclidean distance] between two vectors. Maps to the `<``-``>` operator
75
+
| `cosine_distance()` | Computes the https://en.wikipedia.org/wiki/Cosine_similarity[cosine distance] between two vectors. Maps to the `<``=``>` operator for `pgvector` and maps to the `vector_distance(v1, v2, COSINE)` function for `Oracle AI Vector Search`.
76
+
77
+
| `euclidean_distance()` | Computes the https://en.wikipedia.org/wiki/Euclidean_distance[euclidean distance] between two vectors. Maps to the `<``-``>` operator for `pgvector` and maps to the
78
+
`vector_distance(v1, v2, EUCLIDEAN)` function for `Oracle AI Vector Search`.
79
+
68
80
| `l2_distance()` | Alias for `euclidean_distance()`
69
-
| `taxicab_distance()` | Computes the https://en.wikipedia.org/wiki/Taxicab_geometry[taxicab distance] between two vectors
81
+
82
+
| `taxicab_distance()` | Computes the https://en.wikipedia.org/wiki/Taxicab_geometry[taxicab distance] between two vectors. Maps to `vector_distance(v1, v2, MANHATTAN)` function for `Oracle AI Vector Search`.
83
+
70
84
| `l1_distance()` | Alias for `taxicab_distance()`
85
+
86
+
| `hamming_distance()` | Computes the https://en.wikipedia.org/wiki/Hamming_distance[hamming distance] between two vectors. Maps to `vector_distance(v1, v2, HAMMING)` function for `Oracle AI Vector Search`.
87
+
71
88
| `inner_product()` | Computes the https://en.wikipedia.org/wiki/Inner_product_space[inner product] between two vectors
72
-
| `negative_inner_product()` | Computes the negative inner product. Maps to the `<``#``>` operator
89
+
90
+
| `negative_inner_product()` | Computes the negative inner product. Maps to the `<``#``>` operator for `pgvector` and maps to the
91
+
`vector_distance(v1, v2, DOT)` function for `Oracle AI Vector Search`.
92
+
73
93
| `vector_dims()` | Determines the dimensions of a vector
94
+
74
95
| `vector_norm()` | Computes the https://en.wikipedia.org/wiki/Euclidean_space#Euclidean_norm[Euclidean norm] of a vector
75
96
|===
76
97
77
-
In addition to these special vector functions, it is also possible to use vectors with the following builtin operators
98
+
In addition to these special vector functions, it is also possible to use vectors with the following builtin `pgvector` operators:
78
99
79
100
`<vector1> + <vector2> = <vector3>`:: Element-wise addition of vectors.
80
101
`<vector1> - <vector2> = <vector3>`:: Element-wise subtraction of vectors.
0 commit comments