[Bugfix] GPT-OSS Autodrop reasoning in Response API and cleanup (#45048)

Signed-off-by: Yifan Zong <yzong@redhat.com>
Co-authored-by: Ben Browning <bbrownin@redhat.com>
This commit is contained in:
yzong-rh
2026-06-23 09:36:33 -04:00
committed by GitHub
co-authored by Ben Browning
parent 9f5117820f
commit f59db63732
5 changed files with 137 additions and 46 deletions
@@ -13,6 +13,7 @@ from openai_harmony import (
HarmonyEncodingName,
Message,
ReasoningEffort,
RenderConversationConfig,
Role,
StreamableParser,
SystemContent,
@@ -220,7 +221,6 @@ def parse_chat_inputs_to_harmony_messages(chat_msgs: list) -> list[Message]:
for chat_msg in chat_msgs:
msgs.extend(parse_chat_input_to_harmony_message(chat_msg, tool_id_names))
msgs = auto_drop_analysis_messages(msgs)
return msgs
@@ -447,9 +447,12 @@ def parse_chat_input_to_harmony_message(
def render_for_completion(messages: list[Message]) -> list[int]:
messages = auto_drop_analysis_messages(messages)
conversation = Conversation.from_messages(messages)
token_ids = get_encoding().render_conversation_for_completion(
conversation, Role.ASSISTANT
conversation,
Role.ASSISTANT,
config=RenderConversationConfig(auto_drop_analysis=False),
)
return token_ids