@@ -1446,7 +1446,6 @@ static void test_template_output_parsers() {
1446
1446
auto tmpls = read_templates (" models/templates/openai-gpt-oss-120b.jinja" );
1447
1447
std::vector<std::string> end_tokens{ " <|return|>" };
1448
1448
1449
- // Test parsing content with thinking
1450
1449
assert_msg_equals (message_assist_empty,
1451
1450
common_chat_parse (
1452
1451
" <|channel|>" ,
@@ -1744,6 +1743,89 @@ static void test_template_output_parsers() {
1744
1743
/* .format = */ COMMON_CHAT_FORMAT_GPT_OSS,
1745
1744
/* .reasoning_format = */ COMMON_REASONING_FORMAT_AUTO,
1746
1745
}));
1746
+
1747
+ // Test parse_tool_calls == false
1748
+ assert_msg_equals (
1749
+ simple_assist_msg (" Hello, world!\n What's up?" , " I'm\n thinking" ),
1750
+ common_chat_parse (
1751
+ " <|channel|>analysis<|message|>I'm\n thinking<|end|>"
1752
+ " <|start|>assistant<|channel|>final<|message|>Hello, world!\n What's up?" ,
1753
+ /* is_partial= */ true ,
1754
+ {
1755
+ /* .format = */ COMMON_CHAT_FORMAT_GPT_OSS,
1756
+ /* .reasoning_format = */ COMMON_REASONING_FORMAT_AUTO,
1757
+ /* .reasoning_in_content = */ false ,
1758
+ /* .thinking_forced_open = */ false ,
1759
+ /* .parse_tool_calls = */ false ,
1760
+ }));
1761
+ assert_msg_equals (
1762
+ simple_assist_msg (
1763
+ " <|start|>assistant<|channel|>commentary to=functions.special_function <|message|>{\" arg1" ,
1764
+ " I'm\n thinking" ),
1765
+ common_chat_parse (
1766
+ " <|channel|>analysis<|message|>I'm\n thinking<|end|>"
1767
+ " <|start|>assistant<|channel|>commentary to=functions.special_function <|message|>{\" arg1" ,
1768
+ /* is_partial= */ true ,
1769
+ {
1770
+ /* .format = */ COMMON_CHAT_FORMAT_GPT_OSS,
1771
+ /* .reasoning_format = */ COMMON_REASONING_FORMAT_AUTO,
1772
+ /* .reasoning_in_content = */ false ,
1773
+ /* .thinking_forced_open = */ false ,
1774
+ /* .parse_tool_calls = */ false ,
1775
+ }));
1776
+ assert_msg_equals (
1777
+ simple_assist_msg (
1778
+ " <|start|>assistant<|channel|>commentary to=functions.special_function <|constrain|>json<|message|>{\" arg1\" : 1}" ,
1779
+ " I'm\n thinking" ),
1780
+ common_chat_parse (
1781
+ " <|channel|>analysis<|message|>I'm\n thinking<|end|>"
1782
+ " <|start|>assistant<|channel|>commentary to=functions.special_function <|constrain|>json<|message|>{\" arg1\" : 1}" ,
1783
+ /* is_partial= */ false ,
1784
+ {
1785
+ /* .format = */ COMMON_CHAT_FORMAT_GPT_OSS,
1786
+ /* .reasoning_format = */ COMMON_REASONING_FORMAT_AUTO,
1787
+ /* .reasoning_in_content = */ false ,
1788
+ /* .thinking_forced_open = */ false ,
1789
+ /* .parse_tool_calls = */ false ,
1790
+ }));
1791
+
1792
+ // Test reasoning formats
1793
+ assert_msg_equals (
1794
+ simple_assist_msg (
1795
+ " <|channel|>analysis<|message|>I'm\n thinking<|end|>Hello, world!\n What's up?" ),
1796
+ common_chat_parse (
1797
+ " <|channel|>analysis<|message|>I'm\n thinking<|end|>"
1798
+ " <|start|>assistant<|channel|>final<|message|>Hello, world!\n What's up?" ,
1799
+ /* is_partial= */ false ,
1800
+ {
1801
+ /* .format = */ COMMON_CHAT_FORMAT_GPT_OSS,
1802
+ /* .reasoning_format = */ COMMON_REASONING_FORMAT_NONE,
1803
+ }));
1804
+
1805
+ assert_msg_equals (
1806
+ simple_assist_msg (
1807
+ " Hello, world!\n What's up?" , " I'm\n thinking" ),
1808
+ common_chat_parse (
1809
+ " <|channel|>analysis<|message|>I'm\n thinking<|end|>"
1810
+ " <|start|>assistant<|channel|>final<|message|>Hello, world!\n What's up?" ,
1811
+ /* is_partial= */ false ,
1812
+ {
1813
+ /* .format = */ COMMON_CHAT_FORMAT_GPT_OSS,
1814
+ /* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
1815
+ }));
1816
+
1817
+ assert_msg_equals (
1818
+ simple_assist_msg (
1819
+ " <think>I'm\n thinking</think>Hello, world!\n What's up?" ),
1820
+ common_chat_parse (
1821
+ " <|channel|>analysis<|message|>I'm\n thinking<|end|>"
1822
+ " <|start|>assistant<|channel|>final<|message|>Hello, world!\n What's up?" ,
1823
+ /* is_partial= */ false ,
1824
+ {
1825
+ /* .format = */ COMMON_CHAT_FORMAT_GPT_OSS,
1826
+ /* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
1827
+ /* .reasoning_in_content = */ true ,
1828
+ }));
1747
1829
}
1748
1830
}
1749
1831
0 commit comments