Developer Guide for Contributing to EdgeAI for Beginners
This document provides comprehensive information for developers, AI agents, and contributors working with this repository. It covers setup, development workflows, testing, and best practices.
Last Updated: October 2025 | Document Version: 2.0
- Project Overview
- Repository Structure
- Prerequisites
- Setup Commands
- Development Workflow
- Testing Instructions
- Code Style Guidelines
- Pull Request Guidelines
- Translation System
- Foundry Local Integration
- Build and Deployment
- Common Issues and Troubleshooting
- Additional Resources
- Project-Specific Notes
- Getting Help
EdgeAI for Beginners is a comprehensive educational repository teaching Edge AI development with Small Language Models (SLMs). The course covers EdgeAI fundamentals, model deployment, optimization techniques, and production-ready implementations using Microsoft Foundry Local and various AI frameworks.
Key Technologies:
- Python 3.8+ (primary language for AI/ML samples)
- .NET C# (AI/ML Samples)
- JavaScript/Node.js with Electron (for desktop applications)
- Microsoft Foundry Local SDK
- Microsoft Windows ML
- VSCode AI Toolkit
- OpenAI SDK
- AI Frameworks: LangChain, Semantic Kernel, Chainlit
- Model Optimization: Llama.cpp, Microsoft Olive, OpenVINO, Apple MLX
Repository Type: Educational content repository with 8 modules and 10 comprehensive sample applications
Architecture: Multi-module learning path with practical samples demonstrating edge AI deployment patterns
edgeai-for-beginners/
├── introduction.md # Course introduction and overview
├── Module01-07/ # Core educational modules (Markdown)
├── Module08/ # Foundry Local toolkit with 10 samples
│ ├── samples/01-06/ # Foundation samples (Python)
│ ├── samples/07/ # API client (Python)
│ ├── samples/08/ # Windows 11 chat app (Electron)
│ └── samples/09-10/ # Advanced multi-agent systems (Python)
├── translations/ # Multi-language translations (50+ languages)
├── translated_images/ # Localized images
└── imgs/ # Course images and assets
- Python 3.8+ - For AI/ML samples and notebooks
- Node.js 16+ - For Electron sample application
- Git - For version control
- Microsoft Foundry Local - For running AI models locally
- Visual Studio Code - With Python, Jupyter, and Pylance extensions
- Windows Terminal - For better command-line experience (Windows users)
- Docker - For containerized development (optional)
- RAM: 8GB minimum, 16GB+ recommended for multi-model scenarios
- Storage: 10GB+ free space for models and dependencies
- OS: Windows 10/11, macOS 11+, or Linux (Ubuntu 20.04+)
- Hardware: CPU with AVX2 support; GPU (CUDA, Qualcomm NPU) optional but recommended
- Basic understanding of Python programming
- Familiarity with command-line interfaces
- Understanding of AI/ML concepts (for sample development)
- Git workflows and pull request processes
# Clone the repository
git clone https://github.com/microsoft/edgeai-for-beginners.git
cd edgeai-for-beginners
# No build step required - this is primarily an educational content repository# Create and activate virtual environment
python -m venv .venv
# On Windows
.venv\Scripts\activate
# On macOS/Linux
source .venv/bin/activate
# Install Foundry Local SDK and dependencies
pip install foundry-local-sdk openai
# Install additional dependencies for Module08 samples
cd Module08
pip install -r requirements.txtcd Module08/samples/08
npm install
# Start in development mode
npm run dev
# Build for production
npm run build
# Create installer
npm run distFoundry Local is required to run the samples. Download and install from the official repository:
Installation:
- Windows:
winget install Microsoft.FoundryLocal - macOS:
brew tap microsoft/foundrylocal && brew install foundrylocal - Manual: Download from releases page
Quick Start:
# Run your first model (auto-downloads if needed)
foundry model run phi-3.5-mini
# List available models
foundry model ls
# Check service status
foundry service statusNote: Foundry Local automatically selects the best model variant for your hardware (CUDA GPU, Qualcomm NPU, or CPU).
This repository contains primarily Markdown educational content. When making changes:
- Edit
.mdfiles in the appropriate module directories - Follow existing formatting patterns
- Ensure code examples are accurate and tested
- Update corresponding translated content if necessary (or let automation handle it)
For Python samples (samples 01-07, 09-10):
cd Module08
python samples/01/chat_quickstart.py "Test message"For Electron sample (sample 08):
cd Module08/samples/08
npm run dev # Development with hot reloadPython samples don't have automated tests but can be validated by running them:
# Test basic chat functionality
python samples/01/chat_quickstart.py "Hello"
# Test with specific model
set MODEL=phi-4-mini
python samples/02/openai_sdk_client.pyElectron sample has test infrastructure:
cd Module08/samples/08
npm test # Run unit tests
npm run test:e2e # Run end-to-end tests
npm run lint # Check code styleThe repository uses automated translation workflows. No manual testing required for translations.
Manual validation for content changes:
- Review Markdown rendering by previewing
.mdfiles - Verify all links point to valid targets
- Test any code snippets included in documentation
- Check that images load correctly
Module08/samples/08 (Electron app) has comprehensive testing:
cd Module08/samples/08
# Run all tests
npm test
# Run unit tests only
npm test -- --testPathPattern=unit
# Run integration tests
npm run test:integration
# Run E2E tests
npm run test:e2e
# Check test coverage
npm test -- --coveragePython samples should be manually tested:
# Each sample can be run directly
python samples/01/chat_quickstart.py "Test prompt"
python samples/04/chainlit_rag.py
python samples/09/multi_agent_system.py- Use consistent heading hierarchy (# for title, ## for main sections, ### for subsections)
- Include code blocks with language specifiers:
python,bash, ```javascript - Follow existing formatting for tables, lists, and emphasis
- Keep lines readable (aim for ~80-100 characters, but not strict)
- Use relative links for internal references
- Follow PEP 8 conventions
- Use type hints where appropriate
- Include docstrings for functions and classes
- Use meaningful variable names
- Keep functions focused and concise
# Electron sample follows ESLint configuration
cd Module08/samples/08
npm run lint # Check for style issues
npm run lint:fix # Auto-fix style issues
npm run format # Format with PrettierKey conventions:
- ESLint configuration provided in sample 08
- Prettier for code formatting
- Use modern ES6+ syntax
- Follow existing patterns in the codebase
- Fork the repository and create a new branch from
main - Make your changes following the code style guidelines
- Test thoroughly using the testing instructions above
- Commit with clear messages following conventional commits format
- Push to your fork and create a pull request
- Respond to feedback from maintainers during review
feature/<module>-<description>- For new features or contentfix/<module>-<description>- For bug fixesdocs/<description>- For documentation improvementsrefactor/<description>- For code refactoring
Follow Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer]
Examples:
feat(Module08): add intent-based routing notebook
docs(AGENTS): update Foundry Local setup instructions
fix(samples/08): resolve Electron build issue
[ModuleXX] Brief description of change
or
[Module08/samples/XX] Description for sample changes
All contributors must follow the Microsoft Open Source Code of Conduct. Please review CODE_OF_CONDUCT.md before contributing.
For content changes:
- Preview all modified Markdown files
- Verify links and images work
- Check for typos and grammatical errors
For sample code changes (Module08/samples/08):
npm run lint
npm testFor Python sample changes:
- Test the sample runs successfully
- Verify error handling works
- Check compatibility with Foundry Local
- Educational content changes are reviewed for accuracy and clarity
- Code samples are tested for functionality
- Translation updates are handled automatically by GitHub Actions
IMPORTANT: This repository uses automated translation via GitHub Actions.
- Translations are in
/translations/directory (50+ languages) - Automated via
co-op-translator.ymlworkflow - DO NOT manually edit translation files - they will be overwritten
- Edit only English source files in root and module directories
- Translations are automatically generated on push to
mainbranch
Most Module08 samples require Microsoft Foundry Local to be running.
Install Foundry Local:
# Windows
winget install Microsoft.FoundryLocal
# macOS
brew tap microsoft/foundrylocal
brew install foundrylocalInstall Python SDK:
pip install foundry-local-sdk openai# Start service and run a model (auto-downloads if needed)
foundry model run phi-3.5-mini
# Or use model aliases for automatic hardware optimization
foundry model run phi-4-mini
foundry model run qwen2.5-0.5b
foundry model run qwen2.5-coder-0.5b
# Check service status
foundry service status
# List available models
foundry model lsfrom foundry_local import FoundryLocalManager
import openai
# Use model alias for automatic hardware optimization
alias = "phi-3.5-mini"
# Create manager (auto-starts service and loads model)
manager = FoundryLocalManager(alias)
# Configure OpenAI client for local Foundry service
client = openai.OpenAI(
base_url=manager.endpoint,
api_key=manager.api_key
)
# Use the model
response = client.chat.completions.create(
model=manager.get_model_info(alias).id,
messages=[{"role": "user", "content": "Hello!"}]
)# Service status and endpoint
foundry service status
# List loaded models (REST API)
curl http://localhost:<port>/v1/models
# Note: Port is displayed when running 'foundry service status'Most samples use these environment variables:
# Foundry Local configuration
# Note: The SDK (FoundryLocalManager) automatically detects endpoint
set MODEL=phi-3.5-mini # or phi-4-mini, qwen2.5-0.5b, qwen2.5-coder-0.5b
set API_KEY= # Not required for local usage
# Manual endpoint (if not using SDK)
# Port is shown via 'foundry service status'
set BASE_URL=http://localhost:<port>
# For Azure OpenAI fallback (optional)
set AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
set AZURE_OPENAI_API_KEY=your-api-key
set AZURE_OPENAI_API_VERSION=2024-08-01-previewNote: When using FoundryLocalManager, the SDK automatically handles service discovery and model loading. Model aliases (like phi-3.5-mini) ensure the best variant is selected for your hardware.
This repository is primarily documentation - no build process required for content.
Electron Application (Module08/samples/08):
cd Module08/samples/08
# Development build
npm run dev
# Production build
npm run build
# Create Windows installer
npm run dist
# Create portable executable
npm run packPython Samples: No build process - samples are run directly with Python interpreter.
Tip: Check GitHub Issues for known problems and solutions.
Issue: Samples fail with connection errors
Solution:
# Check if service is running
foundry service status
# Start service with a model
foundry model run phi-3.5-mini
# Or explicitly start service
foundry service start
# List loaded models
foundry model ls
# Verify via REST API (port shown in 'foundry service status')
curl http://localhost:<port>/v1/modelsIssue: Module import errors
Solution:
# Ensure virtual environment is activated
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate
# Reinstall dependencies
pip install -r requirements.txtIssue: npm install or build failures
Solution:
cd Module08/samples/08
# Clean install
npm run clean
rm -rf node_modules package-lock.json
npm installIssue: Translation PR conflicts with your changes
Solution:
- Only edit English source files
- Let the automated translation workflow handle translations
- If conflicts occur, merge
maininto your branch after translations are merged
Issue: Foundry Local fails to download models
Solution:
# Check internet connectivity
# Clear model cache and retry
foundry model remove <model-alias>
foundry model run <model-alias>
# Check available disk space (models can be 2-16GB)
# Verify firewall settings allow downloads- Beginner Path: Modules 01-02 (7-9 hours)
- Intermediate Path: Modules 03-04 (9-11 hours)
- Advanced Path: Modules 05-07 (12-15 hours)
- Expert Path: Module 08 (8-10 hours)
- Module01: EdgeAI fundamentals and real-world case studies
- Module02: Small Language Model (SLM) families and architectures
- Module03: Local and cloud deployment strategies
- Module04: Model optimization with multiple frameworks
- Module05: SLMOps - production operations
- Module06: AI agents and function calling
- Module07: Platform-specific implementations
- Module08: Foundry Local toolkit with 10 comprehensive samples
- Microsoft Foundry Local - Local AI model runtime with OpenAI-compatible API
- Llama.cpp - Optimization framework
- Microsoft Olive - Model optimization toolkit
- OpenVINO - Intel's optimization toolkit
The repository includes 10 comprehensive sample applications:
- 01-REST Chat Quickstart - Basic OpenAI SDK integration
- 02-OpenAI SDK Integration - Advanced SDK features
- 03-Model Discovery & Benchmarking - Model comparison tools
- 04-Chainlit RAG Application - Retrieval-augmented generation
- 05-Multi-Agent Orchestration - Basic agent coordination
- 06-Models-as-Tools Router - Intelligent model routing
- 07-Direct API Client - Low-level API integration
- 08-Windows 11 Chat App - Native Electron desktop application
- 09-Advanced Multi-Agent System - Complex agent orchestration
- 10-Foundry Tools Framework - LangChain/Semantic Kernel integration
Each sample demonstrates different aspects of edge AI development with Foundry Local.
- SLMs are optimized for edge deployment (2-16GB RAM)
- Local inference provides 50-500ms response times
- Quantization techniques achieve 75% size reduction with 85% performance retention
- Real-time conversation capabilities with local models
- All processing happens locally - no data sent to cloud
- Suitable for privacy-sensitive applications (healthcare, finance)
- Meets data sovereignty requirements
- Foundry Local runs entirely on local hardware
- Main README: README.md - Repository overview and learning paths
- Study Guide: STUDY_GUIDE.md - Learning resources and timeline
- Support: SUPPORT.md - How to get help
- Security: SECURITY.md - Reporting security issues
- GitHub Issues: Report bugs or request features
- GitHub Discussions: Ask questions and share ideas
- Foundry Local Issues: Technical issues with Foundry Local
- Maintainers: See CODEOWNERS
- Security Issues: Follow responsible disclosure in SECURITY.md
- Microsoft Support: For enterprise support, contact Microsoft customer service
- Microsoft Learn: AI and Machine Learning Learning Paths
- Foundry Local Documentation: Official Docs
- Community Samples: Check GitHub Discussions for community contributions
This is an educational repository focused on teaching Edge AI development. The primary contribution pattern is improving educational content and adding/enhancing sample applications that demonstrate Edge AI concepts.