Skip to content

Commit ad61dc5

Browse files
Drive by tests
1 parent 55024da commit ad61dc5

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.sap.ai.sdk.orchestration;
22

3+
import static com.sap.ai.sdk.orchestration.OrchestrationAiModel.GPT_4O;
34
import static com.sap.ai.sdk.orchestration.OrchestrationUnitTest.CUSTOM_GPT_35;
45
import static org.assertj.core.api.Assertions.assertThat;
56
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -101,4 +102,26 @@ void testDpiMaskingConfig() {
101102
.withFailMessage("withMaskingConfig() should overwrite the existing config and not append")
102103
.hasSize(1);
103104
}
105+
106+
@Test
107+
void testLLMConfig() {
108+
Map<String, Object> params = Map.of("foo", "bar");
109+
String version = "2024-05-13";
110+
OrchestrationAiModel aiModel = GPT_4O.withModelParams(params).withModelVersion(version);
111+
var config = new OrchestrationModuleConfig().withLlmConfig(aiModel);
112+
113+
var actual = ConfigToRequestTransformer.toModuleConfigs(config);
114+
115+
assertThat(actual.getLlmModuleConfig()).isNotNull();
116+
assertThat(actual.getLlmModuleConfig().getModelName()).isEqualTo(GPT_4O.getModelName());
117+
assertThat(actual.getLlmModuleConfig().getModelParams()).isEqualTo(params);
118+
assertThat(actual.getLlmModuleConfig().getModelVersion()).isEqualTo(version);
119+
120+
assertThat(GPT_4O.getModelParams())
121+
.withFailMessage("Static models should be unchanged")
122+
.isEmpty();
123+
assertThat(GPT_4O.getModelVersion())
124+
.withFailMessage("Static models should be unchanged")
125+
.isEqualTo("latest");
126+
}
104127
}

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@
7676
<enforcer.skipEnforceScopeLombok>false</enforcer.skipEnforceScopeLombok>
7777
<enforcer.skipBanGeneratedModulesReference>false</enforcer.skipBanGeneratedModulesReference>
7878
<!-- Test coverage -->
79-
<coverage.instruction>74%</coverage.instruction>
79+
<coverage.instruction>75%</coverage.instruction>
8080
<coverage.branch>67%</coverage.branch>
81-
<coverage.complexity>67%</coverage.complexity>
82-
<coverage.line>75%</coverage.line>
83-
<coverage.method>80%</coverage.method>
81+
<coverage.complexity>69%</coverage.complexity>
82+
<coverage.line>76%</coverage.line>
83+
<coverage.method>85%</coverage.method>
8484
<coverage.class>85%</coverage.class>
8585
</properties>
8686

0 commit comments

Comments
 (0)