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: docs/guides/ORCHESTRATION_CHAT_COMPLETION.md
+13-17Lines changed: 13 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@
20
20
21
21
This guide provides examples of how to use the Orchestration service in SAP AI Core for chat completion tasks using the SAP AI SDK for Java.
22
22
23
-
##Prerequisites
23
+
# Prerequisites
24
24
25
25
Before using the AI Core module, ensure that you have met all the general requirements outlined in the [README.md](../../README.md#general-requirements).
26
26
Additionally, include the necessary Maven dependency in your project.
@@ -86,7 +86,7 @@ var config = new OrchestrationModuleConfig()
86
86
87
87
Please also refer to [our sample code](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java) for this and all following code examples.
88
88
89
-
###Chat Completion
89
+
## Chat Completion
90
90
91
91
Use the Orchestration service to generate a response to a user message:
If the input message violates the filter policy, a `400 (Bad Request)` response will be received during the `chatCompletion` call.
@@ -179,7 +179,7 @@ var result =
179
179
180
180
You will find [some examples](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java) in our Spring Boot application demonstrating response handling with filters.
181
181
182
-
###Data masking
182
+
## Data masking
183
183
184
184
Use the data masking module to anonymize personal information in the input:
185
185
@@ -202,7 +202,7 @@ var result =
202
202
203
203
In this example, the input will be masked before the call to the LLM and will remain masked in the output.
204
204
205
-
###Grounding
205
+
## Grounding
206
206
207
207
Use the grounding module to provide additional context to the AI model.
208
208
@@ -233,11 +233,11 @@ Use the grounding module to provide additional context to the AI model.
233
233
234
234
In this example, the AI model is provided with additional context in the form of grounding information. Note, that it is necessary to provide the grounding input via one or more input variables.
235
235
236
-
###Stream chat completion
236
+
## Stream chat completion
237
237
238
238
It's possible to pass a stream of chat completion delta elements, e.g. from the application backend to the frontend in real-time.
239
239
240
-
####Asynchronous Streaming
240
+
### Asynchronous Streaming
241
241
242
242
This is a blocking example for streaming and printing directly to the console:
Please find [an example in our Spring Boot application](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java).
260
258
It shows the usage of Spring Boot's `ResponseBodyEmitter` to stream the chat completion delta messages to the frontend in real-time.
261
259
262
-
###Set model parameters
260
+
## Set model parameters
263
261
264
262
Change your LLM configuration to add model parameters:
The Orchestration client is integrated in Spring AI classes:
279
277
@@ -287,11 +285,9 @@ Prompt prompt = new Prompt("What is the capital of France?", opts);
287
285
ChatResponse response = client.call(prompt);
288
286
```
289
287
290
-
#### Spring Boot example
291
-
292
288
Please find [an example in our Spring AI application](../../sample-code/spring-ai-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java).
293
289
294
-
###Using a Configuration from AI Launchpad
290
+
## Using a Configuration from AI Launchpad
295
291
296
292
In case you have created a configuration in AI Launchpad, you can copy or download the configuration as JSON and use it directly in your code:
0 commit comments