Skip to content

Commit d08f7a4

Browse files
committed
Initial
1 parent 75a8683 commit d08f7a4

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,30 @@ static TemplatingModuleConfig toTemplateModuleConfig(
5151
if (config instanceof TemplateRef) {
5252
return config;
5353
}
54+
5455
val template = config instanceof Template t ? t : Template.create().template();
5556
val messages = template.getTemplate();
5657
val responseFormat = template.getResponseFormat();
5758
val messagesWithPrompt = new ArrayList<>(messages);
59+
5860
messagesWithPrompt.addAll(
5961
prompt.getMessages().stream().map(Message::createChatMessage).toList());
6062
if (messagesWithPrompt.isEmpty()) {
6163
throw new IllegalStateException(
6264
"A prompt is required. Pass at least one message or configure a template with messages or a template reference.");
6365
}
64-
return Template.create()
65-
.template(messagesWithPrompt)
66-
.tools(template.getTools())
67-
.responseFormat(responseFormat);
66+
67+
val result =
68+
Template.create()
69+
.template(messagesWithPrompt)
70+
.tools(template.getTools())
71+
.defaults(template.getDefaults())
72+
.responseFormat(responseFormat);
73+
74+
for (val customFieldName : template.getCustomFieldNames()) {
75+
result.setCustomField(customFieldName, template.getCustomField(customFieldName));
76+
}
77+
return result;
6878
}
6979

7080
@Nonnull

0 commit comments

Comments
 (0)