mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-20 19:55:25 -04:00
fix: preserve reasoning_content in sanitized messages for Moonshot/Kimi (#3152)
Providers like Moonshot (Kimi K2.5/K2.6) require the reasoning_content field to be present on assistant tool-call messages in multi-turn conversations. The sanitizer's allow-list was missing this field, causing HTTP 400: 'thinking is enabled but reasoning_content is missing in assistant tool call message at index N'. Add reasoning_content to the allowed field set in _sanitize_llm_messages and cover with regression tests. Fixes #3118 Co-authored-by: michaelxer <michaelxer@users.noreply.github.com> Co-authored-by: Alexandre Teixeira <111787685+alteixeira20@users.noreply.github.com>
This commit is contained in:
+1
-1
@@ -832,7 +832,7 @@ def _sanitize_llm_messages(messages: List[Dict]) -> List[Dict]:
|
||||
(content=None, since Gemini/Ollama reject tool_calls alongside ""). Dropping
|
||||
it leaves the tool result dangling and breaks the next round.
|
||||
"""
|
||||
allowed = {"role", "content", "name", "tool_call_id", "tool_calls", "function_call"}
|
||||
allowed = {"role", "content", "name", "tool_call_id", "tool_calls", "function_call", "reasoning_content"}
|
||||
cleaned = []
|
||||
for msg in messages or []:
|
||||
if not isinstance(msg, dict):
|
||||
|
||||
Reference in New Issue
Block a user