Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs-java/orchestration/chat-completion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs-js/orchestration/chat-completion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down