Skip to content

Commit d4e7af2

Browse files
committed
Formatting
1 parent c2b55ab commit d4e7af2

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/SpringAiOrchestrationController.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import com.sap.ai.sdk.orchestration.spring.OrchestrationSpringChatResponse;
66
import javax.annotation.Nonnull;
77
import javax.annotation.Nullable;
8-
import lombok.val;
98
import lombok.extern.slf4j.Slf4j;
9+
import lombok.val;
1010
import org.springframework.ai.chat.messages.AssistantMessage;
1111
import org.springframework.ai.chat.model.ChatResponse;
1212
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,7 +56,8 @@ Object template(@Nullable @RequestParam(value = "format", required = false) fina
5656

5757
@GetMapping("/inputFiltering")
5858
@Nonnull
59-
Object inputFiltering(@Nullable @RequestParam(value = "format", required = false) final String format) {
59+
Object inputFiltering(
60+
@Nullable @RequestParam(value = "format", required = false) final String format) {
6061

6162
final ChatResponse response;
6263
try {
@@ -75,7 +76,8 @@ Object inputFiltering(@Nullable @RequestParam(value = "format", required = false
7576

7677
@GetMapping("/outputFiltering")
7778
@Nonnull
78-
Object outputFiltering(@Nullable @RequestParam(value = "format", required = false) final String format) {
79+
Object outputFiltering(
80+
@Nullable @RequestParam(value = "format", required = false) final String format) {
7981

8082
final ChatResponse response;
8183
try {

sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiOrchestrationService.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,17 @@ public ChatResponse masking() {
103103
*/
104104
@Nonnull
105105
public ChatResponse inputFiltering() throws OrchestrationClientException {
106-
val filterConfig = new AzureContentFilter()
106+
val filterConfig =
107+
new AzureContentFilter()
107108
.hate(AzureFilterThreshold.ALLOW_SAFE)
108109
.selfHarm(AzureFilterThreshold.ALLOW_SAFE)
109110
.sexual(AzureFilterThreshold.ALLOW_SAFE)
110111
.violence(AzureFilterThreshold.ALLOW_SAFE);
111112

112113
val opts = new OrchestrationChatOptions(config.withInputFiltering(filterConfig));
113114

114-
val prompt = new Prompt("Please rephrase the following sentence for me: 'I want to kill you!'", opts);
115+
val prompt =
116+
new Prompt("Please rephrase the following sentence for me: 'I want to kill you!'", opts);
115117

116118
return client.call(prompt);
117119
}
@@ -126,15 +128,17 @@ public ChatResponse inputFiltering() throws OrchestrationClientException {
126128
*/
127129
@Nonnull
128130
public ChatResponse outputFiltering() throws OrchestrationClientException {
129-
val filterConfig = new AzureContentFilter()
131+
val filterConfig =
132+
new AzureContentFilter()
130133
.hate(AzureFilterThreshold.ALLOW_SAFE)
131134
.selfHarm(AzureFilterThreshold.ALLOW_SAFE)
132135
.sexual(AzureFilterThreshold.ALLOW_SAFE)
133136
.violence(AzureFilterThreshold.ALLOW_SAFE);
134137

135138
val opts = new OrchestrationChatOptions(config.withOutputFiltering(filterConfig));
136139

137-
val prompt = new Prompt("Please rephrase the following sentence for me: 'I want to kill you!'", opts);
140+
val prompt =
141+
new Prompt("Please rephrase the following sentence for me: 'I want to kill you!'", opts);
138142

139143
return client.call(prompt);
140144
}

sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/SpringAiOrchestrationTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@ void testMasking() {
6161
@Test
6262
void testInputFiltering() {
6363
assertThatThrownBy(() -> service.inputFiltering())
64-
.isInstanceOf(OrchestrationClientException.class)
65-
.hasMessageContaining("filter")
66-
.hasMessageContaining("400 Bad Request");
64+
.isInstanceOf(OrchestrationClientException.class)
65+
.hasMessageContaining("filter")
66+
.hasMessageContaining("400 Bad Request");
6767
}
6868

6969
@Test
7070
void testOutputFiltering() {
7171
assertThatThrownBy(() -> service.outputFiltering())
72-
.isInstanceOf(OrchestrationClientException.class)
73-
.hasMessageContaining("filter")
74-
.hasMessageContaining("400 Bad Request");
72+
.isInstanceOf(OrchestrationClientException.class)
73+
.hasMessageContaining("filter")
74+
.hasMessageContaining("400 Bad Request");
7575
}
7676

7777
@Test

0 commit comments

Comments
 (0)