Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,13 @@ async def create(
"This may be due to the API used that is not returning the correct finish reason.",
stacklevel=2,
)
if choice.message.content is not None and choice.message.content != "":
# Put the content in the thought field.
# Prioritize reasoning_content from model_extra for thinking content
if choice.message.model_extra is not None:
reasoning_content = choice.message.model_extra.get("reasoning_content")
if reasoning_content is not None and reasoning_content != "":
thought = reasoning_content
# Fallback to message content if reasoning_content is not available
if thought is None and choice.message.content is not None and choice.message.content != "":
thought = choice.message.content
# NOTE: If OAI response type changes, this will need to be updated
content = []
Expand Down