File size: 2,780 Bytes
35bd451
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
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!