[responsesAPI][4] fix responseOutputItem Kimi K2 thinking bug (#29555)

Signed-off-by: Andrew Xia <axia@fb.com>
Co-authored-by: Andrew Xia <axia@fb.com>
This commit is contained in:
Andrew Xia
2025-12-02 02:11:35 +00:00
committed by GitHub
co-authored by Andrew Xia
parent 4b40924998
commit fa8804ad9c
2 changed files with 27 additions and 1 deletions
+6 -1
View File
@@ -97,13 +97,18 @@ def construct_chat_message_with_tool_call(
"role": "assistant",
"reasoning": reasoning_content,
}
elif isinstance(item, ResponseOutputMessage):
return {
"role": "assistant",
"content": item.content[0].text,
}
elif isinstance(item, ResponseFunctionToolCallOutputItem):
return ChatCompletionToolMessageParam(
role="tool",
content=item.output,
tool_call_id=item.call_id,
)
elif item.get("type") == "function_call_output":
elif isinstance(item, dict) and item.get("type") == "function_call_output":
# Append the function call output as a tool message.
return ChatCompletionToolMessageParam(
role="tool",