[Bugfix][Frontend][Rust Frontend] Update DeepSeek V4.1 Flash reasoning effort mappings (#58316)

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: zhec <chengyunfei@ruc.edu.cn>
This commit is contained in:
zhec
2026-09-26 02:18:58 +00:00
committed by GitHub
co-authored by Claude Bugen Zhao
parent 5840d95284
commit ddd6fbca14
9 changed files with 20 additions and 20 deletions
+2 -2
View File
@@ -289,8 +289,8 @@ pub(super) fn resolve_reasoning(
DsDialect::V41 => {
let budget = match effort {
EffortValue::String(effort) => match effort.as_str() {
"low" => 25,
"high" => 50,
"low" => 50,
"high" => 75,
"xhigh" => 75,
"max" => 100,
_ => return Err(invalid_v41_reasoning_effort()),
@@ -1,4 +1,4 @@
<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)
<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)
You are a helpful assistant.
@@ -1,3 +1,3 @@
<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)
<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)
You are a helpful assistant.<|User|>Hello<|Assistant|></think>Hi there! How can I help you?<|end▁of▁sentence|><|User|>What is the capital of France?<|Assistant|><think>The user asks about the capital of France. It is Paris.</think>The capital of France is Paris.<|end▁of▁sentence|>
@@ -1,4 +1,4 @@
<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)
<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)
<|User|>question<|User|>policy
@@ -165,9 +165,9 @@ fn image_part(uuid: &str) -> ChatContentPart {
#[test]
fn maps_reasoning_effort_to_reference_numeric_budget() {
for (effort, budget) in [
(None, 50),
(Some(EffortValue::from("low")), 25),
(Some(EffortValue::from("high")), 50),
(None, 75),
(Some(EffortValue::from("low")), 50),
(Some(EffortValue::from("high")), 75),
(Some(EffortValue::from("xhigh")), 75),
(Some(EffortValue::from("max")), 100),
(Some(EffortValue::Number(37.into())), 37),
@@ -189,7 +189,7 @@ fn accepts_numeric_template_effort_with_top_level_precedence() {
(json!(1), 1),
(json!(42), 42),
(json!(100), 100),
(json!("low"), 25),
(json!("low"), 50),
] {
let mut request = request();
request.chat_options.template_kwargs.insert("reasoning_effort".into(), effort);
@@ -286,11 +286,11 @@ fn system_after_dropped_developer_becomes_leading_system() {
],
..ChatRequest::for_test()
};
expect!["<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)\n\nsys"]
expect!["<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)\n\nsys"]
.assert_eq(&render(&request));
request.messages.push(ChatMessage::user("question"));
expect!["<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)\n\nsys<|User|>question<|Assistant|><think>"]
expect!["<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)\n\nsys<|User|>question<|Assistant|><think>"]
.assert_eq(&render(&request));
}
@@ -322,7 +322,7 @@ fn last_user_turn_omits_generation_prompt_when_disabled() {
let mut request = request();
request.chat_options.generation_prompt_mode = GenerationPromptMode::NoGenerationPrompt;
expect!["<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)\n\n<|User|>question"]
expect!["<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)\n\n<|User|>question"]
.assert_eq(&render(&request));
}
@@ -1,4 +1,4 @@
<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)
<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)
You are a helpful assistant.
@@ -1,3 +1,3 @@
<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)
<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)
You are a helpful assistant.<|User|>Hello<|Assistant|></think>Hi there! How can I help you?<|end▁of▁sentence|><|User|>What is the capital of France?<|Assistant|><think>The user asks about the capital of France. It is Paris.</think>The capital of France is Paris.<|end▁of▁sentence|>
+4 -4
View File
@@ -35,9 +35,9 @@ def test_reference_encoder_fixtures(case_id):
@pytest.mark.parametrize(
("effort", "budget"),
[
(None, 50),
("low", 25),
("high", 50),
(None, 75),
("low", 50),
("high", 75),
("xhigh", 75),
("max", 100),
(1, 1),
@@ -138,7 +138,7 @@ def test_top_level_effort_overrides_template_effort():
chat_template_kwargs={"reasoning_effort": 100},
)
kwargs = request.build_chat_params(None, "auto").get_apply_chat_template_kwargs()
assert "Reasoning Effort: 25 " in render(request.messages, **kwargs)
assert "Reasoning Effort: 50 " in render(request.messages, **kwargs)
def test_encode_uses_one_bos_and_forwards_truncation():
+2 -2
View File
@@ -181,8 +181,8 @@ REASONING_EFFORT_TEMPLATE = (
"(range 1-100, the higher the value, the more thorough the reasoning)\n\n"
)
REASONING_EFFORT_MAPPINGS: Dict[str, int] = {
"low": 25,
"high": 50,
"low": 50,
"high": 75,
"xhigh": 75,
"max": 100,
}