--- title: ReAct - Reasoning Modes Comparison emoji: 🧠 colorFrom: blue colorTo: purple sdk: gradio sdk_version: 4.44.0 app_file: app.py pinned: false license: mit --- # 🧠 LLM Reasoning Modes Comparison This Space demonstrates and compares three different reasoning paradigms for Large Language Models using **openai/gpt-oss-20b**: ## 🎯 Reasoning Modes ### 1. **Think-Only** (Chain-of-Thought) - Uses internal reasoning and knowledge only - Shows step-by-step thought process - No external tool access - Best for: Problems solvable with general knowledge ### 2. **Act-Only** (Tool Use) - Uses external tools to gather information - Shows actions and observations only - Minimal explicit reasoning - Best for: Fact-checking and real-time data retrieval ### 3. **ReAct** (Reasoning + Acting) - Interleaves Thought → Action → Observation - Combines reasoning with tool use - Most comprehensive approach - Best for: Complex problems requiring both reasoning and external data ## 🛠️ Available Tools The agent has access to these real external tools: - **🔍 DuckDuckGo Search**: Web search for current information - **📚 Wikipedia Search**: Detailed encyclopedic knowledge - **🌤️ Weather API**: Real-time weather data for any location - **🧮 Calculator**: Safe mathematical expression evaluation - **🐍 Python REPL**: Execute Python code for data processing ## 🚀 How to Use 1. Enter your question in the text box 2. Select a reasoning mode (or "All" to compare) 3. Click "Run" to see the agent work in real-time 4. Watch as thoughts, actions, and observations unfold ## 📝 Example Questions - "What is the capital of France and what's the current weather there?" - "Who wrote 'To Kill a Mockingbird' and when was it published?" - "Calculate the compound interest on $1000 at 5% annual rate for 3 years" - "What is the population of Tokyo and how does it compare to New York City?" ## 🔧 Setup To run this Space, you need to set your Hugging Face token: 1. Go to Space Settings → Repository Secrets 2. Add a secret named `HF_TOKEN` with your Hugging Face API token 3. The Space will automatically use this token to access the model ## 📚 Technical Details - **Model**: openai/gpt-oss-20b (via Hugging Face Inference API) - **Framework**: Gradio for the UI - **Agent Format**: Inspired by smolagents/ReAct paradigm - **Streaming**: Real-time display of intermediate steps ## 🎓 Learn More This implementation demonstrates the ReAct (Reason + Act) paradigm described in: - Yao et al. (2022) "ReAct: Synergizing Reasoning and Acting in Language Models" The three modes show how different combinations of reasoning and tool use affect problem-solving capabilities. ## 📄 License MIT License - feel free to use and modify!