๐ค Contributing to Hands-On AI¶
Thanks for your interest in contributing to Hands-On AI! Whether you're fixing a typo, writing a bot, improving documentation, or adding a new feature โ you're welcome here.
Ways to Contribute¶
There are many ways to contribute to Hands-On AI:
- Add new bot personalities: Create creative, educational, or specialised bot personalities for the chat module.
- Enhance RAG capabilities: Improve document processing, indexing, or retrieval in the RAG module.
- Extend agent functionality: Add new tools or capabilities to the agent module.
- Bug fixes: Help identify and fix bugs in the existing codebase.
- Documentation: Improve the project documentation, tutorials, or examples.
- Feature enhancements: Add new features or enhance existing ones.
- Educational content: Create classroom activities, lesson plans, or educational guides.
๐งฐ Development Setup¶
- Fork the repository: Create your own fork of the Hands-On AI repository.
- Clone your fork:
git clone https://github.com/your-username/hands-on-ai.git
- Install Python 3.8 or higher.
- Install dev dependencies:
Or install in development mode:
pip install -r requirements-dev.txt
pip install -e ".[dev]"
- For testing LLM functionality: Install Ollama or configure another LLM backend.
๐ง Common Commands¶
Use either just <task>
or make <task>
:
Task | Description |
---|---|
test |
Run all tests using pytest |
test-basic |
Run basic imports test |
lint |
Lint code with Ruff |
format |
Auto-format with Ruff |
build |
Build the Python package |
bundle |
Create offline zip bundle |
sync-version |
Sync version across files |
docs |
Build static site with MkDocs |
deploy-docs |
Deploy to GitHub Pages |
chat-repl |
Start chat module in interactive mode |
rag-repl |
Start RAG module in interactive mode |
agent-repl |
Start agent module in interactive mode |
chat-web |
Start chat web interface |
rag-web |
Start RAG web interface |
Development Workflow¶
- Create a branch:
git checkout -b my-contribution
- Make your changes: Implement your contribution.
- Test your changes: Ensure your code works as expected.
- Submit a pull request: Push your changes to your fork and open a pull request.
Code Style Guidelines¶
- Follow PEP 8 style guidelines for Python code.
- Use clear, descriptive variable and function names.
- Include docstrings for all functions, classes, and modules.
- Add comments for complex or non-obvious code sections.
- Keep lines to a maximum of 100 characters.
๐ค Adding a New Bot Personality¶
To add a new bot personality to the chat module:
- Decide whether your bot fits into an existing personality category (educational, creative, technical, etc.)
- Create a new bot file in the appropriate directory:
- For a standard category bot:
src/hands-on-ai/chat/personalities/your_bot.py
- For a specialised bot:
src/hands-on-ai/chat/personalities/bots/your_bot.py
- Follow the pattern:
def your_bot_name(prompt): """Your bot description. Usage: from hands_on_ai.chat import your_bot_name your_bot_name("Your prompt here") Educational uses: - List educational applications Example: >>> your_bot_name("Hello!") "Your example response" """ from hands_on_ai.chat.get_response import get_response return get_response( prompt, system="Your system prompt here.", personality="your_personality_name" )
- Import and expose your bot in the appropriate
__init__.py
files: - Add to the category's
__init__.py
- Make sure it's imported in
src/hands-on-ai/chat/personalities/__init__.py
- Include it in
src/hands-on-ai/chat/__init__.py
- Add appropriate fallback messages in
src/hands-on-ai/chat/data/fallbacks.json
. - Document your bot in the appropriate documentation files.
๐ Extending RAG Module¶
To extend the RAG (Retrieval-Augmented Generation) capabilities:
- Understand the existing components:
- Document loading and processing in
src/hands-on-ai/rag/utils.py
- Index creation and searching functionality
- Query processing and response generation
- Consider adding:
- New document format support
- Improved chunking strategies
- Enhanced embedding techniques
- Better retrieval algorithms
- UI/UX improvements for the web interface
- Ensure your changes:
- Handle errors gracefully
- Scale well with larger document collections
- Maintain or improve search quality
๐ ๏ธ Extending Agent Module¶
To extend the agent module with new tools or capabilities:
- Add new tools to
src/hands-on-ai/agent/tools/
- Follow the existing tool pattern
- Update the relevant command handlers in
src/hands-on-ai/agent/commands/
- Document your new tools and their capabilities
- Ensure your tools work well with the agent framework
Adding Documentation¶
If you're adding documentation:
- Place general documentation in the
docs/
directory. - Ensure educational materials are appropriate for classroom use.
- Include clear examples and explanations.
- Specify the target audience (grade level, experience level).
- Module documentation should be added to the appropriate section.
๐งช Testing¶
Before submitting a pull request:
- Add your tests in
tests/
. - For bots, test both:
- Basic output (non-empty)
- Empty prompt handling
- For RAG extensions, test:
- Document processing
- Search functionality
- Edge cases with unusual inputs
- For agent tools, test:
- Input validation
- Error handling
- Expected outputs
- Test your code with multiple inputs.
- Ensure it works with the default Ollama backend.
- Check for any error conditions or edge cases.
Pull Request Process¶
- Update the documentation with details of changes if applicable.
- Update the version number following Semantic Versioning.
- Your pull request will be reviewed by maintainers who may request changes.
- Once approved, your pull request will be merged.
Code of Conduct¶
Please note that this project follows standard open-source community guidelines for respectful and inclusive participation. By contributing to this project, you agree to maintain a positive and supportive environment for all participants.
Questions?¶
If you have questions about contributing, open an issue in the repository or contact the maintainers directly.
โค๏ธ Thanks¶
Thanks for helping make Hands-On AI better for educators and students everywhere!