Skip to main content

sanitize_for_vlm

Function sanitize_for_vlm 

Source
pub fn sanitize_for_vlm(history: &[Message]) -> Vec<Message>
Expand description

Filter history to a form OpenAI-compatible endpoints accept: every tool message must be preceded by an assistant whose tool_calls lists its tool_call_id. Orphans (e.g. left over from a trim that dropped the assistant) are quietly removed.