From fb19dc42f0b9e82c46eea960cdd06d59418c1f10 Mon Sep 17 00:00:00 2001 From: Jonas Israel Date: Wed, 19 Nov 2025 11:05:34 +0100 Subject: [PATCH 1/4] initial --- docs-java/orchestration/chat-completion.mdx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs-java/orchestration/chat-completion.mdx b/docs-java/orchestration/chat-completion.mdx index 1d52ecf60..5f03cd140 100644 --- a/docs-java/orchestration/chat-completion.mdx +++ b/docs-java/orchestration/chat-completion.mdx @@ -418,6 +418,26 @@ var result = client.chatCompletion(prompt, maskedGroundingConfig); Please find [an example in our Spring Boot application](https://github.com/SAP/ai-sdk-java/tree/main/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java). + +### Retrieving Additional Metadata + +To include [metadata](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/metadata) in the grounding result, you can set the `metadataParams` options on the `Grounding` object by providing one or more strings of the metadata keys. +If you provide `"*"`, all metadata will be included. + +```java +var groundingConfig = Grounding.create().metadataParams("foo", "bar"); +var prompt = groundingConfig.createGroundingPrompt("What does Joule do?"); +var configWithGrounding = config.withGrounding(groundingConfig); + +var result = client.chatCompletion(prompt, configWithGrounding); +``` + +Note that retrieving this additional metadata information is not supported for data repository type _help.sap.com_. +When using grounding via _help.sap.com_ the SDk will ignore the provided metadata parameters. + +Please find [an example in our Spring Boot application](https://github.com/SAP/ai-sdk-java/tree/main/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java). + + ## Streaming It's possible to pass a stream of chat completion delta elements, e.g. from the application backend to the frontend in real-time. From e20d5cece129b97c39eabc7ac3da67b3086d1140 Mon Sep 17 00:00:00 2001 From: cloud-sdk-js Date: Wed, 19 Nov 2025 10:12:44 +0000 Subject: [PATCH 2/4] fix: Changes from lint --- docs-java/orchestration/chat-completion.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs-java/orchestration/chat-completion.mdx b/docs-java/orchestration/chat-completion.mdx index 5f03cd140..9fef75181 100644 --- a/docs-java/orchestration/chat-completion.mdx +++ b/docs-java/orchestration/chat-completion.mdx @@ -418,7 +418,6 @@ var result = client.chatCompletion(prompt, maskedGroundingConfig); Please find [an example in our Spring Boot application](https://github.com/SAP/ai-sdk-java/tree/main/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java). - ### Retrieving Additional Metadata To include [metadata](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/metadata) in the grounding result, you can set the `metadataParams` options on the `Grounding` object by providing one or more strings of the metadata keys. @@ -437,7 +436,6 @@ When using grounding via _help.sap.com_ the SDk will ignore the provided metadat Please find [an example in our Spring Boot application](https://github.com/SAP/ai-sdk-java/tree/main/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java). - ## Streaming It's possible to pass a stream of chat completion delta elements, e.g. from the application backend to the frontend in real-time. From 6e2ab42f283043c99eec0c9df897d12e6058e80a Mon Sep 17 00:00:00 2001 From: Jonas Israel Date: Wed, 19 Nov 2025 11:14:27 +0100 Subject: [PATCH 3/4] lint --- docs-java/orchestration/chat-completion.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-java/orchestration/chat-completion.mdx b/docs-java/orchestration/chat-completion.mdx index 5f03cd140..a1c4fd332 100644 --- a/docs-java/orchestration/chat-completion.mdx +++ b/docs-java/orchestration/chat-completion.mdx @@ -433,7 +433,7 @@ var result = client.chatCompletion(prompt, configWithGrounding); ``` Note that retrieving this additional metadata information is not supported for data repository type _help.sap.com_. -When using grounding via _help.sap.com_ the SDk will ignore the provided metadata parameters. +When using grounding via _help.sap.com_ the SDK will ignore the provided metadata parameters. Please find [an example in our Spring Boot application](https://github.com/SAP/ai-sdk-java/tree/main/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java). From 5de39effd2362467d7c02e59d500ea5946db9cd6 Mon Sep 17 00:00:00 2001 From: Jonas Israel Date: Wed, 19 Nov 2025 15:50:23 +0100 Subject: [PATCH 4/4] fix link in java and js docs --- docs-java/orchestration/chat-completion.mdx | 2 +- docs-js/orchestration/chat-completion.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-java/orchestration/chat-completion.mdx b/docs-java/orchestration/chat-completion.mdx index e1af5f77d..b0a1b89de 100644 --- a/docs-java/orchestration/chat-completion.mdx +++ b/docs-java/orchestration/chat-completion.mdx @@ -420,7 +420,7 @@ Please find [an example in our Spring Boot application](https://github.com/SAP/a ### Retrieving Additional Metadata -To include [metadata](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/metadata) in the grounding result, you can set the `metadataParams` options on the `Grounding` object by providing one or more strings of the metadata keys. +To include [metadata](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/contextualized-retrieval-using-metadata-and-vector-search?locale=en-US) in the grounding result, you can set the `metadataParams` options on the `Grounding` object by providing one or more strings of the metadata keys. If you provide `"*"`, all metadata will be included. ```java diff --git a/docs-js/orchestration/chat-completion.mdx b/docs-js/orchestration/chat-completion.mdx index 644403c54..6f8d4647f 100644 --- a/docs-js/orchestration/chat-completion.mdx +++ b/docs-js/orchestration/chat-completion.mdx @@ -696,7 +696,7 @@ const response = await orchestrationClient.chatCompletion({ By default, the optional filter property `data_repository_type` is set to `vector`. Set it to `help.sap.com` to retrieve context from the SAP Help Portal. -Set `metadata_params` property with an array of parameter names to include [Metadata](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/metadata) in the grounding result, which can be mentioned when writing the prompt. +Set `metadata_params` property with an array of parameter names to include [Metadata](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/contextualized-retrieval-using-metadata-and-vector-search?locale=en-US) in the grounding result, which can be mentioned when writing the prompt. If set the value to `'*'`, all metadata will be included. Set `data_repositories` property with an array of repository IDs to search in specific data repositories.