pub fn parse_thinking_tokens(response: &str) -> (Option<String>, String)Expand description
Parse thinking/reasoning tokens from model response
Extracts content between <think> and </think> tags as reasoning,
and returns the content after </think> as the main response.
§Arguments
response- Raw model response that may contain thinking tokens
§Returns
A tuple of (reasoning, content) where:
reasoningis Some(String) if thinking tags were found, None otherwisecontentis the text after</think>, or the full response if no tags present
§Example
use spec_ai_core::agent::model::parse_thinking_tokens;
let response = "<think>Let me consider this...</think>Here's my answer.";
let (reasoning, content) = parse_thinking_tokens(response);
assert_eq!(reasoning, Some("Let me consider this...".to_string()));
assert_eq!(content, "Here's my answer.");