Skip to content

Commit 085f48b

Browse files
authored
fix: Fix E2E Tests (#689)
* add gpt-realtime model * Filtering module changed messages * exception type changed
1 parent 7f4f64d commit 085f48b

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

docs/release_notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
### ✨ New Functionality
1414

15-
- [Orchestration] Added new models for `OrchestrationAiModel`: `SONAR`,`SONAR_PRO`, `GEMINI_2_5_FLASH_LITE`, `CLAUDE_4_5_HAIKU`.
15+
- [Orchestration] Added new models for `OrchestrationAiModel`: `SONAR`,`SONAR_PRO`, `GEMINI_2_5_FLASH_LITE`, `CLAUDE_4_5_HAIKU`, `GPT_REALTIME`.
1616
- [Orchestration] Convenience for adding the `metadata_params` option to grounding calls.
1717
- [Orchestration] Added new models for `OrchestrationAiModel`: `COHERE_COMMAND_A_REASONING`, `NOVA_PREMIER`, `COHERE_RERANKER`.
1818
- [Orchestration] Deprecated `DEEPSEEK_R1` model from `OrchestrationAiModel` with no replacement.

foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiModel.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ public record OpenAiModel(@Nonnull String name, @Nullable String version) implem
104104
/** Azure OpenAI GPT-5-nano model */
105105
public static final OpenAiModel GPT_5_NANO = new OpenAiModel("gpt-5-nano", null);
106106

107+
/** Azure OpenAI GPT-5-nano model */
108+
public static final OpenAiModel GPT_REALTIME = new OpenAiModel("gpt-realtime", null);
109+
107110
/**
108111
* Azure OpenAI Text Embedding ADA 002 model
109112
*

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
@@ -43,7 +43,7 @@ static Map<String, Object> extractInputFilterDetails(@Nullable final Orchestrati
4343
.flatMap(OrchestrationClientException::lastError)
4444
.map(Error::getIntermediateResults)
4545
.map(ModuleResults::getInputFiltering)
46-
.filter(filter -> !filter.getMessage().equals("Input Filter passed successfully."))
46+
.filter(filter -> !filter.getMessage().equals("Filtering passed successfully. "))
4747
.map(GenericModuleResult::getData)
4848
.map(map -> (Map<String, Object>) map)
4949
.orElseGet(Collections::emptyMap);
@@ -53,7 +53,7 @@ static Map<String, Object> extractInputFilterDetails(@Nullable final Orchestrati
5353
.flatMap(OrchestrationClientException::lastErrorStreaming)
5454
.map(ErrorStreaming::getIntermediateResults)
5555
.map(ModuleResultsStreaming::getInputFiltering)
56-
.filter(filter -> !filter.getMessage().equals("Input Filter passed successfully."))
56+
.filter(filter -> !filter.getMessage().equals("Filtering passed successfully. "))
5757
.map(GenericModuleResult::getData)
5858
.filter(Map.class::isInstance)
5959
.map(map -> (Map<String, Object>) map)

orchestration/src/test/resources/__files/errorResponse.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"location": "request body",
77
"intermediate_results": {
88
"input_filtering": {
9-
"message": "Input Filter passed successfully.",
9+
"message": "Filtering passed successfully. ",
1010
"data": {
1111
"azure_content_safety": {
1212
"userPromptAnalysis": {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void testInputFilteringStrict() {
243243

244244
assertThatThrownBy(() -> service.inputFiltering(policy))
245245
.hasMessageContaining(
246-
"Prompt filtered due to safety violations. Please modify the prompt and try again.")
246+
"Content filtered due to safety violations. Please modify the prompt and try again.")
247247
.hasMessageContaining("400 (Bad Request)")
248248
.isInstanceOfSatisfying(
249249
OrchestrationFilterException.Input.class,
@@ -299,15 +299,15 @@ void testOutputFilteringLenient() {
299299
assertThat(response.getContent()).isNotEmpty();
300300

301301
var filterResult = response.getOriginalResponse().getIntermediateResults().getOutputFiltering();
302-
assertThat(filterResult.getMessage()).containsPattern("Choice 0: Output Filter was skipped");
302+
assertThat(filterResult.getMessage()).containsPattern("Choice 0: Filtering was skipped.");
303303
}
304304

305305
@Test
306306
void testLlamaGuardEnabled() {
307307
assertThatThrownBy(() -> service.llamaGuardInputFilter(true))
308308
.isInstanceOf(OrchestrationFilterException.Input.class)
309309
.hasMessageContaining(
310-
"Prompt filtered due to safety violations. Please modify the prompt and try again.")
310+
"Content filtered due to safety violations. Please modify the prompt and try again.")
311311
.hasMessageContaining("400 (Bad Request)")
312312
.isInstanceOfSatisfying(
313313
OrchestrationFilterException.Input.class,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void testInputFilteringStrict() {
6767
assertThatThrownBy(() -> service.inputFiltering(policy))
6868
.isInstanceOf(OrchestrationClientException.class)
6969
.hasMessageContaining(
70-
"Prompt filtered due to safety violations. Please modify the prompt and try again.")
70+
"Content filtered due to safety violations. Please modify the prompt and try again.")
7171
.hasMessageContaining("400 (Bad Request)");
7272
}
7373

@@ -105,7 +105,7 @@ void testOutputFilteringStrict() {
105105
.getIntermediateResults()
106106
.getOutputFiltering();
107107
assertThat(filterResult.getMessage())
108-
.contains("Choice 0: LLM response filtered due to safety violations");
108+
.contains("Choice 0: Content filtered due to safety violations.");
109109
}
110110

111111
@Test
@@ -123,7 +123,7 @@ void testOutputFilteringLenient() {
123123
.getOriginalResponse()
124124
.getIntermediateResults()
125125
.getOutputFiltering();
126-
assertThat(filterResult.getMessage()).contains("Choice 0: Output Filter was skipped");
126+
assertThat(filterResult.getMessage()).contains("Choice 0: Filtering was skipped.");
127127
}
128128

129129
@Test

0 commit comments

Comments
 (0)