| --- |
| 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! |
|
|
|
|