Thank you for your interest in contributing to the LLM IO Intelligence plugin! This document provides guidelines and information for contributors.
- Python 3.8 or higher
- Git
- An IO Intelligence API key
-
Clone the repository:
git clone <repository-url> cd llm-io-intelligence
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Install the plugin in development mode:
llm install -e . -
Set up environment variables:
export IOINTELLIGENCE_API_KEY="your-api-key-here"
We use pytest for testing. Run the full test suite:
# Run all tests
pytest -vv --tb=short --maxfail=1
# Run specific test class
pytest -vv test_io_intelligence.py::TestIOIntelligenceModel
# Run with coverage
pytest --cov=llm_io_intelligence --cov-report=htmltest_io_intelligence.py- Main test suitetest_streaming.py- Streaming functionality testsdirect_streaming_test.py- Direct streaming tests
When adding new features:
- Write tests first (TDD approach)
- Test edge cases and error conditions
- Mock external API calls to avoid hitting rate limits
- Use descriptive test names that explain what is being tested
- Follow the existing test patterns in the codebase
Example test structure:
class TestNewFeature:
def setup_method(self):
self.model = IOIntelligenceModel("test-model", "test", 1000)
@patch.dict(os.environ, {"IOINTELLIGENCE_API_KEY": "test-key"})
def test_new_feature_success(self):
# Test implementation
pass
def test_new_feature_error_handling(self):
# Test error cases
pass- Follow PEP 8 style guidelines
- Use type hints where appropriate
- Write docstrings for public functions and classes
- Keep functions focused and small
- Use descriptive variable and function names
We recommend using:
blackfor code formattingisortfor import sortingflake8for linting
# Format code
black llm_io_intelligence.py test_io_intelligence.py
# Sort imports
isort llm_io_intelligence.py test_io_intelligence.py
# Lint code
flake8 llm_io_intelligence.pyTo add support for new models:
-
Update the models list in
register_models():models = [ # ... existing models ... ("new-model-id", "provider/full-model-name", context_length), ]
-
Add tests for the new model:
def test_new_model_registration(self): # Test that the model is properly registered pass
-
Update documentation in README.md
-
Test the model manually to ensure it works
- Create an issue describing the feature
- Fork the repository and create a feature branch
- Implement the feature with tests
- Update documentation as needed
- Submit a pull request
When working with vision features:
- Test with multiple image formats (JPEG, PNG, GIF, WebP)
- Test with both URLs and local files
- Handle base64 encoding properly
- Test with multiple attachments
- Ensure proper error handling for unsupported formats
- Maintain OpenAI API compatibility
- Follow existing patterns for options and parameters
- Ensure backward compatibility when possible
- Document any breaking changes
When adding features:
- Update the features list
- Add usage examples
- Update the model list if applicable
- Add any new configuration options
- Write clear docstrings for public APIs
- Include type hints
- Document complex algorithms or logic
- Add inline comments for non-obvious code
- Run all tests and ensure they pass
- Update documentation as needed
- Add tests for new functionality
- Follow code style guidelines
- Write clear commit messages
## Description
Brief description of the changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Tests pass locally
- [ ] New tests added for new functionality
- [ ] Manual testing completed
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes (or documented)
We follow Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
- Update version in
pyproject.toml - Update
CHANGELOG.md - Run full test suite
- Create release tag
- Update documentation
- Issues: Create a GitHub issue for bugs or feature requests
- Discussions: Use GitHub Discussions for questions
- Documentation: Check the README and code comments
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn and grow
- Follow the project's coding standards
Thank you for contributing to the LLM IO Intelligence plugin!