Spaces:
Runtime error
Runtime error
File size: 5,895 Bytes
87c817a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | # Quick Start: Fraud Assistant with Confluence Integration
Follow these steps to add Confluence search to your fraud explainability assistant in **under 10 minutes**.
---
## TL;DR (For the Impatient)
```bash
# 1. Install dependencies
pip install -r requirements-with-confluence.txt
# 2. Create .env file with your Confluence credentials
cp .env.example .env
nano .env # Add your Confluence URL, email, and API token
# 3. Test it
python confluence_integration_example.py
```
Then ask: **"What does our fair lending policy say about synthetic ID detection?"**
---
## Step-by-Step Setup
### Step 1: Get Confluence API Token (2 minutes)
1. Go to https://id.atlassian.com/manage-profile/security/api-tokens
2. Click **"Create API token"**
3. Label it: "Fraud Assistant"
4. **Copy the token** (you won't see it again!)
### Step 2: Configure Environment (1 minute)
```bash
cd fraud_model_explainability_assistant
# Copy example file
cp .env.example .env
# Edit with your credentials
nano .env # or use your preferred editor
```
**Edit these 3 lines** in `.env`:
```bash
CONFLUENCE_URL=https://yourcompany.atlassian.net # YOUR Confluence URL
CONFLUENCE_EMAIL=your.email@company.com # YOUR email
CONFLUENCE_API_TOKEN=ATATT3xFfGF0... # YOUR token (paste here)
```
Save and close.
### Step 3: Install Dependencies (2 minutes)
```bash
# Install everything needed
pip install -r requirements-with-confluence.txt
# Verify installation
python -c "from confluence_ingestor import ConfluenceRAG; print('β
Ready!')"
```
### Step 4: Identify Confluence Spaces (1 minute)
Find the "space keys" for your Confluence spaces:
1. Open your Confluence
2. Go to a space
3. Look at the URL: `https://yourcompany.atlassian.net/wiki/spaces/SPACEKEY/`
4. The `SPACEKEY` is what you need
**Recommended spaces**:
- Model governance docs (e.g., `fraud-model-governance`)
- Compliance policies (e.g., `compliance-policies`)
- Investigation playbooks (e.g., `fraud-investigation`)
### Step 5: Update Space Keys in Code (1 minute)
Edit `confluence_integration_example.py` line 88:
```python
spaces = {
"your-governance-space": 100, # Replace with YOUR space key
"your-compliance-space": 50, # Replace with YOUR space key
"your-playbooks-space": 75, # Replace with YOUR space key
}
```
### Step 6: Run Initial Ingestion (5 minutes)
This downloads and indexes your Confluence content (one-time):
```bash
python confluence_integration_example.py
```
**What happens**:
1. Connects to Confluence β
2. Downloads pages from your spaces (~5 min)
3. Creates searchable vector database
4. Launches web UI
**First time only**: Downloads ~400MB ML model (free, runs locally)
### Step 7: Test It! (1 minute)
1. Open http://localhost:7860 in your browser
2. Try these questions:
**Question 1** (tests Confluence search):
```
What does our fair lending policy say about phone type features?
```
**Question 2** (tests fraud analysis):
```
Why was application APP-78432 flagged as high risk?
```
**Question 3** (tests compliance with policy citation):
```
Check fair lending compliance for APP-55555 and cite relevant policies
```
If the agent cites specific Confluence pages in its response, **it's working!** π
---
## What You Just Built
Your fraud assistant now has access to:
- β
Company fair lending policies
- β
Model governance documentation
- β
Investigation procedures
- β
Compliance guidelines
- β
Historical precedents
**Use cases unlocked**:
- Executive briefings with policy citations
- Regulatory examination support
- Analyst training and investigation support
- Audit trail documentation
---
## Troubleshooting
### "3 validation errors for ConfluenceConfig"
**Problem**: Missing Confluence credentials
**Fix**:
```bash
# Check if .env exists
ls -la .env
# If missing:
cp .env.example .env
# Edit with your credentials
nano .env
# Verify:
cat .env | grep CONFLUENCE
```
### "401 Unauthorized"
**Problem**: Wrong email or API token
**Fix**:
1. Re-generate API token at https://id.atlassian.com/manage-profile/security/api-tokens
2. Double-check email is correct
3. Remove any extra spaces in `.env`
### "Space 'xyz' not found"
**Problem**: Space key doesn't exist or you don't have access
**Fix**:
1. Check the space key in Confluence URL
2. Verify you can view the space when logged in
3. Update space keys in `confluence_integration_example.py` line 88
### "Module not found: confluence_ingestor"
**Problem**: Package not installed
**Fix**:
```bash
pip install -r requirements-with-confluence.txt
```
---
## Next Steps
Once it's working:
1. **Add more spaces**: Edit the `spaces` dict in the code
2. **Customize prompts**: Update `ENHANCED_PROMPT` for your use case
3. **Set up auto-updates**: See `CONFLUENCE_INTEGRATION_ANALYSIS.md`
4. **Share with team**: Deploy on internal server
5. **Monitor usage**: Track which policies are searched most
---
## Full Documentation
- **Detailed Setup**: See `CONFLUENCE_SETUP_GUIDE.md`
- **Architecture & ROI**: See `CONFLUENCE_INTEGRATION_ANALYSIS.md`
- **Confluence-Ingestor Docs**: See `../confluence-ingestor/README.md`
---
## Summary Checklist
- [ ] Get Confluence API token (2 min)
- [ ] Create `.env` with credentials (1 min)
- [ ] Install dependencies (2 min)
- [ ] Find your Confluence space keys (1 min)
- [ ] Update space keys in code (1 min)
- [ ] Run initial ingestion (5 min)
- [ ] Test with sample questions (1 min)
**Total Time**: ~10 minutes
---
## Support
**Having issues?** Check:
1. `CONFLUENCE_SETUP_GUIDE.md` - Detailed troubleshooting
2. `CONFLUENCE_INTEGRATION_ANALYSIS.md` - Architecture details
3. The "Troubleshooting" section above
**Still stuck?** Review the error message - it usually tells you what's missing!
---
**You're done!** Your fraud assistant can now search company documentation and cite specific policies. π
|