diff --git a/docs-java/orchestration/chat-completion.mdx b/docs-java/orchestration/chat-completion.mdx index 1d52ecf60..b0a1b89de 100644 --- a/docs-java/orchestration/chat-completion.mdx +++ b/docs-java/orchestration/chat-completion.mdx @@ -418,6 +418,24 @@ 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/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 +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. diff --git a/docs-js/orchestration/chat-completion.mdx b/docs-js/orchestration/chat-completion.mdx index 7d7c681fd..eec6df873 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.