pub fn split_system_prompt(
messages: &[ChatMessage],
) -> (&[ChatMessage], &[ChatMessage])Expand description
Split a message slice into (system_messages, rest).
Takes all leading contiguous System messages (supporting multi-message
system prompts) and returns them separately from the remaining conversation
messages. This is the recommended way to peel off the system prompt before
compressing the conversation body.
§Examples
ⓘ
let (sys, body) = split_system_prompt(&messages);
// sys = [System("You are ..."), System("Extra instructions")]
// body = [User("hi"), Assistant("hello"), ...]