A Python library that provides one unified API to call different inference providers. This project simplifies the integration of various AI/ML inference services by providing a consistent interface, reducing the complexity of switching between different providers or using multiple providers simultaneously.
- Unified API: Single interface for multiple inference providers
- Local & Cloud Support: Work with both local models (Ollama) and cloud services (OpenAI, etc.)
- Chat-based Interactions: Multi-turn conversation support with context management
- Robust Error Handling: Comprehensive error handling with actionable feedback
- Type Safety: Full type hints and validation
- Extensible: Easy to add new inference providers
# Install latest main branch
pip install git+https://github.com/your-org/inference-client.git
# Install specific branch
pip install git+https://github.com/your-org/inference-client.git@develop
# Install specific tag/release
pip install git+https://github.com/your-org/inference-client.git@v1.0.0
# Install specific commit
pip install git+https://github.com/your-org/inference-client.git@a1b2c3d# Install with development dependencies
pip install "inference-client[dev]"
# Install all optional dependencies
pip install "inference-client[all]"Ollama enables local inference with various open-source models.
Prerequisites:
- Install Ollama from https://ollama.com/
- Start Ollama service:
ollama serve - Pull a model:
ollama pull llama2:7b
# Build source distribution and wheel
python -m build --sdist --wheel --outdir dist
# Validate the package
check-wheel-contents dist/*.whl
twine check dist/*# Run tests
pytest
# Run tests with coverage
pytest --cov=inference_client --cov-report=html
# Run tests with verbose output
pytest -v
# Run specific test file
pytest tests/test_client.py
# Run tests with coverage and generate report
pytest --cov=inference_client --cov-report=html --cov-report=term
### Version management
This project uses [setuptools-scm](https://github.com/pypa/setuptools_scm) for automatic version management from git tags:
```bash
# Create a release tag
git tag v1.0.0
git push origin v1.0.0
# Development version (automatically generated)
# Format: 1.0.0.devN+gHASH.dDATEThis project uses OpenSpec for spec-driven development. See AGENTS.md for contribution guidelines.
MIT License - see LICENSE file for details.