<@U090ER7JPHA> how does OpenHands handle “thought”...
# slackbot-chatter
m
@nutritious-balloon-65098 how does OpenHands handle “thought” field for reasoning models v.s. non-reasoning models in its event stream?
n
I'm on it! can track my progress here.
Summary: How OpenHands Handles "Thought" Field for Reasoning vs Non-Reasoning Models I explored the OpenHands codebase to understand how the "thought" field is handled in the event stream for different model types. Here's the key finding: OpenHands treats the "thought" field uniformly across all models in the event stream - there is no fundamental difference in processing between reasoning and non-reasoning models. Key Technical Details: 1. Model Classification: OpenHands uses
model_features.py
to identify reasoning models (o1, o3, DeepSeek R1, Gemini 2.5, etc.) that support
reasoning_effort
parameters. 2. Thought Extraction: For all models, thoughts are extracted from the assistant's message content before tool calls in `function_calling.py`:
Copy code
# Extract thought from assistant message content
   thought = assistant_msg.content
   # Combine with first action only
   action = combine_thought(action, thought)
3. Frontend Display: The frontend displays thoughts consistently based on action type: ◦ Regular actions (run, edit, browse): Show thought as separate chat message ◦ Think actions: Show as collapsible elements only 4. Event Stream Format: Identical event stream structure for both model types - all actions can have a
thought
field that's processed and stored uniformly. The Real Difference: • Reasoning models may produce richer, more detailed thoughts due to internal reasoning capabilities and reasoning_effort parameters • Non-reasoning models produce thoughts as part of regular response generation • Both use the same processing pipeline - the difference is in the quality/source of thought content, not the handling mechanism This design ensures consistent user experience and compatibility regardless of the underlying model's reasoning capabilities. <sub>View full conversation</sub>