Class AssistantTextSanitizer
java.lang.Object
smile.llm.tool.AssistantTextSanitizer
Strips chat-template / tool / thinking markup from assistant text so API
and streaming clients never see role specials or raw tool XML mixed into
visible content.
-
Method Summary
-
Method Details
-
sanitize
Cleans assistant-visible text for API / SSE content fields.Removes thinking spans, tool-call / tool-response blocks, and chat specials. When an open
<think>was part of the prompt (so the completion only has a closing tag), keeps the text after the last</think>.- Parameters:
text- raw decoded generation; may benull.- Returns:
- cleaned text, or
nullwhen empty after cleaning.
-
stripToolCalls
-