renderAsMessages

fun renderAsMessages(demonstrations: List<Demonstration>, format: DemonstrationFormat): List<Message>

Renders a list of demonstrations as individual messages for conversation history insertion.

Used with FewShotPromptType.AS_MESSAGE_HISTORY to produce user/assistant message pairs. System messages from intermediate traces are remapped to user messages to prevent system messages from appearing in the middle of the conversation.

Return

A list of messages ready for prompt insertion, empty if no demonstrations.

Parameters

demonstrations

The demonstrations to render.

format

Whether to include intermediate traces or only input/output.