Skip to content

Commit

Permalink
Extend the PromptTemplate to support Message media content (#492)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzolov authored Mar 21, 2024
1 parent 834d2d0 commit 5a44f85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.antlr.runtime.Token;
import org.antlr.runtime.TokenStream;
import org.springframework.ai.parser.OutputParser;
import org.springframework.ai.chat.messages.Media;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.UserMessage;
import org.springframework.core.io.Resource;
Expand Down Expand Up @@ -173,6 +174,11 @@ public Message createMessage() {
return new UserMessage(render());
}

@Override
public Message createMessage(List<Media> mediaList) {
return new UserMessage(render(), mediaList);
}

@Override
public Message createMessage(Map<String, Object> model) {
return new UserMessage(render(model));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@
*/
package org.springframework.ai.chat.prompt;

import org.springframework.ai.chat.messages.Media;
import org.springframework.ai.chat.messages.Message;

import java.util.List;
import java.util.Map;

public interface PromptTemplateMessageActions {

Message createMessage();

Message createMessage(List<Media> mediaList);

Message createMessage(Map<String, Object> model);

}

0 comments on commit 5a44f85

Please sign in to comment.