Skip to content

701: Beginner Project - PromptCraft Workbench

Project Overview

Welcome to your first hands-on project! In this lesson, we will consolidate the concepts from the course to build PromptCraft, a local web application for experimenting with prompt engineering.

Goal: To build a multi-tab Gradio application that uses a local, open-source LLM to perform various tasks like summarization, Q&A, and classification, demonstrating the core principles of Prompt Engineering with LangChain.


Project Rationale and Value

Building this project will move you from theory to practice. You will learn:

  • How to run a powerful LLM 100% locally, without APIs or costs
  • How to structure a Python application with a modular design
  • How to create and test different LangChain chains for specific tasks
  • How to build a simple but effective web UI with Gradio

This project is a perfect portfolio piece, showcasing your ability to build a complete, end-to-end AI application.

Final Architecture

We will build a system with a clear separation of concerns, making it robust and easy to understand.

flowchart TD
    subgraph UI ["🎨 User Interface Layer"]
        A["run_app.py<br/>Application Entry Point"] --> B["src/ui.py<br/>Gradio UI Definition"]
    end

    subgraph Logic ["🧠 Application Logic Layer"]
        C["src/chains.py<br/>LangChain Chains"]
    end

    subgraph Model ["🤖 Model Loading Layer"]
        D["src/llm_loader.py<br/>Model Manager"] --> E["src/config.py<br/>Configuration"]
        E --> F["models/<br/>tinyllama.gguf"]
    end

    B --> C
    C --> D

    style UI fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
    style Logic fill:#e8f5e8,stroke:#388e3c,stroke-width:2px
    style Model fill:#fff3e0,stroke:#f57c00,stroke-width:2px

Project Structure

The application follows a clean, modular architecture:

promptcraft/
├── run_app.py              # Main application entry point
├── requirements.txt        # Python dependencies
├── README.md              # Project documentation
├── src/
│   ├── __init__.py
│   ├── config.py          # Configuration management
│   ├── llm_loader.py      # Model loading and management
│   ├── chains.py          # LangChain implementations
│   └── ui.py              # Gradio user interface
├── models/                # Local model storage
│   └── tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
└── tests/                 # Unit tests (optional)
    └── test_chains.py

Core Features

1. Text Summarization

Transform lengthy documents into concise, meaningful summaries using advanced prompt engineering techniques.

2. Question & Answer

Implement context-aware Q&A functionality that can answer questions based on provided text passages.

3. Text Classification

Build intelligent text classification systems for categorizing content, sentiment analysis, and topic detection.

4. Creative Writing Assistant

Develop a creative writing companion that can generate stories, poems, and other creative content based on user prompts.

Technical Stack

Core Technologies

  • Python 3.8+ - Primary programming language
  • LangChain - LLM application framework
  • Gradio - Web UI framework
  • llama-cpp-python - Local LLM inference engine

Model

  • TinyLlama 1.1B - Lightweight, efficient language model
  • GGUF Format - Optimized for local inference
  • Quantized (Q4_K_M) - Balanced performance and memory usage

Architecture Patterns

  • Modular Design - Clear separation of concerns
  • Chain Pattern - LangChain's composable approach
  • Configuration Management - Centralized settings
  • Error Handling - Robust error management

Learning Objectives

Upon completing this project, you will have mastered:

Technical Skills: - Local LLM deployment and management - Advanced prompt engineering techniques - LangChain framework implementation - Gradio web application development

Software Engineering: - Modular application architecture - Configuration management patterns - Error handling and logging - Code organization and documentation

AI/ML Concepts: - Language model inference optimization - Prompt template design - Chain-of-thought reasoning - Context window management

System Requirements

Minimum Specifications: - Operating System: Windows 10+, macOS 10.15+, or Linux - Python: Version 3.8 or higher - RAM: 8GB minimum (16GB recommended) - Storage: 2GB free space for models - Internet: Required for initial setup and model download

Recommended Specifications: - RAM: 16GB+ for optimal performance - CPU: Multi-core processor (4+ cores) - Storage: SSD for faster model loading

Project Highlights

This project demonstrates several important concepts in modern AI application development:

Local-First Approach: Run everything on your machine without external API dependencies, ensuring privacy and eliminating recurring costs.

Production-Ready Architecture: Build with scalability and maintainability in mind, using industry-standard patterns and practices.

Interactive Learning: Experiment with different prompt engineering techniques through an intuitive web interface.

Portfolio Quality: Create a professional application that showcases your AI engineering capabilities to potential employers or collaborators.


Ready to begin? This project will transform your theoretical knowledge into practical, hands-on experience with cutting-edge AI technologies.