File size: 669 Bytes
700e896
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""GGUF client helpers — Qwen3 <think> stripping (no model load needed)."""

from __future__ import annotations

from models.llm import _strip_thinking


def test_strips_closed_think_block() -> None:
    assert _strip_thinking("<think>chain of thought</think>The answer.") == "The answer."


def test_strips_dangling_unclosed_think() -> None:
    # a truncated reasoning block (ran out of tokens) leaves only what precedes it
    assert _strip_thinking("Result line\n<think>reasoning that got cut") == "Result line"


def test_plain_text_is_untouched_but_trimmed() -> None:
    assert _strip_thinking("  Senior AI Engineer profile  ") == "Senior AI Engineer profile"