v1.1.0 - Gemma3 Think Block Fix
Ollama Conversation Agent v1.1.0
🎯 Overview
This release fixes a critical issue where the Gemma3 model was outputting raw <think> blocks instead of user-facing responses when controlling devices.
🐛 Bug Fixes
Gemma3 Think Block Issue
Problem: When using Gemma3, device control responses showed internal reasoning blocks like:
<think> Alright, the user just turned off the desk lamp. Let me make sure I followed all the instructions...
Solution: Implemented comprehensive filtering and fallback mechanisms:
- Enhanced regex patterns to handle both complete and unclosed
<think>tags - Added intelligent fallback response generation when filtering results in empty text
- Updated system prompt to explicitly prohibit
<think>tags in model outputs - Added comprehensive debug logging for troubleshooting
✨ New Features
- Smart Fallback Responses: When model outputs only reasoning, automatically generates natural confirmations (e.g., "Done! I've turned off light.desk_lamp.")
- Enhanced Debug Logging: Track response filtering operations and model behavior
- Improved System Prompt: Clearer instructions for models on response formatting
🔧 Technical Changes
Modified Files
conversation.py: Enhanced_filter_think_blocks()function with dual regex patterns and fallback logicmanifest.json: Version bump to 1.1.0CHANGELOG.md: Comprehensive changelog with all changes
New Files
FIX_SUMMARY.md: Technical details of the fix implementationTESTING.md: Deployment and testing guide
📦 Installation
Method 1: HACS (Recommended)
- Open HACS in Home Assistant
- Go to Integrations
- Search for "Ollama Conversation"
- Click Update (if already installed) or Install
Method 2: Manual Installation
- Download
ollama-conversation-v1.1.0.zip - Extract to your Home Assistant
custom_componentsdirectory:unzip ollama-conversation-v1.1.0.zip -d /config/custom_components/
- Restart Home Assistant
Method 3: Direct Copy
cd /path/to/homeassistant-ollama-agent
scp -r custom_components/ollama_conversation your-ha-server:/config/custom_components/🧪 Testing
After installation, test with these commands:
- Light Control: "Turn off the desk lamp"
- Climate Control: "Set the bedroom to 72 degrees"
- Brightness: "Turn on the kitchen light to 50%"
Expected Results:
- ✅ No
<think>tags visible to users - ✅ Natural, concise confirmations
- ✅ Proper device control execution
🐞 Debug Mode
To enable detailed logging, add to configuration.yaml:
logger:
default: info
logs:
custom_components.ollama_conversation: debug🔗 Links
- Repository: https://github.com/cronus42/homeassistant-ollama-agent
- Issues: https://github.com/cronus42/homeassistant-ollama-agent/issues
- Documentation: See README.md and INSTALL.md
📋 Full Changelog
See CHANGELOG.md for complete details.
🙏 Credits
Developed by goose (Block's AI agent) as part of the open-source Goose project.
Compatibility: Home Assistant 2024.x or later, Ollama with function-calling support
Supported Models: Gemma3, function-gemma, and other Ollama models with tool calling