File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,7 @@ std::vector<common_chat_msg> common_chat_msgs_parse_oaicompat(const json & messa
201201 msg.role = message.at (" role" );
202202
203203 auto has_content = message.contains (" content" );
204+ auto has_reasoning_content = message.contains (" reasoning_content" );
204205 auto has_tool_calls = message.contains (" tool_calls" );
205206 if (has_content) {
206207 const auto & content = message.at (" content" );
@@ -249,8 +250,8 @@ std::vector<common_chat_msg> common_chat_msgs_parse_oaicompat(const json & messa
249250 msg.tool_calls .push_back (tc);
250251 }
251252 }
252- if (!has_content && !has_tool_calls) {
253- throw std::runtime_error (" Expected 'content' or 'tool_calls' (ref: https://github.com/ggml-org/llama.cpp/issues/8367 & https://github.com/ggml-org/llama.cpp/issues/12279)" );
253+ if (!has_content && !has_tool_calls && !has_reasoning_content ) {
254+ throw std::runtime_error (" Expected 'content', 'reasoning_content' or 'tool_calls' (ref: https://github.com/ggml-org/llama.cpp/issues/8367 & https://github.com/ggml-org/llama.cpp/issues/12279)" );
254255 }
255256 if (message.contains (" reasoning_content" )) {
256257 msg.reasoning_content = message.at (" reasoning_content" );
Original file line number Diff line number Diff line change @@ -595,8 +595,8 @@ static json oaicompat_chat_params_parse(
595595 throw std::runtime_error (" All non-assistant messages must contain 'content'" );
596596 }
597597 if (role == " assistant" ) {
598- if (!msg.contains (" content" ) && !msg.contains (" tool_calls" )) {
599- throw std::runtime_error (" Assistant message must contain either 'content' or 'tool_calls'!" );
598+ if (!msg.contains (" content" ) && !msg.contains (" tool_calls" ) && !msg. contains ( " reasoning_content " ) ) {
599+ throw std::runtime_error (" Assistant message must contain either 'content' or 'tool_calls' or 'reasoning_content' !" );
600600 }
601601 if (!msg.contains (" content" )) {
602602 continue ; // avoid errors with no content
You can’t perform that action at this time.
0 commit comments