muhammadbinmurtza commited on
Commit Β·
913a064
1
Parent(s): 9a280b0
Restructure: clauseguard as package subfolder, app_file: clauseguard/app.py
Browse files- .gitattributes +0 -35
- .gitignore +0 -4
- README.md +20 -81
- {.streamlit β clauseguard/.streamlit}/config.toml +0 -0
- __init__.py β clauseguard/__init__.py +0 -0
- {agents β clauseguard/agents}/__init__.py +0 -0
- {agents β clauseguard/agents}/classifier.py +0 -0
- {agents β clauseguard/agents}/copilot.py +0 -0
- {agents β clauseguard/agents}/extractor.py +0 -0
- {agents β clauseguard/agents}/orchestrator.py +0 -0
- {agents β clauseguard/agents}/reporter.py +0 -0
- {agents β clauseguard/agents}/risk_scorer.py +0 -0
- {agents β clauseguard/agents}/translator.py +0 -0
- app.py β clauseguard/app.py +0 -0
- {config β clauseguard/config}/__init__.py +0 -0
- {config β clauseguard/config}/copilot_prompts.py +0 -0
- {config β clauseguard/config}/prompts.py +0 -0
- {config β clauseguard/config}/settings.py +0 -0
- main.py β clauseguard/main.py +0 -0
- {models β clauseguard/models}/__init__.py +0 -0
- {models β clauseguard/models}/clause.py +0 -0
- {models β clauseguard/models}/findings.py +0 -0
- {models β clauseguard/models}/report.py +0 -0
- {sample_contracts β clauseguard/sample_contracts}/sample_employment.txt +0 -0
- {sample_contracts β clauseguard/sample_contracts}/sample_freelance.txt +0 -0
- {sample_contracts β clauseguard/sample_contracts}/sample_nda.txt +0 -0
- {services β clauseguard/services}/__init__.py +0 -0
- {services β clauseguard/services}/model_service.py +0 -0
- {tests β clauseguard/tests}/__init__.py +0 -0
- {tests β clauseguard/tests}/test_extractor.py +0 -0
- {tests β clauseguard/tests}/test_pipeline.py +0 -0
- {tests β clauseguard/tests}/test_risk_scorer.py +0 -0
- {tools β clauseguard/tools}/__init__.py +0 -0
- {tools β clauseguard/tools}/clause_tools.py +0 -0
- {tools β clauseguard/tools}/file_tools.py +0 -0
- {tools β clauseguard/tools}/report_tools.py +0 -0
.gitattributes
DELETED
|
@@ -1,35 +0,0 @@
|
|
| 1 |
-
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.gitignore
CHANGED
|
@@ -2,7 +2,3 @@ __pycache__/
|
|
| 2 |
.pytest_cache/
|
| 3 |
.env
|
| 4 |
*.pyc
|
| 5 |
-
report.md
|
| 6 |
-
clauseGuard-AI/
|
| 7 |
-
documents/
|
| 8 |
-
frontend/
|
|
|
|
| 2 |
.pytest_cache/
|
| 3 |
.env
|
| 4 |
*.pyc
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -5,7 +5,7 @@ colorFrom: indigo
|
|
| 5 |
colorTo: purple
|
| 6 |
sdk: streamlit
|
| 7 |
sdk_version: "1.31.0"
|
| 8 |
-
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
---
|
|
@@ -19,100 +19,39 @@ Upload any contract (PDF, TXT, DOCX). ClauseGuard runs it through a 5-agent AI p
|
|
| 19 |
**5-Agent AI Pipeline:** Extractor β Classifier β Risk Scorer β Translator β Reporter
|
| 20 |
|
| 21 |
```
|
|
|
|
|
|
|
|
|
|
| 22 |
ββββββββββββ βββββββββββββ βββββββββββββββ ββββββββββββββββ ββββββββββββ
|
| 23 |
-
β
|
| 24 |
-
β (Agent 1)β β (Agent 2) β β (Agent 3)
|
| 25 |
ββββββββββββ βββββββββββββ βββββββββββββββ ββββββββββββββββ ββββββββββββ
|
| 26 |
-
β β β β β
|
| 27 |
-
βΌ βΌ βΌ βΌ βΌ
|
| 28 |
-
Split text Assign types Score severity Plain English Final markdown
|
| 29 |
-
into clauses + contract per clause + actions report
|
| 30 |
-
type
|
| 31 |
```
|
| 32 |
|
| 33 |
-
|
| 34 |
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
-
- [DeepSeek API key](https://platform.deepseek.com/) (OpenAI-compatible endpoint)
|
| 39 |
-
|
| 40 |
-
## Setup
|
| 41 |
|
| 42 |
```bash
|
| 43 |
-
# Clone the repository
|
| 44 |
-
git clone <repo-url>
|
| 45 |
-
cd clauseguard
|
| 46 |
-
|
| 47 |
-
# Install dependencies
|
| 48 |
pip install -r requirements.txt
|
| 49 |
-
|
| 50 |
-
# Configure your API key
|
| 51 |
-
cp .env.example .env
|
| 52 |
-
# Edit .env and add your DEEPSEEK_API_KEY
|
| 53 |
-
```
|
| 54 |
-
|
| 55 |
-
## Usage
|
| 56 |
-
|
| 57 |
-
### CLI
|
| 58 |
-
|
| 59 |
-
```bash
|
| 60 |
-
python main.py --file sample_contracts/sample_nda.txt
|
| 61 |
-
python main.py --file sample_contracts/sample_nda.txt --output my_report.md
|
| 62 |
-
```
|
| 63 |
-
|
| 64 |
-
### Streamlit UI
|
| 65 |
-
|
| 66 |
-
```bash
|
| 67 |
-
streamlit run app.py
|
| 68 |
```
|
| 69 |
|
| 70 |
-
|
| 71 |
|
| 72 |
-
|
| 73 |
|
| 74 |
-
```bash
|
| 75 |
-
pytest tests/ -v
|
| 76 |
```
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
```markdown
|
| 81 |
-
# ClauseGuard Risk Report
|
| 82 |
-
**Contract:** sample_nda.txt
|
| 83 |
-
**Type:** NDA
|
| 84 |
-
**Overall Risk Score:** 5.0/10
|
| 85 |
-
|
| 86 |
-
## Top 3 Actions Before Signing
|
| 87 |
-
1. Demand a carve-out for inventions created on own time using own equipment
|
| 88 |
-
2. Negotiate to limit the non-compete to specific geographic regions
|
| 89 |
-
3. Negotiate to add an opt-out clause for arbitration
|
| 90 |
-
|
| 91 |
-
## Risk Summary
|
| 92 |
-
| Severity | Count |
|
| 93 |
-
|----------|-------|
|
| 94 |
-
| π΄ Critical | 1 |
|
| 95 |
-
| π High | 2 |
|
| 96 |
-
| π‘ Medium | 1 |
|
| 97 |
-
| π’ Low | 2 |
|
| 98 |
-
| βΉοΈ Info | 2 |
|
| 99 |
-
```
|
| 100 |
-
|
| 101 |
-
## AMD Developer Cloud Deployment
|
| 102 |
-
|
| 103 |
-
ClauseGuard is designed to run on AMD Developer Cloud infrastructure. The DeepSeek API provides the LLM backend, and the application itself is a lightweight Python service suitable for containerized deployment.
|
| 104 |
-
|
| 105 |
-
### Docker deployment
|
| 106 |
-
|
| 107 |
-
```dockerfile
|
| 108 |
-
FROM python:3.11-slim
|
| 109 |
-
WORKDIR /app
|
| 110 |
-
COPY requirements.txt .
|
| 111 |
-
RUN pip install -r requirements.txt
|
| 112 |
-
COPY . .
|
| 113 |
-
ENV STREAMLIT_SERVER_PORT=8501
|
| 114 |
-
EXPOSE 8501
|
| 115 |
-
CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0"]
|
| 116 |
```
|
| 117 |
|
| 118 |
## License
|
|
|
|
| 5 |
colorTo: purple
|
| 6 |
sdk: streamlit
|
| 7 |
sdk_version: "1.31.0"
|
| 8 |
+
app_file: clauseguard/app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
---
|
|
|
|
| 19 |
**5-Agent AI Pipeline:** Extractor β Classifier β Risk Scorer β Translator β Reporter
|
| 20 |
|
| 21 |
```
|
| 22 |
+
Upload Contract
|
| 23 |
+
β
|
| 24 |
+
βΌ
|
| 25 |
ββββββββββββ βββββββββββββ βββββββββββββββ ββββββββββββββββ ββββββββββββ
|
| 26 |
+
βExtractor βββββΆβClassifier βββββΆβ Risk Scorer βββββΆβ Translator βββββΆβ Reporter β
|
| 27 |
+
β (Agent 1)β β (Agent 2) β β (Agent 3) β β (Agent 4) β β(Agent 5) β
|
| 28 |
ββββββββββββ βββββββββββββ βββββββββββββββ ββββββββββββββββ ββββββββββββ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
```
|
| 30 |
|
| 31 |
+
## Features
|
| 32 |
|
| 33 |
+
- **5-Agent AI Pipeline** β Extractor, Classifier, Risk Scorer, Translator, Reporter
|
| 34 |
+
- **Risk Severity Levels** β CRITICAL, HIGH, MEDIUM, LOW, INFO
|
| 35 |
+
- **Plain English Translations** β Every clause explained in simple language
|
| 36 |
+
- **Negotiation Copilot** β Pre-written messages and safer clause alternatives
|
| 37 |
+
- **AI Chat Assistant** β Full contract context chat for follow-up questions
|
| 38 |
+
- **Multi-format Downloads** β Markdown, CSV, and safer contract
|
| 39 |
|
| 40 |
+
## Quick Start
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
```bash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
pip install -r requirements.txt
|
| 44 |
+
streamlit run clauseguard/app.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
```
|
| 46 |
|
| 47 |
+
## Configuration
|
| 48 |
|
| 49 |
+
Set environment variables or create a `.env` file:
|
| 50 |
|
|
|
|
|
|
|
| 51 |
```
|
| 52 |
+
API_KEY=EMPTY
|
| 53 |
+
BASE_URL=http://165.245.141.170:8000/v1
|
| 54 |
+
MODEL_NAME=Qwen/Qwen2.5-1.5B-Instruct
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
```
|
| 56 |
|
| 57 |
## License
|
{.streamlit β clauseguard/.streamlit}/config.toml
RENAMED
|
File without changes
|
__init__.py β clauseguard/__init__.py
RENAMED
|
File without changes
|
{agents β clauseguard/agents}/__init__.py
RENAMED
|
File without changes
|
{agents β clauseguard/agents}/classifier.py
RENAMED
|
File without changes
|
{agents β clauseguard/agents}/copilot.py
RENAMED
|
File without changes
|
{agents β clauseguard/agents}/extractor.py
RENAMED
|
File without changes
|
{agents β clauseguard/agents}/orchestrator.py
RENAMED
|
File without changes
|
{agents β clauseguard/agents}/reporter.py
RENAMED
|
File without changes
|
{agents β clauseguard/agents}/risk_scorer.py
RENAMED
|
File without changes
|
{agents β clauseguard/agents}/translator.py
RENAMED
|
File without changes
|
app.py β clauseguard/app.py
RENAMED
|
File without changes
|
{config β clauseguard/config}/__init__.py
RENAMED
|
File without changes
|
{config β clauseguard/config}/copilot_prompts.py
RENAMED
|
File without changes
|
{config β clauseguard/config}/prompts.py
RENAMED
|
File without changes
|
{config β clauseguard/config}/settings.py
RENAMED
|
File without changes
|
main.py β clauseguard/main.py
RENAMED
|
File without changes
|
{models β clauseguard/models}/__init__.py
RENAMED
|
File without changes
|
{models β clauseguard/models}/clause.py
RENAMED
|
File without changes
|
{models β clauseguard/models}/findings.py
RENAMED
|
File without changes
|
{models β clauseguard/models}/report.py
RENAMED
|
File without changes
|
{sample_contracts β clauseguard/sample_contracts}/sample_employment.txt
RENAMED
|
File without changes
|
{sample_contracts β clauseguard/sample_contracts}/sample_freelance.txt
RENAMED
|
File without changes
|
{sample_contracts β clauseguard/sample_contracts}/sample_nda.txt
RENAMED
|
File without changes
|
{services β clauseguard/services}/__init__.py
RENAMED
|
File without changes
|
{services β clauseguard/services}/model_service.py
RENAMED
|
File without changes
|
{tests β clauseguard/tests}/__init__.py
RENAMED
|
File without changes
|
{tests β clauseguard/tests}/test_extractor.py
RENAMED
|
File without changes
|
{tests β clauseguard/tests}/test_pipeline.py
RENAMED
|
File without changes
|
{tests β clauseguard/tests}/test_risk_scorer.py
RENAMED
|
File without changes
|
{tools β clauseguard/tools}/__init__.py
RENAMED
|
File without changes
|
{tools β clauseguard/tools}/clause_tools.py
RENAMED
|
File without changes
|
{tools β clauseguard/tools}/file_tools.py
RENAMED
|
File without changes
|
{tools β clauseguard/tools}/report_tools.py
RENAMED
|
File without changes
|