Repository navigation
v0.1.1
Release v0.1.1
This release introduces significant enhancements, including support for local GGUF models, improved Groq API integration, a new pytest-based test suite, and CI fixes.
✨ New Features
- GGUF Model Support: Added the ability to use local GGUF models for detection via
llama-cpp-python.- Install with the optional extra:
pip install pytector[gguf] - Initialize the detector by passing the local
.gguffile path tomodel_name_or_url. - Detection uses a basic prompting method ("Is this an attack? Yes/No") and returns
(True/False, None)as probability scores are not available. Reliability may vary depending on the model. - Note: Requires
llama-cpp-python, which may need C++ build tools (compiler, CMake) installed. See thellama-cpp-pythondocumentation for details.
- Install with the optional extra:
- Pytest Test Suite: Introduced a new test suite using
pytestlocated in thetests/directory.- Includes fixtures for different detector types and uses conditional skipping based on environment variables (
GROQ_API_KEY,PYTECTOR_TEST_GGUF_PATH) and library availability (llama-cpp-python). - Added tests for initialization errors, local models, Groq API, and GGUF models.
- Includes fixtures for different detector types and uses conditional skipping based on environment variables (
🚀 Improvements
- Groq API Integration:
- Improved error handling to catch specific
groq.APIError/groq.APIConnectionErrorand return(None, "API_ERROR"). - Enhanced response parsing to handle different response formats and return
(False, "PARSE_ERROR")if the hazard code cannot be extracted. - Made the Groq model configurable via the
groq_modelparameter in__init__. - Cleaned up
detect_injection_apisignature (removed redundant parameters).
- Improved error handling to catch specific
- Documentation: Updated
README.mdanddocs/PromptInjectionDetector.mdextensively to cover GGUF usage, prerequisites, refined Groq API details, testing instructions, and updated method signatures/examples. - Setup & Dependencies:
- Added
[gguf]and[test]extras tosetup.pyfor optional dependencies. - Removed outdated test configuration (
tests_require,setup_requires).
- Added
🐛 Fixes
- CI Workflows: Fixed GitHub Actions (
tests.yml,workflow.yml) to correctly install dependencies usingpip install -e ".[test]"and execute tests usingpytest -v. - Missing Dependency: Added
groqto the baseinstall_requireslist insetup.py.
Installation / Upgrade
pip install --upgrade pytector
# or for GGUF support:
pip install --upgrade pytector[gguf]