prepareMessagesForFewShot

fun Prompt.prepareMessagesForFewShot(): List<Message>

Prepares demonstration messages for injection into a few-shot prompt:

  • System messages are converted to User messages (no System messages in the middle of the conversation history)

  • All messages have their metadata stripped (training-run timestamps, token counts, and other metadata have no place in the evaluation prompt)

  • Orphaned Tool.Call messages (those without a matching Tool.Result) are removed, since LLM providers require every tool_call to have a corresponding tool response