Skip to content

Commit 90dfadb

Browse files
authored
bugfix: resolve stream output parser core when dont enable function call or reasoning output. (#315)
1 parent 9beb975 commit 90dfadb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

xllm/api_service/stream_output_parser.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ StreamOutputParser::StreamOutputParser(
2727
reasoning_parser_format_(reasoning_parser_format),
2828
force_reasoning_(force_reasoning) {
2929
sequence_parsers_.resize(1);
30-
sequence_parsers_[0].tool_call_parser =
31-
std::make_unique<function_call::FunctionCallParser>(
32-
tools_, tool_call_parser_format_);
33-
sequence_parsers_[0].reasoning_parser_ = std::make_unique<ReasoningParser>(
34-
reasoning_parser_format_, true, force_reasoning_);
30+
if (is_tool_call()) {
31+
sequence_parsers_[0].tool_call_parser =
32+
std::make_unique<function_call::FunctionCallParser>(
33+
tools_, tool_call_parser_format_);
34+
}
35+
if (is_reasoning()) {
36+
sequence_parsers_[0].reasoning_parser_ = std::make_unique<ReasoningParser>(
37+
reasoning_parser_format_, true, force_reasoning_);
38+
}
3539
}
3640

3741
bool StreamOutputParser::is_tool_call() {

0 commit comments

Comments
 (0)