Skip to main content

Hands-on AI Toolkit for classrooms

Project description

HandsOnAI: Your AI Learning Lab

ai-education chatbots cli-tool natural-language-processing python react-framework retrieval-augmented-generation educational-toolkit edtech artificial-intelligence

Python 3.10+ MIT License Classroom Ready Beginner Friendly DeepWiki

AI learning made simple for students and educators

Open In Colab New here? Try the quickstart notebook in your browser, no install needed.

HandsOnAI is a unified educational toolkit designed to teach students how modern AI systems work, by building and interacting with them directly.

It provides a clean, modular structure that introduces core AI concepts progressively through five modules:

๐Ÿงฑ Module Overview

Module Purpose CLI Name
chat Chatbot with system prompts, personalities, and memory chat
rag Retrieval-Augmented Generation (RAG) over your documents rag
agent Tool use and step-by-step reasoning agent
workflow Orchestrate multi-step tasks as folders of stages (library)
eval Evaluate output quality with an LLM judge (library)

(A small models utility module handles model detection and capabilities.)

Each module is:

  • ๐Ÿ”Œ Self-contained
  • ๐Ÿงฉ Installable via one package: pip install hands-on-ai
  • ๐Ÿง  Designed for progressive learning

๐Ÿ—‚ Project Structure

hands_on_ai/
โ”œโ”€โ”€ chat/           โ† A simple prompt/response chatbot
โ”œโ”€โ”€ rag/            โ† Ask questions using your own documents
โ”œโ”€โ”€ agent/          โ† Agent reasoning + tools (ReAct-style)
โ”œโ”€โ”€ config.py       โ† Shared config (model, chunk size, paths)
โ”œโ”€โ”€ cli.py          โ† Meta CLI (list, config, version)
โ”œโ”€โ”€ models.py       โ† Centralized model utilities
โ”œโ”€โ”€ utils/          โ† Shared tools, prompts, paths, etc.
โ””โ”€โ”€ commands/       โ† Shared CLI commands

Examples and scripts are available in the repository:

hands-on-ai/
โ”œโ”€โ”€ examples/       โ† Example scripts for all modules
โ””โ”€โ”€ scripts/        โ† Utility scripts for package maintenance

๐Ÿง‘โ€๐Ÿซ Why This Matters for Students

Each tool teaches a different level of modern AI interaction:

  • chat โ€“ Prompt engineering, roles, and LLMs
  • rag โ€“ Document search, embeddings, and grounded answers
  • agent โ€“ Multi-step reasoning, tool use, and planning

๐Ÿš€ Getting Started

Installation

# Install from PyPI
pip install hands-on-ai

# Or directly from GitHub
pip install git+https://github.com/michael-borck/hands-on-ai.git

Prerequisites

Quick Start

Prefer a notebook? Open the starter in Colab:

Open In Colab

Option 1: Set configuration in Python (Recommended for beginners)

import os

# Configure your provider
os.environ['HANDS_ON_AI_SERVER'] = 'https://ollama.serveur.au'
os.environ['HANDS_ON_AI_MODEL'] = 'llama3.2'
os.environ['HANDS_ON_AI_API_KEY'] = input('Enter your API key: ')

# Now use HandsOnAI
from hands_on_ai.chat import pirate_bot
print(pirate_bot("What is photosynthesis?"))

Option 2: Use environment variables

Run a local Ollama server, then set environment variables and start chatting:

export HANDS_ON_AI_SERVER="http://localhost:11434"
# No API key needed for local Ollama
from hands_on_ai.chat import pirate_bot
print(pirate_bot("What is photosynthesis?"))

For more options:

from hands_on_ai.chat import get_response, friendly_bot, pirate_bot

# Basic usage with default model
response = get_response("Tell me about planets")
print(response)

# Use a personality bot
pirate_response = pirate_bot("Tell me about sailing ships")
print(pirate_response)

get_response is stateless: each call is independent. For a multi-turn chat that remembers what was said, use Conversation:

from hands_on_ai.chat import Conversation

chat = Conversation(system="You are a helpful tutor.")
chat.ask("My name is Sam.")
print(chat.ask("What's my name?"))   # -> remembers "Sam"

print(f"Tokens used so far: {chat.total_tokens}")

You can also see token usage for a single call with get_response(..., return_usage=True), which returns a (response, usage) tuple.

๐ŸŒ Provider-Agnostic Architecture

HandsOnAI is designed to work with any OpenAI-compatible LLM provider. The system uses standard OpenAI API endpoints (/v1/chat/completions, /v1/models) making it compatible with a wide range of AI services.

Configuration

Set your provider using environment variables:

# Set your provider's base URL
export HANDS_ON_AI_SERVER="https://your-provider-url"

# Set API key if required
export HANDS_ON_AI_API_KEY="your-api-key"

# Enable debug logging
export HANDS_ON_AI_LOG="debug"

Provider Examples

Ollama (Local)

export HANDS_ON_AI_SERVER="http://localhost:11434"
# No API key needed for local Ollama

OpenAI

export HANDS_ON_AI_SERVER="https://api.openai.com"
export HANDS_ON_AI_API_KEY="sk-your-openai-key"

Together AI

export HANDS_ON_AI_SERVER="https://api.together.xyz"
export HANDS_ON_AI_API_KEY="your-together-key"

OpenRouter

export HANDS_ON_AI_SERVER="https://openrouter.ai/api"
export HANDS_ON_AI_API_KEY="your-openrouter-key"
export HANDS_ON_AI_MODEL="openai/gpt-4o"  # or any model they support

Google Gemini

export HANDS_ON_AI_SERVER="https://generativelanguage.googleapis.com/v1beta/openai"
export HANDS_ON_AI_API_KEY="your-gemini-key"
export HANDS_ON_AI_MODEL="gpt-4o-mini"  # maps to gemini-1.5-flash

Groq

export HANDS_ON_AI_SERVER="https://api.groq.com/openai"
export HANDS_ON_AI_API_KEY="your-groq-key"

LocalAI

export HANDS_ON_AI_SERVER="http://localhost:8080"
# API key optional depending on setup

๐Ÿ“Š Provider Compatibility

HandsOnAI works with any service that implements OpenAI-compatible endpoints:

Provider Base URL Example Authentication Status
Ollama http://localhost:11434 None (local) โœ… Tested
OpenAI https://api.openai.com Bearer token โœ… Compatible
Google Gemini https://generativelanguage.googleapis.com/v1beta/openai Bearer token โœ… Compatible
Groq https://api.groq.com/openai Bearer token โœ… Compatible
OpenRouter https://openrouter.ai/api Bearer token โœ… Compatible
Together AI https://api.together.xyz Bearer token โœ… Compatible
LocalAI http://localhost:8080 Optional โœ… Compatible
vLLM http://your-vllm-server Optional โœ… Compatible
Hugging Face https://api-inference.huggingface.co Bearer token โœ… Compatible
Any OpenAI-compatible server http://your-server Varies โœ… Compatible

Requirements for Compatibility

Your provider must support:

  • โœ… /v1/chat/completions endpoint
  • โœ… /v1/models endpoint
  • โœ… OpenAI message format ({"role": "user", "content": "..."})
  • โœ… Bearer token authentication (if API key required)

Educational Benefits

This provider-agnostic approach offers several educational advantages:

  • ๐ŸŒ No vendor lock-in - Switch providers without code changes
  • ๐Ÿ“š Industry standards - Students learn OpenAI API patterns used across the industry
  • ๐Ÿ”ง Real-world skills - Transferable knowledge to other AI tools and platforms
  • ๐Ÿ’ก Flexibility - Use local models for privacy or cloud models for power

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines on how to get involved.

License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿค– LLM Ready

This package is designed to work seamlessly with Large Language Models for coding assistance and learning:

For Students & Educators

How to Use with LLMs

  1. Download the LLM.txt file
  2. Upload it to your LLM (Claude, ChatGPT, etc.)
  3. Ask for help with HandsOnAI projects - get complete, working code examples

Example prompts:

  • "Create a pirate chatbot using hands-on-ai"
  • "Build a document Q&A system with the RAG module"
  • "Make an agent that can calculate and search the web"

The LLM will have complete knowledge of the API, examples, and best practices.

Acknowledgments

  • Built with education in mind
  • Powered by open-source LLM technology
  • Inspired by educators who want to bring AI into the classroom responsibly

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hands_on_ai-0.4.0.tar.gz (128.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hands_on_ai-0.4.0-py3-none-any.whl (145.0 kB view details)

Uploaded Python 3

File details

Details for the file hands_on_ai-0.4.0.tar.gz.

File metadata

  • Download URL: hands_on_ai-0.4.0.tar.gz
  • Upload date:
  • Size: 128.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for hands_on_ai-0.4.0.tar.gz
Algorithm Hash digest
SHA256 08972acf933e0bee8c727eb8e98ca8a5c546796411aefeeb80e89e65e655093b
MD5 4d8a286120a47f516f1b5604fe782d7d
BLAKE2b-256 59504f6af7b8f34b0398c3c1c7a9701feca50c1b0cbf9607a2898ba939d63c73

See more details on using hashes here.

File details

Details for the file hands_on_ai-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: hands_on_ai-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 145.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for hands_on_ai-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5110dd16b548d8ce2773b5736c79c53842357061b2fa9fa3ef52cfdac067f424
MD5 97751ffb14b6ee0577a6b2ee00e211d0
BLAKE2b-256 471575cdb865f4944f9e6c627133a5318b04738a847aae9722a9fcd4ed70f853

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page