"""Remove <think>...</think> tags from LLM responses."""

import re


def strip_think_tags(text: str) -> str:
    """Remove <think>...</think> tags from LLM responses.

    Some models (MiniMax, DeepSeek) include chain-of-thought blocks wrapped in
    <think> tags as part of their output. This function strips those blocks so
    that downstream code only sees the final answer.

    Args:
        text: Raw LLM response that may contain <think>...</think> blocks.

    Returns:
        Text with all <think>...</think> blocks removed and outer whitespace
        stripped.
    """
    return re.sub(r'<think>[\s\S]*?</think>', '', text).strip()
