Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

🧮 AI Calculator Agent

An intelligent calculator agent built with LangChain, and Groq Llama 3.3 that performs mathematical operations using tool calling instead of solving everything inside the language model.

🚀 Overview

This project demonstrates how modern AI agents can decide when to use external tools. Instead of directly calculating answers, the LLM selects the appropriate tool, executes it, and then generates a natural-language response.

Example

User

What is 42 + 58?

Agent Reasoning

LLM → Calls add(a=42, b=58)
Tool → Returns 100
LLM → "The answer is 100."

✨ Features

  • ➕ Addition
  • ➖ Subtraction
  • ✖️ Multiplication
  • ➗ Division
  • √ Square Root
  • 🤖 Automatic tool selection
  • 🔄 Agent execution
  • 📖 Easy to extend with custom tools

🛠️ Tech Stack

  • Python 3.10+
  • LangChain
  • LangChain Groq
  • Groq API
  • Llama 3.3 70B Versatile

📂 Project Structure

.
├── app.py
├── .env
├── requirements.txt
└── README.md

⚙️ Installation

1. Clone the repository

git clone https://github.com/Vinay-Rai/AI-Calculator-Agent
cd AI-Calculator-Agent

2. Create a virtual environment

python -m venv myenv

Activate it:

Windows

myenv\Scripts\activate

Linux/macOS

source myenv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Create a .env file

GROQ_API_KEY=your_groq_api_key

▶️ Run the Project

python app.py

💬 Sample Queries

What is 42 + 58?

Multiply 15 by 8.

Divide 120 by 5.

What is the square root of 144?

I have a rectangle with width 12 and height 7.
Find the area and then calculate its square root.

🧠 How It Works

User Question
      │
      ▼
LangChain Agent
      │
      ▼
LLM decides which tool to use
      │
      ▼
Tool Execution
      │
      ▼
Tool Result
      │
      ▼
LLM generates final response

📈 Future Improvements

  • Memory-enabled conversations
  • Weather API integration
  • Web Search tools
  • File Reader (PDF, CSV, DOCX)
  • Database querying
  • Multi-tool reasoning
  • Streamlit web interface

🤝 Contributing

Contributions, suggestions, and improvements are welcome.

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Open a Pull Request

📜 License

This project is licensed under the MIT License.


👤 Author

Vinay Rai

If you found this project helpful, consider giving it a ⭐ on GitHub!

About

AI Calculator Agent built with LangChain, LangGraph, and Groq Llama 3.3 that uses tool calling to perform mathematical operations intelligently.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages