Skip to content

Commit e9288e8

Browse files
authored
chat : clarify the meaning of reasoning_format (ggml-org#15408)
* chat : clarify the meaning of reasoning_format * add link to this PR
1 parent 9d262f4 commit e9288e8

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

common/chat.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,6 @@ const char * common_reasoning_format_name(common_reasoning_format format) {
632632
case COMMON_REASONING_FORMAT_AUTO: return "auto";
633633
case COMMON_REASONING_FORMAT_DEEPSEEK: return "deepseek";
634634
case COMMON_REASONING_FORMAT_DEEPSEEK_LEGACY: return "deepseek-legacy";
635-
case COMMON_REASONING_FORMAT_GRANITE: return "granite";
636635
default:
637636
throw std::runtime_error("Unknown reasoning format");
638637
}

common/common.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,15 @@ struct common_params_diffusion {
239239
bool add_gumbel_noise = false; // add gumbel noise to the logits if temp > 0.0
240240
};
241241

242+
// reasoning API response format (not to be confused as chat template's reasoning format)
242243
enum common_reasoning_format {
243244
COMMON_REASONING_FORMAT_NONE,
244-
COMMON_REASONING_FORMAT_AUTO,
245+
COMMON_REASONING_FORMAT_AUTO, // Same as deepseek, using `message.reasoning_content`
245246
COMMON_REASONING_FORMAT_DEEPSEEK_LEGACY, // Extract thinking tag contents and return as `message.reasoning_content`, or leave inline in <think> tags in stream mode
246247
COMMON_REASONING_FORMAT_DEEPSEEK, // Extract thinking tag contents and return as `message.reasoning_content`, including in streaming deltas.
247-
COMMON_REASONING_FORMAT_GRANITE, // Extract thinking tag contents and return as `message.reasoning_content`, including in streaming deltas.
248+
// do not extend this enum unless you absolutely have to
249+
// in most cases, use COMMON_REASONING_FORMAT_AUTO
250+
// see: https://github.com/ggml-org/llama.cpp/pull/15408
248251
};
249252

250253

tests/test-chat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ static void test_template_output_parsers() {
14081408
/* is_partial= */ false,
14091409
{
14101410
/* .format = */ COMMON_CHAT_FORMAT_GRANITE,
1411-
/* .reasoning_format = */ COMMON_REASONING_FORMAT_GRANITE,
1411+
/* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
14121412
}));
14131413

14141414
// Test parsing tool calls

0 commit comments

Comments
 (0)