Skip to content

Commit 9778592

Browse files
fixed all tests
1 parent e6ea7bd commit 9778592

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

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

Lines changed: 10 additions & 13 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.model.UserChatMessage.RoleEnum.USER;
34
import static org.assertj.core.api.Assertions.assertThat;
45

56
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -130,9 +131,7 @@ void testConfigWithResponseSchema() {
130131
void testTemplateConstruction() {
131132
List<ChatMessage> templateMessages =
132133
List.of(
133-
UserChatMessage.create()
134-
.content(UserChatMessageContent.create("message"))
135-
.role(UserChatMessage.RoleEnum.USER));
134+
UserChatMessage.create().content(UserChatMessageContent.create("message")).role(USER));
136135
var defaults = Map.of("key", "value");
137136
var tools =
138137
List.of(
@@ -212,11 +211,10 @@ void testTemplateFromLocalFileWithJsonSchemaAndTools() throws IOException {
212211
SystemChatMessage.create()
213212
.role(RoleEnum.SYSTEM)
214213
.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)))
220218
.withDefaults(Map.of("word", "apple"))
221219
.withJsonSchemaResponse(
222220
ResponseJsonSchema.fromMap(schema, "translation-schema")
@@ -274,11 +272,10 @@ void testTemplateFromLocalFileWithJsonObject() throws IOException {
274272
SystemChatMessage.create()
275273
.role(RoleEnum.SYSTEM)
276274
.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)))
282279
.withDefaults(Map.of("word", "apple"))
283280
.withJsonResponse();
284281
assertThat(templateWithJsonObject).isEqualTo(expectedTemplateWithJsonObject);

orchestration/src/test/resources/toolCallsRequest2.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,43 @@
1010
"template": [
1111
{
1212
"role": "user",
13-
"content": [ {
14-
"type" : "text",
15-
"text" : "What is the weather in Potsdam and in Toulouse?"
16-
} ]
13+
"content": [
14+
{
15+
"type": "text",
16+
"text": "What is the weather in Potsdam and in Toulouse?"
17+
}
18+
]
1719
},
1820
{
1921
"role": "assistant",
20-
"content": "",
2122
"tool_calls": [
2223
{
24+
"id": "call_LOyP7EVdeqFlGEmVzmPdCVey",
25+
"type": "function",
2326
"function": {
2427
"name": "getCurrentWeather",
2528
"arguments": "{\"arg0\": {\"location\": \"Potsdam\", \"unit\": \"C\"}}"
26-
},
27-
"id": "call_LOyP7EVdeqFlGEmVzmPdCVey",
28-
"type": "function"
29+
}
2930
},
3031
{
32+
"id": "call_bwFjnXCfCO4N3f0bMtFMlNSg",
33+
"type": "function",
3134
"function": {
3235
"name": "getCurrentWeather",
3336
"arguments": "{\"arg0\": {\"location\": \"Toulouse\", \"unit\": \"C\"}}"
34-
},
35-
"id": "call_bwFjnXCfCO4N3f0bMtFMlNSg",
36-
"type": "function"
37+
}
3738
}
3839
]
3940
},
4041
{
4142
"role": "tool",
42-
"content": "{\"temp\":30.0,\"unit\":\"C\"}",
43-
"tool_call_id": "call_LOyP7EVdeqFlGEmVzmPdCVey"
43+
"tool_call_id": "call_LOyP7EVdeqFlGEmVzmPdCVey",
44+
"content": "{\"temp\":30.0,\"unit\":\"C\"}"
4445
},
4546
{
4647
"role": "tool",
47-
"content": "{\"temp\":30.0,\"unit\":\"C\"}",
48-
"tool_call_id": "call_bwFjnXCfCO4N3f0bMtFMlNSg"
48+
"tool_call_id": "call_bwFjnXCfCO4N3f0bMtFMlNSg",
49+
"content": "{\"temp\":30.0,\"unit\":\"C\"}"
4950
}
5051
],
5152
"defaults": {},

0 commit comments

Comments
 (0)