|
1 | 1 | package com.sap.ai.sdk.orchestration; |
2 | 2 |
|
| 3 | +import static com.sap.ai.sdk.orchestration.model.UserChatMessage.RoleEnum.USER; |
3 | 4 | import static org.assertj.core.api.Assertions.assertThat; |
4 | 5 |
|
5 | 6 | import com.fasterxml.jackson.annotation.JsonProperty; |
@@ -130,9 +131,7 @@ void testConfigWithResponseSchema() { |
130 | 131 | void testTemplateConstruction() { |
131 | 132 | List<ChatMessage> templateMessages = |
132 | 133 | List.of( |
133 | | - UserChatMessage.create() |
134 | | - .content(UserChatMessageContent.create("message")) |
135 | | - .role(UserChatMessage.RoleEnum.USER)); |
| 134 | + UserChatMessage.create().content(UserChatMessageContent.create("message")).role(USER)); |
136 | 135 | var defaults = Map.of("key", "value"); |
137 | 136 | var tools = |
138 | 137 | List.of( |
@@ -212,11 +211,10 @@ void testTemplateFromLocalFileWithJsonSchemaAndTools() throws IOException { |
212 | 211 | SystemChatMessage.create() |
213 | 212 | .role(RoleEnum.SYSTEM) |
214 | 213 | .content(ChatMessageContent.create("You are a language translator.")), |
215 | | - (ChatMessage) |
216 | | - UserChatMessage.create() |
217 | | - .content( |
218 | | - UserChatMessageContent.create( |
219 | | - "Whats {{ ?word }} in {{ ?language }}?")))) |
| 214 | + UserChatMessage.create() |
| 215 | + .content( |
| 216 | + UserChatMessageContent.create("Whats {{ ?word }} in {{ ?language }}?")) |
| 217 | + .role(USER))) |
220 | 218 | .withDefaults(Map.of("word", "apple")) |
221 | 219 | .withJsonSchemaResponse( |
222 | 220 | ResponseJsonSchema.fromMap(schema, "translation-schema") |
@@ -274,11 +272,10 @@ void testTemplateFromLocalFileWithJsonObject() throws IOException { |
274 | 272 | SystemChatMessage.create() |
275 | 273 | .role(RoleEnum.SYSTEM) |
276 | 274 | .content(ChatMessageContent.create("You are a language translator.")), |
277 | | - (ChatMessage) |
278 | | - UserChatMessage.create() |
279 | | - .content( |
280 | | - UserChatMessageContent.create( |
281 | | - "Whats {{ ?word }} in {{ ?language }}?")))) |
| 275 | + UserChatMessage.create() |
| 276 | + .content( |
| 277 | + UserChatMessageContent.create("Whats {{ ?word }} in {{ ?language }}?")) |
| 278 | + .role(USER))) |
282 | 279 | .withDefaults(Map.of("word", "apple")) |
283 | 280 | .withJsonResponse(); |
284 | 281 | assertThat(templateWithJsonObject).isEqualTo(expectedTemplateWithJsonObject); |
|
0 commit comments