public String toPrompt(List<Message> messages) {

        final String systemMessages = messages.stream()
                .filter(message -> message.getMessageType() == MessageType.SYSTEM)
                .map(Message::getContent)
                .collect(Collectors.joining("\n"));

        final String userMessages = messages.stream()
                .filter(message -> message.getMessageType() == MessageType.USER
                        || message.getMessageType() == MessageType.ASSISTANT)
                .map(this::messageToString)
                .collect(Collectors.joining("\n"));

        return String.format("%s%n%n%s%n%s", systemMessages, userMessages, assistantPrompt).trim();
    }
@Test
	public void testUserMessageList() {
		List<Message> messages = List.of(new UserMessage("User message"));
		String expected = "User message";
		Assert.assertEquals(expected, converter.toPrompt(messages));
	}