fix: support reasoning models in title generation#20266
Open
gzsiang wants to merge 2 commits into
Open
Conversation
Collaborator
d4c674a to
98bfaad
Compare
cf6f416 to
8dd07a3
Compare
When the title_generation LLM uses --reasoning-format (e.g. deepseek), the model outputs to reasoning_content instead of content. The original code only read content, resulting in empty titles. Changes: - Import extract_content_or_reasoning to handle reasoning models - Add _extract_title_from_reasoning() to extract clean titles from reasoning traces (looks for quoted options, best option selection, or falls back to last plausible phrase) - Clean up reasoning artifacts (bullet points, char counts, etc.)
The fallback was doing raw.strip()[:80], which produced exactly 80 characters. The subsequent len(title) > 80 check didn't trigger, so the trailing '...' was never added. Let generate_title() handle the 80-char limit consistently.
8dd07a3 to
1678d6f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #18529
title_generator.py was reading
response.choices[0].message.contentdirectly, which doesn't work for reasoning models (e.g. Qwen3.5, deepseek) that output thinking content toreasoning_contentinstead ofcontent.Changes
extract_content_or_reasoningfrom auxiliary_client_extract_title_from_reasoning()function that:extract_content_or_reasoning()to get raw output before extracting titleFiles Changed
agent/title_generator.py(+65, -2)