File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
main/java/com/sap/ai/sdk/orchestration
test/java/com/sap/ai/sdk/orchestration Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff 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 );
Original file line number Diff line number Diff 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": {
You can’t perform that action at this time.
0 commit comments