parseThinkContent
Parses `<think>...</think>` blocks from model output into structured content.
Returns a list containing:
Content.Reasoning for each non-blank think block.
Content.Text for the remaining output text (after removing think blocks).
Return
A list of Content.Response items (reasoning + text).
Samples
// Get reasoning and output from text(If text is <think>I need to answer</think> Hello..."
val modelFullOutput = "<think>I need to answer</think> Hello..."
val thinkAndOutput =
modelFullOutput.parseThinkContent() // Returns the List<Content.Response>(Ex: listOf(Content.Reasoning("I need to answer"), Content.Text("Hello...")
for (content in thinkAndOutput) {
when (content) {
is Content.Text -> {
println("Output: $content")
}
is Content.Reasoning -> {
println("Reasoning: $content")
}
else -> { /* Function returns only Content.Text and/or Content.Reasoning. */
}
}
}Content copied to clipboard