Skip to content

Commit 445f8dd

Browse files
committed
Remove unnecessary formatting change in docs.
1 parent 6ddcfed commit 445f8dd

File tree

1 file changed

+41
-48
lines changed

1 file changed

+41
-48
lines changed

docs/guides/ORCHESTRATION_CHAT_COMPLETION.md

Lines changed: 41 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Orchestration Chat Completion
1+
=# Orchestration Chat Completion
22

33
## Table of Contents
44

@@ -77,7 +77,7 @@ To use the Orchestration service, create a client and a configuration object:
7777
var client = new OrchestrationClient();
7878

7979
var config = new OrchestrationModuleConfig()
80-
.withLlmConfig(OrchestrationAiModel.GPT_4O);
80+
.withLlmConfig(OrchestrationAiModel.GPT_4O);
8181
```
8282

8383
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.
@@ -120,9 +120,9 @@ Include a message history to maintain context in the conversation:
120120

121121
```java
122122
var messagesHistory =
123-
List.of(
124-
Message.user("What is the capital of France?"),
125-
Message.assistant("The capital of France is Paris."));
123+
List.of(
124+
Message.user("What is the capital of France?"),
125+
Message.assistant("The capital of France is Paris."));
126126
var message =
127127
Message.user("What is the typical food there?");
128128

@@ -198,27 +198,27 @@ Use the grounding module to provide additional context to the AI model.
198198

199199
```java
200200
var message =
201-
Message.user(
202-
"{{?groundingInput}} Use the following information as additional context: {{?groundingOutput}}");
203-
var prompt =
204-
new OrchestrationPrompt(Map.of("groundingInput", "What does Joule do?"), message);
205-
206-
var filterInner =
207-
DocumentGroundingFilter.create().id("someID").dataRepositoryType(DataRepositoryType.VECTOR);
208-
var groundingConfigConfig =
209-
GroundingModuleConfigConfig.create()
210-
.inputParams(List.of("groundingInput"))
211-
.outputParam("groundingOutput")
212-
.addFiltersItem(filterInner);
213-
214-
var groundingConfig =
215-
GroundingModuleConfig.create()
216-
.type(GroundingModuleConfig.TypeEnum.DOCUMENT_GROUNDING_SERVICE)
217-
.config(groundingConfigConfig);
218-
var configWithGrounding = config.withGroundingConfig(groundingConfig);
219-
220-
var result =
221-
new OrchestrationClient().chatCompletion(prompt, configWithGrounding);
201+
Message.user(
202+
"{{?groundingInput}} Use the following information as additional context: {{?groundingOutput}}");
203+
var prompt =
204+
new OrchestrationPrompt(Map.of("groundingInput", "What does Joule do?"), message);
205+
206+
var filterInner =
207+
DocumentGroundingFilter.create().id("someID").dataRepositoryType(DataRepositoryType.VECTOR);
208+
var groundingConfigConfig =
209+
GroundingModuleConfigConfig.create()
210+
.inputParams(List.of("groundingInput"))
211+
.outputParam("groundingOutput")
212+
.addFiltersItem(filterInner);
213+
214+
var groundingConfig =
215+
GroundingModuleConfig.create()
216+
.type(GroundingModuleConfig.TypeEnum.DOCUMENT_GROUNDING_SERVICE)
217+
.config(groundingConfigConfig);
218+
var configWithGrounding = config.withGroundingConfig(groundingConfig);
219+
220+
var result =
221+
new OrchestrationClient().chatCompletion(prompt, configWithGrounding);
222222
```
223223

224224
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,20 +235,13 @@ This is a blocking example for streaming and printing directly to the console:
235235
String msg = "Can you give me the first 100 numbers of the Fibonacci sequence?";
236236

237237
// try-with-resources on stream ensures the connection will be closed
238-
try(
239-
Stream<String> stream = client.streamChatCompletion(prompt, config)){
240-
stream.
241-
242-
forEach(
243-
deltaString ->{
244-
System.out.
245-
246-
print(deltaString);
247-
System.out.
248-
249-
flush();
238+
try (Stream<String> stream = client.streamChatCompletion(prompt, config)) {
239+
stream.forEach(
240+
deltaString -> {
241+
System.out.print(deltaString);
242+
System.out.flush();
250243
});
251-
}
244+
}
252245
```
253246

254247
#### Spring Boot example
@@ -262,12 +255,12 @@ Change your LLM configuration to add model parameters:
262255

263256
```java
264257
OrchestrationAiModel customGPT4O =
265-
OrchestrationAiModel.GPT_4O
266-
.withParam(MAX_TOKENS, 50)
267-
.withParam(TEMPERATURE, 0.1)
268-
.withParam(FREQUENCY_PENALTY, 0)
269-
.withParam(PRESENCE_PENALTY, 0)
270-
.withVersion("2024-05-13");
258+
OrchestrationAiModel.GPT_4O
259+
.withParam(MAX_TOKENS, 50)
260+
.withParam(TEMPERATURE, 0.1)
261+
.withParam(FREQUENCY_PENALTY, 0)
262+
.withParam(PRESENCE_PENALTY, 0)
263+
.withVersion("2024-05-13");
271264
```
272265

273266
### Using a Configuration from AI Launchpad
@@ -276,8 +269,8 @@ In case you have created a configuration in AI Launchpad, you can copy or downlo
276269

277270
```java
278271
var configJson = """
279-
... paste your configuration JSON in here ...
280-
""";
272+
... paste your configuration JSON in here ...
273+
""";
281274
// or load your config from a file, e.g.
282275
// configJson = Files.readString(Paths.get("path/to/my/orchestration-config.json"));
283276

@@ -286,4 +279,4 @@ var prompt = new OrchestrationPrompt(Map.of("your-input-parameter", "your-param-
286279
new OrchestrationClient().executeRequestFromJsonModuleConfig(prompt, configJson);
287280
```
288281

289-
While this is not recommended for long term use, it can be useful for creating demos and PoCs.
282+
While this is not recommended for long term use, it can be useful for creating demos and PoCs.

0 commit comments

Comments
 (0)