Skip to content

Commit 763b745

Browse files
committed
Revert drive-by change
1 parent fdd3d31 commit 763b745

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClientException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ interface Input extends Filter {
241241
* @return the {@link AzureContentSafetyInput} object, or {@code null} if not available.
242242
*/
243243
@Nullable
244-
default AzureContentSafetyInput getAzureContentSafety() {
244+
default AzureContentSafetyInput getAzureContentSafetyInput() {
245245
return Optional.ofNullable(getFilterDetails().get("azure_content_safety"))
246246
.map(obj -> MAPPER.convertValue(obj, AzureContentSafetyInput.class))
247247
.orElse(null);
@@ -256,7 +256,7 @@ interface Output extends Filter {
256256
* @return the {@link AzureContentSafetyOutput} object, or {@code null} if not available.
257257
*/
258258
@Nullable
259-
default AzureContentSafetyOutput getAzureContentSafety() {
259+
default AzureContentSafetyOutput getAzureContentSafetyOutput() {
260260
return Optional.ofNullable(getFilterDetails().get("azure_content_safety"))
261261
.map(obj -> MAPPER.convertValue(obj, AzureContentSafetyOutput.class))
262262
.orElse(null);

orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationUnitTest.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,11 @@ void inputFilteringStrict() {
474474
.isEqualTo(
475475
"400 - Filtering Module - Input Filter: Prompt filtered due to safety violations. Please modify the prompt and try again.");
476476

477-
assertThat(e.getAzureContentSafety()).isNotNull();
478-
assertThat(e.getAzureContentSafety().getHate()).isEqualTo(NUMBER_6);
479-
assertThat(e.getAzureContentSafety().getSelfHarm()).isEqualTo(NUMBER_0);
480-
assertThat(e.getAzureContentSafety().getSexual()).isEqualTo(NUMBER_0);
481-
assertThat(e.getAzureContentSafety().getViolence()).isEqualTo(NUMBER_6);
477+
assertThat(e.getAzureContentSafetyInput()).isNotNull();
478+
assertThat(e.getAzureContentSafetyInput().getHate()).isEqualTo(NUMBER_6);
479+
assertThat(e.getAzureContentSafetyInput().getSelfHarm()).isEqualTo(NUMBER_0);
480+
assertThat(e.getAzureContentSafetyInput().getSexual()).isEqualTo(NUMBER_0);
481+
assertThat(e.getAzureContentSafetyInput().getViolence()).isEqualTo(NUMBER_6);
482482

483483
assertThat(e.getLlamaGuard38b()).isNotNull();
484484
assertThat(e.getLlamaGuard38b().isViolentCrimes()).isTrue();
@@ -520,11 +520,11 @@ void outputFilteringStrict() {
520520
Map.of("violent_crimes", true)));
521521
assertThat(e.getErrorResponse()).isNull();
522522

523-
assertThat(e.getAzureContentSafety()).isNotNull();
524-
assertThat(e.getAzureContentSafety().getHate()).isEqualTo(NUMBER_6);
525-
assertThat(e.getAzureContentSafety().getSelfHarm()).isEqualTo(NUMBER_0);
526-
assertThat(e.getAzureContentSafety().getSexual()).isEqualTo(NUMBER_0);
527-
assertThat(e.getAzureContentSafety().getViolence()).isEqualTo(NUMBER_6);
523+
assertThat(e.getAzureContentSafetyOutput()).isNotNull();
524+
assertThat(e.getAzureContentSafetyOutput().getHate()).isEqualTo(NUMBER_6);
525+
assertThat(e.getAzureContentSafetyOutput().getSelfHarm()).isEqualTo(NUMBER_0);
526+
assertThat(e.getAzureContentSafetyOutput().getSexual()).isEqualTo(NUMBER_0);
527+
assertThat(e.getAzureContentSafetyOutput().getViolence()).isEqualTo(NUMBER_6);
528528

529529
assertThat(e.getLlamaGuard38b()).isNotNull();
530530
assertThat(e.getLlamaGuard38b().isViolentCrimes()).isTrue();
@@ -796,11 +796,11 @@ void streamChatCompletionOutputFilterErrorHandling() throws IOException {
796796
"azure_content_safety",
797797
Map.of("Hate", 0, "SelfHarm", 0, "Sexual", 0, "Violence", 4)));
798798

799-
assertThat(e.getAzureContentSafety()).isNotNull();
800-
assertThat(e.getAzureContentSafety().getHate()).isEqualTo(NUMBER_0);
801-
assertThat(e.getAzureContentSafety().getSelfHarm()).isEqualTo(NUMBER_0);
802-
assertThat(e.getAzureContentSafety().getSexual()).isEqualTo(NUMBER_0);
803-
assertThat(e.getAzureContentSafety().getViolence()).isEqualTo(NUMBER_4);
799+
assertThat(e.getAzureContentSafetyOutput()).isNotNull();
800+
assertThat(e.getAzureContentSafetyOutput().getHate()).isEqualTo(NUMBER_0);
801+
assertThat(e.getAzureContentSafetyOutput().getSelfHarm()).isEqualTo(NUMBER_0);
802+
assertThat(e.getAzureContentSafetyOutput().getSexual()).isEqualTo(NUMBER_0);
803+
assertThat(e.getAzureContentSafetyOutput().getViolence()).isEqualTo(NUMBER_4);
804804
});
805805
}
806806

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Object inputFiltering(
133133
"[Http %d] Failed to obtain a response as the content was flagged by input filter. "
134134
.formatted(e.getStatusCode()));
135135

136-
Optional.ofNullable(e.getAzureContentSafety())
136+
Optional.ofNullable(e.getAzureContentSafetyInput())
137137
.map(AzureContentSafetyInput::getViolence)
138138
.filter(rating -> rating.compareTo(policy.getAzureThreshold()) > 0)
139139
.ifPresent(rating -> msg.append("Violence score %d".formatted(rating.getValue())));
@@ -164,7 +164,7 @@ Object outputFiltering(
164164
new StringBuilder(
165165
"Failed to obtain a response as the content was flagged by output filter. ");
166166

167-
Optional.ofNullable(e.getAzureContentSafety())
167+
Optional.ofNullable(e.getAzureContentSafetyOutput())
168168
.map(AzureContentSafetyOutput::getViolence)
169169
.filter(rating -> rating.compareTo(policy.getAzureThreshold()) > 0)
170170
.ifPresent(rating -> msg.append("Violence score %d ".formatted(rating.getValue())));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ void testInputFilteringStrict() {
222222
.isInstanceOfSatisfying(
223223
OrchestrationClientException.Synchronous.InputFilter.class,
224224
e -> {
225-
var actualAzureContentSafety = e.getAzureContentSafety();
225+
var actualAzureContentSafety = e.getAzureContentSafetyInput();
226226
assertThat(actualAzureContentSafety).isNotNull();
227227
assertThat(actualAzureContentSafety.getViolence()).isGreaterThan(NUMBER_0);
228228
assertThat(actualAzureContentSafety.getSelfHarm()).isEqualTo(NUMBER_0);
@@ -254,7 +254,7 @@ void testOutputFilteringStrict() {
254254
.isInstanceOfSatisfying(
255255
OrchestrationClientException.Synchronous.OutputFilter.class,
256256
e -> {
257-
var actualAzureContentSafety = e.getAzureContentSafety();
257+
var actualAzureContentSafety = e.getAzureContentSafetyOutput();
258258
assertThat(actualAzureContentSafety).isNotNull();
259259
assertThat(actualAzureContentSafety.getViolence()).isGreaterThan(NUMBER_0);
260260
assertThat(actualAzureContentSafety.getSelfHarm()).isEqualTo(NUMBER_0);

0 commit comments

Comments
 (0)