File size: 768 Bytes
52da7b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
TOKENIZER_NAME = "FrameToken"

TOOL_PROTOCOL_TOKENS: tuple[str, ...] = (
    "<tool_call>",
    "<tool_result>",
    "<source>",
    "<final>",
)

REASONING_CONTROL_TOKENS: tuple[str, ...] = (
    "<reason>",
    "<plan>",
    "<reflect>",
    "<answer>",
    "<memory>",
    "<retrieve>",
    "<focus>",
    "<verify>",
    "<tool>",
    *TOOL_PROTOCOL_TOKENS,
)

REASONING_PROFILES: dict[str, tuple[str, ...]] = {
    "none": (),
    "deep": ("<reason>",),
    "memory": ("<memory>", "<retrieve>", "<focus>"),
    "tool": ("<tool>", "<retrieve>", "<tool_call>", "<verify>"),
}


def reasoning_prefix(mode: str) -> list[str]:
    if mode not in REASONING_PROFILES:
        raise ValueError(f"Unknown reasoning mode: {mode}")
    return list(REASONING_PROFILES[mode])