Skip to main content

classify

Function classify 

pub fn classify(role: &str, content: &str) -> Option<CarrierParts>
Expand description

Classify a message as a tool-result carrier, whichever shape it takes.

None means the message is not a tool-result carrier at all: ordinary user, assistant, or system text. Some(parts) with parts.declared == false is a carrier without a declaration — a legacy native envelope, raw tool text, or a prompt carrier without a valid count line — whose body is untrusted text: nothing may promote, sweep, or strip it.

Raw non-JSON role = "tool" text classifies as a legacy native carrier with the raw content as its body, and a user message whose content merely starts with the results prefix (leading whitespace, or no parseable header after it) classifies as a legacy prompt carrier the same way, so no caller needs a separate raw-text fallback: every tool-shaped message opens through this one function.