llms think tags handling
frdel committed
Aug 29, 2025 at 19:55 UTC
c47553ac5bea23507c18acbd3bc9ace713cdbe61
1 file changed
+23
tests/chunk_parser_test.py
new
+23
@@ -0,0 +1,23 @@
1
+import sys, os
2
+
3
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
4
+import models
5
+
6
+ex1 = "<think>reasoning goes here</think>response goes here"
7
+ex2 = "<think>reasoning goes here</thi"
8
+
9
+
10
+def test_example(example: str):
11
+ res = models.ChatGenerationResult()
12
+ for i in range(len(example)):
13
+ char = example[i]
14
+ chunk = res.add_chunk({"response_delta": char, "reasoning_delta": ""})
15
+ print(i, ":", chunk)
16
+
17
+ print("output", res.output())
18
+
19
+
20
+if __name__ == "__main__":
21
+ # test_example(ex1)
22
+ test_example(ex2)
23
+
\ No newline at end of file