Skip to content

Commit

Permalink
PromptTemplates can create messages
Browse files Browse the repository at this point in the history
  • Loading branch information
markpollack committed Aug 18, 2023
1 parent f3840e3 commit 236393e
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,30 @@

package org.springframework.ai.prompt;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.Map;

import org.springframework.ai.prompt.messages.SystemMessage;
import org.springframework.core.io.Resource;
import org.springframework.util.StreamUtils;
import org.stringtemplate.v4.ST;

public class SystemPromptTemplate extends PromptTemplate {

public SystemPromptTemplate(String template) {
super(template);
}

public SystemPromptTemplate(Resource resource) {
super(resource);
}

public SystemMessage createMessage(Map<String, Object> model) {
return new SystemMessage(render(model));
}

@Override
public Prompt create() {
return new Prompt(new SystemMessage(render()));
Expand Down

0 comments on commit 236393e

Please sign in to comment.