mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-09 17:44:50 +08:00
Users of OpenAI-compatible reasoning models (o4-mini, o3, deepseek-r1, etc.) had no way to control reasoning effort — the field was missing from MessageRequest and never emitted in the request body. Changes: - Add `reasoning_effort: Option<String>` to `MessageRequest` in types.rs - Annotated with skip_serializing_if = "Option::is_none" for clean JSON - Accepted values: "low", "medium", "high" (passed through verbatim) - In `build_chat_completion_request`, emit `"reasoning_effort"` when set - Two unit tests: - `reasoning_effort_is_included_when_set`: o4-mini + "high" → field present - `reasoning_effort_omitted_when_not_set`: gpt-4o, no field → absent Existing callers use `..Default::default()` and are unaffected. One struct-literal test that listed all fields explicitly updated with `reasoning_effort: None`. The CLI flag to expose this to users is a follow-up (ROADMAP #34 partial). This commit lands the foundational API-layer plumbing needed for that. Partial ROADMAP #34.