From f7a8f3dad7bf2be70a0c2c0723026e47232e4e9f Mon Sep 17 00:00:00 2001
From: Matthias Schur <107557548+MattSchur@users.noreply.github.com>
Date: Tue, 10 Jun 2025 16:06:36 +0200
Subject: [PATCH 01/11] Vector Embeddings: Add example w/ Cloud SDK for AI
---
guides/databases-hana.md | 97 ++++++++++++++++++++++++++++++----------
1 file changed, 74 insertions(+), 23 deletions(-)
diff --git a/guides/databases-hana.md b/guides/databases-hana.md
index e20266956d..3984e6ed39 100644
--- a/guides/databases-hana.md
+++ b/guides/databases-hana.md
@@ -266,41 +266,92 @@ The HANA Service provides dedicated support for native SAP HANA features as foll
### Vector Embeddings { #vector-embeddings }
-Vector embeddings are numerical representations that capture important features and semantics of unstructured data - such as text, images, or audio. This representation makes vector embeddings of similar data have high similarity and low distance to each other. These properties of vector embeddings facilitate tasks like similarity search, anomaly detection, recommendations and Retrieval Augmented Generation (RAG). Vector embeddings from a vector datastore such as the [SAP HANA Cloud Vector Engine](https://community.sap.com/t5/technology-blogs-by-sap/sap-hana-cloud-s-vector-engine-announcement/ba-p/13577010) can help get better generative AI (GenAI) results. This is achieved when the embeddings are used as context to the large language models (LLMs) prompts.
+Vector embeddings let you add semantic search, recommendations, and generative AI features to your CAP application on SAP HANA Cloud. Embeddings are numeric arrays that represent the meaning of unstructured data (text, images, etc.), making it possible to compare and search for items that are semantically related to each other or a user query.
-Typically vector embeddings are computed using an **embedding model**. The embedding model is specifically designed to capture important features and semantics of a specific type of data, it also determines the dimensionality of the vector embedding space. Unified consumption of embedding models and LLMs across different vendors and open source models is provided via the [SAP Generative AI Hub](https://community.sap.com/t5/technology-blogs-by-sap/how-sap-s-generative-ai-hub-facilitates-embedded-trustworthy-and-reliable/ba-p/13596153).
+**How to get started:**
-In CAP, vector embeddings are stored in elements of type [cds.Vector](../cds/types):
+1. **Add Embeddings to CAP:** Use the `cds.Vector` type in your CDS model to store embeddings. Set the dimension to match your embedding model (e.g., 1536 for OpenAI *text-embedding-3-small*).
-```cds
-entity Books : cuid { // [!code focus]
- title : String(111);
- description : LargeString; // [!code focus]
- embedding : Vector(1536); // vector space w/ 1536 dimensions // [!code focus]
-} // [!code focus]
-```
+ ```cds
+ entity Books : cuid {
+ title : String(111);
+ description : LargeString;
+ embedding : Vector(1536); // adjust dimensions to embedding model
+ }
+ ```
-At runtime, you can compute the similarity and distance of vectors in the SAP HANA vector store using the `cosineSimilarity` and `l2Distance` (Euclidean distance) functions in queries:
-::: code-group
-```js [Node.js]
-let embedding; // vector embedding as string '[0.3,0.7,0.1,...]';
+2. **Generate Embeddings:** Use an embedding model to convert your data (for example, book descriptions) into vectors. The [SAP Cloud SDK for AI](https://sap.github.io/ai-sdk/) makes it easy to call SAP AI Core services to generate these embeddings.
-let similarBooks = await SELECT.from('Books')
- .where`cosine_similarity(embedding, to_real_vector(${embedding})) > 0.9`
-```
+
-```java [Java]
-// Vector embedding of text, for example, from SAP GenAI Hub or via LangChain4j
-float[] embedding = embeddingModel.embed(bookDescription).content().vector();
+ ```Java
+ var aiClient = OpenAiClient.forModel(OpenAiModel.TEXT_EMBEDDING_3_SMALL); // [!code focus]
-Result similarBooks = service.run(Select.from(BOOKS).where(b ->
- CQL.cosineSimilarity(b.embedding(), CQL.vector(embedding)).gt(0.9)));
-```
+ var params = new OpenAiEmbeddingParameters();
+ params.setInputType("document");
+ params.setInput(book.getDescription()); // [!code focus:4]
+
+ book.setEmbedding(CdsVector.of(
+ aiClient.embedding(params).getData().get(0).getEmbedding()));
+ ```
+
+
+3. **Query for Similarity:** At runtime, use SAP HANA’s built-in vector functions to search for similar items. For example, find books with embeddings similar to a user question:
+
+
+
+ ```Java
+ // Compute embedding for user question
+ params.setInputType("query");
+ params.setInput("How to use vector embeddings in CAP?");
+ CdsVector userQuestion = CdsVector.of(
+ aiClient.embedding(params).getData().get(0).getEmbedding());
+
+ // Compute similarity between user question and book embeddings
+ var similarity = CQL.cosineSimilarity( // computed on SAP HANA
+ CQL.get(Books.EMBEDDING), userQuestion);
+
+ // Find Books related to user question ordered by similarity
+ hana.run(Select.from(BOOKS).limit(10)
+ .columns(b -> b.ID(), b -> b.title(),
+ b -> similarity.as("similarity"))
+ .orderBy(b -> b.get("similarity").desc()));
+ ```
+
+
+
+
+ ```js
+ // questionEmbedding is a string like '[0.3,0.7,0.1,...]'
+ let similarBooks = await SELECT.from('Books')
+ .where`cosine_similarity(embedding, to_real_vector(${questionEmbedding})) > 0.9`;
+ ```
+
+
+
+:::tip
+Store embeddings when you create or update your data. Regenerate embeddings if you change your embedding model.
+:::
+
+:::tip SAP Cloud SDK for AI
+Use the [SAP Cloud SDK for AI](https://sap.github.io/ai-sdk/) for unified access to embedding models and large language models (LLMs) from [SAP AI Core](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/what-is-sap-ai-core).
:::
+
+
+[Learn more about the SAP Cloud SDK for AI (Java)](https://sap.github.io/ai-sdk/docs/java/getting-started) {.learn-more}
+
[Learn more about Vector Embeddings in CAP Java](../java/cds-data#vector-embeddings) {.learn-more}
+
+
+
+
+[Learn more about the SAP Cloud SDK for AI (JavaScript)](https://sap.github.io/ai-sdk/docs/js/getting-started) {.learn-more}
+
+
+
### Geospatial Functions
From 4b8574ed3df2973bca0d8bd75ebf631d7fd37e47 Mon Sep 17 00:00:00 2001
From: Matthias Schur <107557548+MattSchur@users.noreply.github.com>
Date: Tue, 10 Jun 2025 19:14:25 +0200
Subject: [PATCH 02/11] Apply suggestions from code review
Co-authored-by: Matthias Kuhr <52661546+MatKuhr@users.noreply.github.com>
---
guides/databases-hana.md | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/guides/databases-hana.md b/guides/databases-hana.md
index 3984e6ed39..a3dcf002b8 100644
--- a/guides/databases-hana.md
+++ b/guides/databases-hana.md
@@ -288,12 +288,10 @@ Vector embeddings let you add semantic search, recommendations, and generative A
```Java
var aiClient = OpenAiClient.forModel(OpenAiModel.TEXT_EMBEDDING_3_SMALL); // [!code focus]
- var params = new OpenAiEmbeddingParameters();
- params.setInputType("document");
- params.setInput(book.getDescription()); // [!code focus:4]
+ var request = new OpenAiEmbeddingRequest(List.of(book.getDescription()));
book.setEmbedding(CdsVector.of(
- aiClient.embedding(params).getData().get(0).getEmbedding()));
+ aiClient.embedding(request).getEmbeddings().get(0)));
```
@@ -323,6 +321,12 @@ Vector embeddings let you add semantic search, recommendations, and generative A
```js
+const response = await new AzureOpenAiEmbeddingClient(
+ 'text-embedding-3-small'
+ ).run({
+ input: 'Hello, world!'
+ });
+const embedding = response.getEmbedding();
// questionEmbedding is a string like '[0.3,0.7,0.1,...]'
let similarBooks = await SELECT.from('Books')
.where`cosine_similarity(embedding, to_real_vector(${questionEmbedding})) > 0.9`;
From c7c40b557ac29824918ef607e194ab80ab865f7b Mon Sep 17 00:00:00 2001
From: Matthias Schur <107557548+MattSchur@users.noreply.github.com>
Date: Tue, 10 Jun 2025 19:16:00 +0200
Subject: [PATCH 03/11] Apply suggestions from code review
---
guides/databases-hana.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/guides/databases-hana.md b/guides/databases-hana.md
index a3dcf002b8..d014fc1f64 100644
--- a/guides/databases-hana.md
+++ b/guides/databases-hana.md
@@ -324,9 +324,9 @@ Vector embeddings let you add semantic search, recommendations, and generative A
const response = await new AzureOpenAiEmbeddingClient(
'text-embedding-3-small'
).run({
- input: 'Hello, world!'
+ input: 'How to use vector embeddings in CAP?'
});
-const embedding = response.getEmbedding();
+const questionEmbedding = response.getEmbedding();
// questionEmbedding is a string like '[0.3,0.7,0.1,...]'
let similarBooks = await SELECT.from('Books')
.where`cosine_similarity(embedding, to_real_vector(${questionEmbedding})) > 0.9`;
From 2b89e5685d8528a5ae607558ffa2fcf4ba2cbcb5 Mon Sep 17 00:00:00 2001
From: Matthias Schur <107557548+MattSchur@users.noreply.github.com>
Date: Tue, 10 Jun 2025 19:27:57 +0200
Subject: [PATCH 04/11] Apply suggestions from code review
---
guides/databases-hana.md | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/guides/databases-hana.md b/guides/databases-hana.md
index d014fc1f64..29b335b8d8 100644
--- a/guides/databases-hana.md
+++ b/guides/databases-hana.md
@@ -321,13 +321,12 @@ Vector embeddings let you add semantic search, recommendations, and generative A
```js
-const response = await new AzureOpenAiEmbeddingClient(
+ const response = await new AzureOpenAiEmbeddingClient(
'text-embedding-3-small'
- ).run({
+ ).run({
input: 'How to use vector embeddings in CAP?'
- });
-const questionEmbedding = response.getEmbedding();
- // questionEmbedding is a string like '[0.3,0.7,0.1,...]'
+ });
+ const questionEmbedding = response.getEmbedding();
let similarBooks = await SELECT.from('Books')
.where`cosine_similarity(embedding, to_real_vector(${questionEmbedding})) > 0.9`;
```
From e911bfadb346a26dd73ea415a21bf018c0eaaf8c Mon Sep 17 00:00:00 2001
From: Matthias Schur <107557548+MattSchur@users.noreply.github.com>
Date: Tue, 10 Jun 2025 19:37:16 +0200
Subject: [PATCH 05/11] Java example
---
guides/databases-hana.md | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/guides/databases-hana.md b/guides/databases-hana.md
index 29b335b8d8..cb5332e7f1 100644
--- a/guides/databases-hana.md
+++ b/guides/databases-hana.md
@@ -286,12 +286,11 @@ Vector embeddings let you add semantic search, recommendations, and generative A
```Java
- var aiClient = OpenAiClient.forModel(OpenAiModel.TEXT_EMBEDDING_3_SMALL); // [!code focus]
+ var aiClient = OpenAiClient.forModel(OpenAiModel.TEXT_EMBEDDING_3_SMALL);
+ var response = aiClient.embedding(
+ new OpenAiEmbeddingRequest(List.of(book.getDescription())));
- var request = new OpenAiEmbeddingRequest(List.of(book.getDescription()));
-
- book.setEmbedding(CdsVector.of(
- aiClient.embedding(request).getEmbeddings().get(0)));
+ book.setEmbedding(CdsVector.of(response.getEmbeddings().get(0)));
```
From 5f41d14e00ae2a905bd9a044477cd9ce9d6bd095 Mon Sep 17 00:00:00 2001
From: Matthias Schur <107557548+MattSchur@users.noreply.github.com>
Date: Wed, 11 Jun 2025 19:03:54 +0200
Subject: [PATCH 06/11] Apply suggestions from code review
---
guides/databases-hana.md | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/guides/databases-hana.md b/guides/databases-hana.md
index cb5332e7f1..bb5accde92 100644
--- a/guides/databases-hana.md
+++ b/guides/databases-hana.md
@@ -290,7 +290,7 @@ Vector embeddings let you add semantic search, recommendations, and generative A
var response = aiClient.embedding(
new OpenAiEmbeddingRequest(List.of(book.getDescription())));
- book.setEmbedding(CdsVector.of(response.getEmbeddings().get(0)));
+ book.setEmbedding(CdsVector.of(response.getEmbeddingVectors().get(0)));
```
@@ -300,10 +300,9 @@ Vector embeddings let you add semantic search, recommendations, and generative A
```Java
// Compute embedding for user question
- params.setInputType("query");
- params.setInput("How to use vector embeddings in CAP?");
+ var request = new OpenAiEmbeddingRequest(List.of("How to use vector embeddings in CAP?"));
CdsVector userQuestion = CdsVector.of(
- aiClient.embedding(params).getData().get(0).getEmbedding());
+ aiClient.embedding(request).getEmbeddingVectors().get(0));
// Compute similarity between user question and book embeddings
var similarity = CQL.cosineSimilarity( // computed on SAP HANA
From 4f9a879bb5841182f115b18dc0c85c908b9765a3 Mon Sep 17 00:00:00 2001
From: Rene Jeglinsky
Date: Tue, 17 Jun 2025 13:41:19 +0200
Subject: [PATCH 07/11] edit and remove profiling
---
guides/databases-hana.md | 144 ++++++++++++++++-----------------------
1 file changed, 59 insertions(+), 85 deletions(-)
diff --git a/guides/databases-hana.md b/guides/databases-hana.md
index bb5accde92..3919584efe 100644
--- a/guides/databases-hana.md
+++ b/guides/databases-hana.md
@@ -1,12 +1,9 @@
---
status: released
-impl-variants: true
---
# Using SAP HANA Cloud for Production
-
-
[[toc]]
@@ -20,52 +17,42 @@ CAP isn't validated with other variants of SAP HANA, like "SAP HANA Database as
## Setup & Configuration
-
-
-Run this to use SAP HANA Cloud for production:
+To use SAP HANA Cloud for production, add a dependency to the _package.json_ for Node.js or to the _pom.xml_ for a CAP Java application:
-```sh
+::: code-group
+```sh [Shell/Bash]
npm add @cap-js/hana
```
-::: details Using other SAP HANA drivers...
-
-Package `@cap-js/hana` uses the [`hdb`](https://www.npmjs.com/package/hdb) driver by default. You can override that by running [`npm add @sap/hana-client`](https://www.npmjs.com/package/@sap/hana-client), thereby adding it to your package dependencies, which then takes precedence over the default driver.
-
-:::
-
-::: tip Prefer `cds add`
-
-... as documented in the [deployment guide](deployment/to-cf#_1-sap-hana-database), which also does the equivalent of `npm add @cap-js/hana` but in addition cares for updating `mta.yaml` and other deployment resources.
-
-:::
-
-
-
-
-
-To use SAP HANA Cloud, [configure a module](../java/developing-applications/building#standard-modules), which includes the feature `cds-feature-hana`.
-For example, add a Maven runtime dependency to the `cds-feature-hana` feature:
-
-```xml
+```xml [pom.xml]
com.sap.cds
cds-feature-hana
runtime
```
+:::
-::: tip
+::: details Using other SAP HANA drivers...
-The [modules](../java/developing-applications/building#standard-modules) `cds-starter-cloudfoundry` and `cds-starter-k8s` include `cds-feature-hana`.
+Package `@cap-js/hana` uses the [`hdb`](https://www.npmjs.com/package/hdb) driver by default. You can override that by running [`npm add @sap/hana-client`](https://www.npmjs.com/package/@sap/hana-client), thereby adding it to your package dependencies, which then takes precedence over the default driver.
:::
-The datasource for HANA is then auto-configured based on available service bindings of type *service-manager* and *hana*.
+:::details In CAP Java ...
+The [modules](../java/developing-applications/building#standard-modules) `cds-starter-cloudfoundry` and `cds-starter-k8s` include `cds-feature-hana`.
+
+The datasource for SAP HANA is then auto-configured based on available service bindings of type *service-manager* and *hana*.
[Learn more about the configuration of an SAP HANA Cloud Database](../java/cqn-services/persistence-services#sap-hana){ .learn-more}
+:::
+
+::: tip Prefer `cds add`
+
+... as documented in the [deployment guide](deployment/to-cf#_1-sap-hana-database), which also does the equivalent of `npm add @cap-js/hana` but in addition cares for updating `mta.yaml` and other deployment resources.
+
+:::
-
@@ -268,9 +255,8 @@ The HANA Service provides dedicated support for native SAP HANA features as foll
Vector embeddings let you add semantic search, recommendations, and generative AI features to your CAP application on SAP HANA Cloud. Embeddings are numeric arrays that represent the meaning of unstructured data (text, images, etc.), making it possible to compare and search for items that are semantically related to each other or a user query.
-**How to get started:**
-
-1. **Add Embeddings to CAP:** Use the `cds.Vector` type in your CDS model to store embeddings. Set the dimension to match your embedding model (e.g., 1536 for OpenAI *text-embedding-3-small*).
+#### Add Embeddings to Your CDS Model
+Use the `cds.Vector` type in your CDS model to store embeddings. Set the dimension to match your embedding model (e.g., 1536 for OpenAI *text-embedding-3-small*).
```cds
entity Books : cuid {
@@ -280,56 +266,49 @@ Vector embeddings let you add semantic search, recommendations, and generative A
}
```
+#### Generate Embeddings
+Use an embedding model to convert your data (for example, book descriptions) into vectors. The [SAP Cloud SDK for AI](https://sap.github.io/ai-sdk/) makes it easy to call SAP AI Core services to generate these embeddings.
-2. **Generate Embeddings:** Use an embedding model to convert your data (for example, book descriptions) into vectors. The [SAP Cloud SDK for AI](https://sap.github.io/ai-sdk/) makes it easy to call SAP AI Core services to generate these embeddings.
-
-
-
- ```Java
- var aiClient = OpenAiClient.forModel(OpenAiModel.TEXT_EMBEDDING_3_SMALL);
- var response = aiClient.embedding(
- new OpenAiEmbeddingRequest(List.of(book.getDescription())));
-
- book.setEmbedding(CdsVector.of(response.getEmbeddingVectors().get(0)));
- ```
-
-
-3. **Query for Similarity:** At runtime, use SAP HANA’s built-in vector functions to search for similar items. For example, find books with embeddings similar to a user question:
-
-
+:::details Example using SAP Cloud SDK for AI
+```Java
+var aiClient = OpenAiClient.forModel(OpenAiModel.TEXT_EMBEDDING_3_SMALL);
+var response = aiClient.embedding(
+ new OpenAiEmbeddingRequest(List.of(book.getDescription())));
+book.setEmbedding(CdsVector.of(response.getEmbeddingVectors().get(0)));
+```
+:::
- ```Java
- // Compute embedding for user question
- var request = new OpenAiEmbeddingRequest(List.of("How to use vector embeddings in CAP?"));
- CdsVector userQuestion = CdsVector.of(
- aiClient.embedding(request).getEmbeddingVectors().get(0));
+#### Query for Similarity
+At runtime, use SAP HANA’s built-in vector functions to search for similar items. For example, find books with embeddings similar to a user question:
- // Compute similarity between user question and book embeddings
- var similarity = CQL.cosineSimilarity( // computed on SAP HANA
- CQL.get(Books.EMBEDDING), userQuestion);
+::: code-group
+```Java [Java]
+// Compute embedding for user question
+var request = new OpenAiEmbeddingRequest(List.of("How to use vector embeddings in CAP?"));
+CdsVector userQuestion = CdsVector.of(
+ aiClient.embedding(request).getEmbeddingVectors().get(0));
+// Compute similarity between user question and book embeddings
+var similarity = CQL.cosineSimilarity( // computed on SAP HANA
+ CQL.get(Books.EMBEDDING), userQuestion);
+// Find Books related to user question ordered by similarity
+hana.run(Select.from(BOOKS).limit(10)
+.columns(b -> b.ID(), b -> b.title(),
+ b -> similarity.as("similarity"))
+.orderBy(b -> b.get("similarity").desc()));
+```
- // Find Books related to user question ordered by similarity
- hana.run(Select.from(BOOKS).limit(10)
- .columns(b -> b.ID(), b -> b.title(),
- b -> similarity.as("similarity"))
- .orderBy(b -> b.get("similarity").desc()));
- ```
-
-
-
-
- ```js
- const response = await new AzureOpenAiEmbeddingClient(
- 'text-embedding-3-small'
- ).run({
- input: 'How to use vector embeddings in CAP?'
- });
- const questionEmbedding = response.getEmbedding();
- let similarBooks = await SELECT.from('Books')
- .where`cosine_similarity(embedding, to_real_vector(${questionEmbedding})) > 0.9`;
- ```
+```js [Node.js]
+const response = await new AzureOpenAiEmbeddingClient(
+ 'text-embedding-3-small'
+).run({
+ input: 'How to use vector embeddings in CAP?'
+});
+const questionEmbedding = response.getEmbedding();
+let similarBooks = await SELECT.from('Books')
+ .where`cosine_similarity(embedding, to_real_vector(${questionEmbedding})) > 0.9`;
+```
-
+:::
:::tip
Store embeddings when you create or update your data. Regenerate embeddings if you change your embedding model.
@@ -339,19 +318,14 @@ Store embeddings when you create or update your data. Regenerate embeddings if y
Use the [SAP Cloud SDK for AI](https://sap.github.io/ai-sdk/) for unified access to embedding models and large language models (LLMs) from [SAP AI Core](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/what-is-sap-ai-core).
:::
-
[Learn more about the SAP Cloud SDK for AI (Java)](https://sap.github.io/ai-sdk/docs/java/getting-started) {.learn-more}
[Learn more about Vector Embeddings in CAP Java](../java/cds-data#vector-embeddings) {.learn-more}
-
-
-
-
[Learn more about the SAP Cloud SDK for AI (JavaScript)](https://sap.github.io/ai-sdk/docs/js/getting-started) {.learn-more}
-
+
### Geospatial Functions
From 72a0eca2475679cc7b8f3433afe7935d31808ac7 Mon Sep 17 00:00:00 2001
From: Rene Jeglinsky
Date: Tue, 17 Jun 2025 13:47:33 +0200
Subject: [PATCH 08/11] edit
---
guides/databases-hana.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/guides/databases-hana.md b/guides/databases-hana.md
index 3919584efe..2c6ab08c28 100644
--- a/guides/databases-hana.md
+++ b/guides/databases-hana.md
@@ -256,7 +256,7 @@ The HANA Service provides dedicated support for native SAP HANA features as foll
Vector embeddings let you add semantic search, recommendations, and generative AI features to your CAP application on SAP HANA Cloud. Embeddings are numeric arrays that represent the meaning of unstructured data (text, images, etc.), making it possible to compare and search for items that are semantically related to each other or a user query.
#### Add Embeddings to Your CDS Model
-Use the `cds.Vector` type in your CDS model to store embeddings. Set the dimension to match your embedding model (e.g., 1536 for OpenAI *text-embedding-3-small*).
+Use the `cds.Vector` type in your CDS model to store embeddings. Set the dimension to match your embedding model (for example, 1536 for OpenAI *text-embedding-3-small*).
```cds
entity Books : cuid {
From 883f775bd148bd6dd11d16387a1e2e7edb817702 Mon Sep 17 00:00:00 2001
From: Matthias Schur <107557548+MattSchur@users.noreply.github.com>
Date: Mon, 23 Jun 2025 11:25:27 +0200
Subject: [PATCH 09/11] Choose an Embedding Model
---
guides/databases-hana.md | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/guides/databases-hana.md b/guides/databases-hana.md
index 2c6ab08c28..b8fa03dc82 100644
--- a/guides/databases-hana.md
+++ b/guides/databases-hana.md
@@ -253,10 +253,16 @@ The HANA Service provides dedicated support for native SAP HANA features as foll
### Vector Embeddings { #vector-embeddings }
-Vector embeddings let you add semantic search, recommendations, and generative AI features to your CAP application on SAP HANA Cloud. Embeddings are numeric arrays that represent the meaning of unstructured data (text, images, etc.), making it possible to compare and search for items that are semantically related to each other or a user query.
+Vector embeddings let you add semantic search, recommendations, and generative AI features to your CAP application. Embeddings are numeric arrays that represent the meaning of unstructured data (text, images, etc.), making it possible to compare and search for items that are semantically related to each other or a user query.
+
+#### Choose an Embedding Model
+
+Choose an embedding model that fits your use case and data (for example english or multilingual text). The model determines the number of dimensions of the resulting output vector. Check the documentation of the respective embedding model for details.
+
+Use the [SAP Generative AI Hub](https://community.sap.com/t5/technology-blogs-by-sap/how-sap-s-generative-ai-hub-facilitates-embedded-trustworthy-and-reliable/ba-p/13596153) for unified consumption of embedding models and LLMs across different vendors and open source models. Check for available models on the [SAP AI Launchpad](https://help.sap.com/docs/ai-launchpad/sap-ai-launchpad-user-guide/models-and-scenarios-in-generative-ai-hub-fef463b24bff4f44a33e98bb1e4f3148#models).
#### Add Embeddings to Your CDS Model
-Use the `cds.Vector` type in your CDS model to store embeddings. Set the dimension to match your embedding model (for example, 1536 for OpenAI *text-embedding-3-small*).
+Use the `cds.Vector` type in your CDS model to store embeddings on SAP HANA Cloud. Set the dimension to match your embedding model (for example, 1536 for OpenAI *text-embedding-3-small*).
```cds
entity Books : cuid {
From d6a815d3cb02d8d276a5713191c86cfc53bfa7ab Mon Sep 17 00:00:00 2001
From: Matthias Schur <107557548+MattSchur@users.noreply.github.com>
Date: Mon, 23 Jun 2025 12:58:09 +0200
Subject: [PATCH 10/11] Apply suggestions from code review
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: René Jeglinsky
---
guides/databases-hana.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/guides/databases-hana.md b/guides/databases-hana.md
index b8fa03dc82..ffccc4b994 100644
--- a/guides/databases-hana.md
+++ b/guides/databases-hana.md
@@ -262,7 +262,7 @@ Choose an embedding model that fits your use case and data (for example english
Use the [SAP Generative AI Hub](https://community.sap.com/t5/technology-blogs-by-sap/how-sap-s-generative-ai-hub-facilitates-embedded-trustworthy-and-reliable/ba-p/13596153) for unified consumption of embedding models and LLMs across different vendors and open source models. Check for available models on the [SAP AI Launchpad](https://help.sap.com/docs/ai-launchpad/sap-ai-launchpad-user-guide/models-and-scenarios-in-generative-ai-hub-fef463b24bff4f44a33e98bb1e4f3148#models).
#### Add Embeddings to Your CDS Model
-Use the `cds.Vector` type in your CDS model to store embeddings on SAP HANA Cloud. Set the dimension to match your embedding model (for example, 1536 for OpenAI *text-embedding-3-small*).
+Use the `cds.Vector` type in your CDS model to store embeddings on SAP HANA Cloud. Set the dimension to match your embedding model (for example, 1536 embedding dimensions for OpenAI *text-embedding-3-small*).
```cds
entity Books : cuid {
From 008e8829823fa6a0fc87fa2ef57b425cae4cca97 Mon Sep 17 00:00:00 2001
From: Rene Jeglinsky
Date: Wed, 25 Jun 2025 11:43:53 +0200
Subject: [PATCH 11/11] .
---
guides/databases-hana.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/guides/databases-hana.md b/guides/databases-hana.md
index b8fa03dc82..2523843964 100644
--- a/guides/databases-hana.md
+++ b/guides/databases-hana.md
@@ -285,7 +285,7 @@ book.setEmbedding(CdsVector.of(response.getEmbeddingVectors().get(0)));
:::
#### Query for Similarity
-At runtime, use SAP HANA’s built-in vector functions to search for similar items. For example, find books with embeddings similar to a user question:
+At runtime, use SAP HANA's built-in vector functions to search for similar items. For example, find books with embeddings similar to a user question:
::: code-group
```Java [Java]