Skip to content

Commit 5348549

Browse files
Merge main
1 parent 90bf752 commit 5348549

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClient.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,10 @@ public OrchestrationChatResponse executeRequestFromJsonModuleConfig(
168168
"Prompt must not contain any messages when using a JSON module configuration, as the template is already defined in the JSON.");
169169
}
170170

171-
final var request =
172-
new CompletionPostRequest()
173-
.messagesHistory(prompt.getMessagesHistory())
174-
.inputParams(prompt.getTemplateParameters());
171+
final ObjectNode requestJson = JACKSON.createObjectNode();
172+
requestJson.set("messages_history", JACKSON.valueToTree(prompt.getMessagesHistory()));
173+
requestJson.set("input_params", JACKSON.valueToTree(prompt.getTemplateParameters()));
175174

176-
final ObjectNode requestJson = JACKSON.valueToTree(request);
177175
final JsonNode moduleConfigJson;
178176
try {
179177
moduleConfigJson = JACKSON.readTree(moduleConfig);

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,9 @@ void testErrorHandling() {
386386
void testExecuteRequestFromJson() {
387387
stubFor(post(anyUrl()).willReturn(okJson("{}")));
388388

389-
prompt = new OrchestrationPrompt(Map.of());
389+
prompt =
390+
new OrchestrationPrompt(Map.of("foo", "bar"))
391+
.messageHistory(List.of(ChatMessage.create().role("user").content("Hello World!")));
390392
final var configJson =
391393
"""
392394
{
@@ -402,8 +404,13 @@ void testExecuteRequestFromJson() {
402404
final var expectedJson =
403405
"""
404406
{
405-
"messages_history": [],
406-
"input_params": {},
407+
"messages_history": [{
408+
"role" : "user",
409+
"content" : "Hello World!"
410+
}],
411+
"input_params": {
412+
"foo" : "bar"
413+
},
407414
"orchestration_config": {
408415
"module_configurations": {
409416
"llm_module_config": {

0 commit comments

Comments
 (0)