Skip to content

Commit f1deedb

Browse files
committed
fix e2e tests
1 parent 2b4e668 commit f1deedb

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,12 +443,14 @@ public record Translation(
443443
@Nonnull
444444
public OrchestrationChatResponse responseFormatJsonSchema(
445445
@Nonnull final String word, @Nonnull final Class<?> targetType) {
446+
final var configWithGpt4 =
447+
new OrchestrationModuleConfig().withLlmConfig(GPT_4O_MINI);
446448
val schema =
447449
ResponseJsonSchema.fromType(targetType)
448450
.withDescription("Output schema for language translation.")
449451
.withStrict(true);
450452
val configWithResponseSchema =
451-
config.withTemplateConfig(TemplateConfig.create().withJsonSchemaResponse(schema));
453+
configWithGpt4.withTemplateConfig(TemplateConfig.create().withJsonSchemaResponse(schema));
452454

453455
val prompt =
454456
new OrchestrationPrompt(
@@ -564,8 +566,10 @@ public OrchestrationChatResponse templateFromPromptRegistryByScenario(
564566
@Nonnull
565567
public OrchestrationChatResponse localPromptTemplate(@Nonnull final String promptTemplate)
566568
throws IOException {
569+
final var configWithGpt4 =
570+
new OrchestrationModuleConfig().withLlmConfig(GPT_4O_MINI);
567571
val template = TemplateConfig.create().fromYaml(promptTemplate);
568-
val configWithTemplate = template != null ? config.withTemplateConfig(template) : config;
572+
val configWithTemplate = template != null ? configWithGpt4.withTemplateConfig(template) : configWithGpt4;
569573

570574
val inputParams = Map.of("language", "German");
571575
val prompt = new OrchestrationPrompt(inputParams);

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

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
import com.sap.ai.sdk.orchestration.OrchestrationAiModel;
99
import java.lang.reflect.Field;
1010
import java.util.HashMap;
11+
import java.util.HashSet;
1112
import java.util.Optional;
13+
import java.util.Set;
14+
1215
import lombok.SneakyThrows;
1316
import org.assertj.core.api.SoftAssertions;
1417
import org.junit.jupiter.api.DisplayName;
@@ -95,19 +98,27 @@ void orchestrationAiModelAvailability() {
9598
}
9699
}
97100

101+
// Set of internal-only models
102+
var internalOnlyModels = Set.of("abap-codestral");
103+
98104
// Assert that the declared Orchestration models match the expected list
99-
assertThat(declaredOrchestrationModelList.keySet())
105+
var declaredAndInternalOnlyModels = new HashSet<>(declaredOrchestrationModelList.keySet());
106+
declaredAndInternalOnlyModels.addAll(internalOnlyModels);
107+
108+
assertThat(declaredAndInternalOnlyModels)
100109
.containsAll(availableOrchestrationModels.keySet());
101110

102111
SoftAssertions softly = new SoftAssertions();
103112
for (var model : availableOrchestrationModels.entrySet()) {
104113
Boolean declaredDeprecated = declaredOrchestrationModelList.get(model.getKey());
105-
softly
106-
.assertThat(declaredDeprecated)
107-
.withFailMessage(
108-
"%s is deprecated:%s on AI Core but deprecated:%s in AI SDK",
109-
model.getKey(), model.getValue(), declaredDeprecated)
110-
.isEqualTo(model.getValue());
114+
if (!internalOnlyModels.contains(model.getKey())) {
115+
softly
116+
.assertThat(declaredDeprecated)
117+
.withFailMessage(
118+
"%s is deprecated:%s on AI Core but deprecated:%s in AI SDK",
119+
model.getKey(), model.getValue(), declaredDeprecated)
120+
.isEqualTo(model.getValue());
121+
}
111122
}
112123
softly.assertAll();
113124
}

0 commit comments

Comments
 (0)