Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ static PromptTemplatingModuleConfigPrompt toTemplateModuleConfig(
* To be fixed with https://github.tools.sap/AI/llm-orchestration/issues/662
*/
if (config instanceof TemplateRef) {
if (!prompt.getMessages().isEmpty()) {
throw new IllegalArgumentException(
"Prompt must not contain messages when using a template reference");
}
return config;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ void testThrowsOnMissingMessages() {
.hasMessageContaining("A prompt is required");
}

@Test
void testThrowsOnTemplateRefWithMessages() {
var prompt = new OrchestrationPrompt("Foo bar");
var templateRef =
TemplateConfig.reference().byId("21cb1358-0bf1-4f43-870b-00f14d0f9f16").toLowLevel();

assertThatThrownBy(() -> ConfigToRequestTransformer.toTemplateModuleConfig(prompt, templateRef))
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("Prompt must not contain messages when using a template reference");
}

@Test
void testEmptyTemplateConfig() {
var systemMessage = new SystemMessage("foo");
Expand Down