|
5 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; |
6 | 6 | import com.sap.ai.sdk.orchestration.model.ChatCompletionTool; |
7 | 7 | import com.sap.ai.sdk.orchestration.model.ChatMessage; |
| 8 | +import com.sap.ai.sdk.orchestration.model.ChatMessageContent; |
8 | 9 | import com.sap.ai.sdk.orchestration.model.FunctionObject; |
9 | 10 | import com.sap.ai.sdk.orchestration.model.ResponseFormatJsonObject; |
10 | 11 | import com.sap.ai.sdk.orchestration.model.ResponseFormatJsonSchema; |
11 | 12 | import com.sap.ai.sdk.orchestration.model.ResponseFormatJsonSchemaJsonSchema; |
| 13 | +import com.sap.ai.sdk.orchestration.model.SystemChatMessage; |
| 14 | +import com.sap.ai.sdk.orchestration.model.SystemChatMessage.RoleEnum; |
12 | 15 | import com.sap.ai.sdk.orchestration.model.Template; |
13 | 16 | import com.sap.ai.sdk.orchestration.model.TemplateRef; |
14 | 17 | import com.sap.ai.sdk.orchestration.model.TemplateRefByID; |
@@ -206,12 +209,14 @@ void testTemplateFromLocalFileWithJsonSchemaAndTools() throws IOException { |
206 | 209 | OrchestrationTemplate.create() |
207 | 210 | .withTemplate( |
208 | 211 | List.of( |
209 | | - SingleChatMessage.create() |
210 | | - .role("system") |
211 | | - .content("You are a language translator."), |
212 | | - SingleChatMessage.create() |
213 | | - .role("user") |
214 | | - .content("Whats {{ ?word }} in {{ ?language }}?"))) |
| 212 | + SystemChatMessage.create() |
| 213 | + .role(RoleEnum.SYSTEM) |
| 214 | + .content(ChatMessageContent.create("You are a language translator.")), |
| 215 | + (ChatMessage) |
| 216 | + UserChatMessage.create() |
| 217 | + .content( |
| 218 | + UserChatMessageContent.create( |
| 219 | + "Whats {{ ?word }} in {{ ?language }}?")))) |
215 | 220 | .withDefaults(Map.of("word", "apple")) |
216 | 221 | .withJsonSchemaResponse( |
217 | 222 | ResponseJsonSchema.fromMap(schema, "translation-schema") |
@@ -266,12 +271,14 @@ void testTemplateFromLocalFileWithJsonObject() throws IOException { |
266 | 271 | OrchestrationTemplate.create() |
267 | 272 | .withTemplate( |
268 | 273 | List.of( |
269 | | - SingleChatMessage.create() |
270 | | - .role("system") |
271 | | - .content("You are a language translator."), |
272 | | - SingleChatMessage.create() |
273 | | - .role("user") |
274 | | - .content("Whats {{ ?word }} in {{ ?language }}?"))) |
| 274 | + SystemChatMessage.create() |
| 275 | + .role(RoleEnum.SYSTEM) |
| 276 | + .content(ChatMessageContent.create("You are a language translator.")), |
| 277 | + (ChatMessage) |
| 278 | + UserChatMessage.create() |
| 279 | + .content( |
| 280 | + UserChatMessageContent.create( |
| 281 | + "Whats {{ ?word }} in {{ ?language }}?")))) |
275 | 282 | .withDefaults(Map.of("word", "apple")) |
276 | 283 | .withJsonResponse(); |
277 | 284 | assertThat(templateWithJsonObject).isEqualTo(expectedTemplateWithJsonObject); |
|
0 commit comments