Spaces:
Configuration error
Configuration error
# LLMGuardian | |
[CLICK HERE FOR THE FULL PROJECT](https://github.com/Finoptimize/LLMGuardian) | |
Comprehensive LLM protection toolset aligned to addressing OWASP vulnerabilities | |
Author: [DeWitt Gibson https://www.linkedin.com/in/dewitt-gibson/](https://www.linkedin.com/in/dewitt-gibson) | |
**Full Documentaion and Usage Instructions: [DOCS](docs/README.md)** | |
**Please see the Projects and Issues tab above for completion roadmap** | |
# Project Structure | |
LLMGuardian follows a modular and secure architecture designed to provide comprehensive protection for LLM applications. Below is the detailed project structure with explanations for each component: | |
## Directory Structure | |
``` | |
LLMGuardian/ | |
βββ .github/ # GitHub specific configurations | |
β βββ workflows/ # GitHub Actions workflows | |
β βββ CODEOWNERS # Repository ownership rules | |
β βββ ISSUE_TEMPLATE/ # Issue reporting templates | |
β βββ PULL_REQUEST_TEMPLATE.md # PR guidelines | |
βββ .circleci/ # config files for using CircleCI https://circleci.com/ | |
β | |
βββ src/ # Source code | |
β βββ llmguardian/ # Main package directory | |
β βββ cli/ # Command-line interface | |
β βββ dashboard/ # Streamlit dashboard | |
β βββ core/ # Core functionality | |
β βββ scanners/ # Security scanning modules | |
β βββ defenders/ # Defense mechanisms | |
β βββ monitors/ # Monitoring components | |
β βββ api/ # API integration | |
| βββ vectors/ # Embeddings protection / supply chain vulnerabilities | |
| βββ data/ # Sensive data exposure / data poisoning | |
| βββ agency/ # Excessive agency protection | |
β βββ utils/ # Utility functions | |
β | |
βββ tests/ # Test suite | |
β βββ unit/ # Unit tests | |
β βββ integration/ # Integration tests | |
β βββ security/ # Security-specific tests | |
β | |
βββ docs/ # Documentation | |
βββ scripts/ # Utility scripts | |
βββ page/ # Files for GitHub pages | |
βββ requirements/ # Dependencies | |
βββ docker/ # Docker configurations | |
βββ config/ # Various config files | |
βββ app.py # Huggingface Space deployment | |
``` | |
## Component Details | |
### Security Components | |
1. **Scanners (`src/llmguardian/scanners/`)** | |
- Prompt injection detection | |
- Data leakage scanning | |
- Model security validation | |
- Output validation checks | |
2. **Defenders (`src/llmguardian/defenders/`)** | |
- Input sanitization | |
- Output filtering | |
- Rate limiting | |
- Token validation | |
3. **Monitors (`src/llmguardian/monitors/`)** | |
- Real-time usage tracking | |
- Threat detection | |
- Anomaly monitoring | |
4. **Vectors (`src/llmguardian/vectors/`)** | |
- Embedding weaknesses | |
- Supply chain vulnerabilities | |
- Montior vector stores | |
5. **Data (`src/llmguardian/data/`)** | |
- Sensitive information disclosure | |
- Protection from data poisoning | |
- Data sanitizing | |
6. **Agency (`src/llmguardian/agency/`)** | |
- Permission management | |
- Scope limitation | |
- Safe execution | |
### Core Components | |
7. **CLI (`src/llmguardian/cli/`)** | |
- Command-line interface | |
- Interactive tools | |
- Configuration management | |
8. **API (`src/llmguardian/api/`)** | |
- RESTful endpoints | |
- Middleware | |
- Integration interfaces | |
9. **Core (`src/llmguardian/core/`)** | |
- Configuration management | |
- Logging setup | |
- Core functionality | |
### Testing & Quality Assurance | |
10. **Tests (`tests/`)** | |
- Unit tests for individual components | |
- Integration tests for system functionality | |
- Security-specific test cases | |
- Vulnerability testing | |
### Documentation & Support | |
11. **Documentation (`docs/`)** | |
- API documentation | |
- Implementation guides | |
- Security best practices | |
- Usage examples | |
12. **Docker (`docker/`)** | |
- Containerization support | |
- Development environment | |
- Production deployment | |
### Development Tools | |
13. **Scripts (`scripts/`)** | |
- Setup utilities | |
- Development tools | |
- Security checking scripts | |
### Dashboard | |
14. **Dashboard(`src/llmguardian/dashboard/`)** | |
- Streamlit app | |
- Visualization | |
- Monitoring and control | |
## Key Files | |
- `pyproject.toml`: Project metadata and dependencies | |
- `setup.py`: Package setup configuration | |
- `requirements/*.txt`: Environment-specific dependencies | |
- `.pre-commit-config.yaml`: Code quality hooks | |
- `CONTRIBUTING.md`: Contribution guidelines | |
- `LICENSE`: MIT license terms | |
## Design Principles | |
The structure follows these key principles: | |
1. **Modularity**: Each component is self-contained and independently maintainable | |
2. **Security-First**: Security considerations are built into the architecture | |
3. **Scalability**: Easy to extend and add new security features | |
4. **Testability**: Comprehensive test coverage and security validation | |
5. **Usability**: Clear organization and documentation | |
## Getting Started with Development | |
To start working with this structure: | |
1. Fork the repository | |
2. Create and activate a virtual environment | |
3. Install dependencies from the appropriate requirements file | |
4. Run the test suite to ensure everything is working | |
5. Follow the contribution guidelines for making changes | |
## Huggingface | |
Huggingface Space Implementation: | |
https://huggingface.co/spaces/Safe-Harbor/LLMGuardian | |
1. Create FastAPI backend with: | |
- Model scanning endpoints | |
- Prompt injection detection | |
- Input/output validation | |
- Rate limiting middleware | |
- Authentication checks | |
2. Gradio UI frontend with: | |
- Model security testing interface | |
- Vulnerability scanning dashboard | |
- Real-time attack detection | |
- Configuration settings |