https://github.com/jonaylor89/gpt_oss_calc
cli calculator using gpt-oss:20b
https://github.com/jonaylor89/gpt_oss_calc
Last synced: 8 months ago
JSON representation
cli calculator using gpt-oss:20b
- Host: GitHub
- URL: https://github.com/jonaylor89/gpt_oss_calc
- Owner: jonaylor89
- Created: 2025-08-08T13:15:55.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-08T13:19:22.000Z (10 months ago)
- Last Synced: 2025-09-16T13:17:47.933Z (9 months ago)
- Language: Rust
- Size: 15.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GPT OSS Calculator
Command-line calculator using a local GPT model (Ollama) with function calling for math calculations.
## Features
- Uses GPT-OSS model via Ollama
- Function calling for calculations
- Streaming response support
- Verbose mode shows thinking process
- Math functions: sqrt, sin, cos, tan, ln, log, pi, e
## Prerequisites
- Rust (latest stable)
- [Ollama](https://ollama.ai/) running locally with the `gpt-oss:20b` model
## Installation
```bash
git clone
cd gpt_oss_calc
cargo build --release
```
## Usage
### Basic Usage
```bash
cargo run -q "what's the square root of 69"
cargo run -q "calculate 15 * 23 + 42"
cargo run -q "what's sin(pi/2)"
```
### Verbose Mode (shows AI thinking process)
```bash
cargo run -q -- --verbose "what's sqrt(123456789)"
cargo run -q -- -v "calculate 2^10"
```
## Example Output
**Normal mode:**
```
$ cargo run -q "what's the square root of 69"
The square root of 69 is about **8.30662**.
```
**Verbose mode:**
```
$ cargo run -q -- --verbose "calculate 2^10"
Thinking: The user asks to calculate 2^10. That's 1024. We can call the calculator.
Tool: calculator
Input: 2^10
Output: 1024
The result is: 1024
```
## How It Works
1. Sends question to GPT-OSS model in Ollama
2. Model calls calculator function for math expressions
3. Evaluates expressions using `evalexpr`
4. Returns response with results