Spaces:
Runtime error
Runtime error
The fraud assistant is ready to run with Confluence integration
Browse files- .env.example +27 -0
- confluence_integration_example.py +28 -1
- docs/CONFLUENCE_SETUP_GUIDE.md +499 -0
- docs/QUICK_START.md +243 -0
- requirements-with-confluence.txt +38 -0
.env.example
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Confluence Configuration (Required for Confluence Integration)
|
| 2 |
+
# Follow the setup guide in CONFLUENCE_SETUP_GUIDE.md
|
| 3 |
+
|
| 4 |
+
# Confluence Instance URL (your company's Confluence)
|
| 5 |
+
CONFLUENCE_URL=https://yourcompany.atlassian.net
|
| 6 |
+
|
| 7 |
+
# Confluence User Email (use a service account)
|
| 8 |
+
CONFLUENCE_EMAIL=fraud-bot@yourcompany.com
|
| 9 |
+
|
| 10 |
+
# Confluence API Token (generate at: https://id.atlassian.com/manage-profile/security/api-tokens)
|
| 11 |
+
CONFLUENCE_API_TOKEN=your_api_token_here
|
| 12 |
+
|
| 13 |
+
# Embedding Provider (use "huggingface" for free local embeddings)
|
| 14 |
+
EMBEDDING_PROVIDER=huggingface
|
| 15 |
+
|
| 16 |
+
# Vector Store Configuration (ChromaDB is default and recommended)
|
| 17 |
+
VECTOR_STORE_TYPE=chroma
|
| 18 |
+
CHROMA_PERSIST_DIRECTORY=./chroma_db
|
| 19 |
+
|
| 20 |
+
# Optional: LLM Configuration
|
| 21 |
+
# If not set, defaults to AWS Bedrock (requires AWS credentials)
|
| 22 |
+
OPENAI_API_KEY=your_openai_key_here
|
| 23 |
+
|
| 24 |
+
# Optional: AWS Configuration (if using Bedrock)
|
| 25 |
+
# AWS_ACCESS_KEY_ID=your_aws_access_key
|
| 26 |
+
# AWS_SECRET_ACCESS_KEY=your_aws_secret_key
|
| 27 |
+
# AWS_DEFAULT_REGION=us-west-2
|
confluence_integration_example.py
CHANGED
|
@@ -5,7 +5,12 @@ This example shows minimal changes needed to add Confluence document search
|
|
| 5 |
to your existing fraud explainability assistant.
|
| 6 |
|
| 7 |
Installation:
|
| 8 |
-
pip install
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
Environment Variables (.env):
|
| 11 |
CONFLUENCE_URL=https://yourcompany.atlassian.net
|
|
@@ -17,6 +22,14 @@ Environment Variables (.env):
|
|
| 17 |
import os
|
| 18 |
from typing import Optional
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
import gradio as gr
|
| 21 |
from strands import Agent
|
| 22 |
from strands.models.openai import OpenAIModel
|
|
@@ -51,6 +64,20 @@ def init_confluence():
|
|
| 51 |
if _confluence_rag is None:
|
| 52 |
print("π§ Initializing Confluence integration...")
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
# Create RAG pipeline with free local embeddings
|
| 55 |
_confluence_rag = ConfluenceRAG.from_env(
|
| 56 |
embedding_provider="huggingface", # Free, runs locally
|
|
|
|
| 5 |
to your existing fraud explainability assistant.
|
| 6 |
|
| 7 |
Installation:
|
| 8 |
+
pip install -r requirements-with-confluence.txt
|
| 9 |
+
|
| 10 |
+
Setup:
|
| 11 |
+
1. Copy .env.example to .env
|
| 12 |
+
2. Edit .env with your Confluence credentials
|
| 13 |
+
3. See CONFLUENCE_SETUP_GUIDE.md for detailed instructions
|
| 14 |
|
| 15 |
Environment Variables (.env):
|
| 16 |
CONFLUENCE_URL=https://yourcompany.atlassian.net
|
|
|
|
| 22 |
import os
|
| 23 |
from typing import Optional
|
| 24 |
|
| 25 |
+
# Load environment variables from .env file
|
| 26 |
+
try:
|
| 27 |
+
from dotenv import load_dotenv
|
| 28 |
+
load_dotenv() # Load .env file if it exists
|
| 29 |
+
except ImportError:
|
| 30 |
+
print("β Warning: python-dotenv not installed. Install with: pip install python-dotenv")
|
| 31 |
+
print(" Environment variables must be set manually.")
|
| 32 |
+
|
| 33 |
import gradio as gr
|
| 34 |
from strands import Agent
|
| 35 |
from strands.models.openai import OpenAIModel
|
|
|
|
| 64 |
if _confluence_rag is None:
|
| 65 |
print("π§ Initializing Confluence integration...")
|
| 66 |
|
| 67 |
+
# Check if required environment variables are set
|
| 68 |
+
required_vars = ["CONFLUENCE_URL", "CONFLUENCE_EMAIL", "CONFLUENCE_API_TOKEN"]
|
| 69 |
+
missing_vars = [var for var in required_vars if not os.getenv(var)]
|
| 70 |
+
|
| 71 |
+
if missing_vars:
|
| 72 |
+
print(f"\nβ ERROR: Missing required environment variables: {', '.join(missing_vars)}")
|
| 73 |
+
print("\nπ Setup Instructions:")
|
| 74 |
+
print(" 1. Copy .env.example to .env:")
|
| 75 |
+
print(" cp .env.example .env")
|
| 76 |
+
print(" 2. Edit .env with your Confluence credentials")
|
| 77 |
+
print(" 3. See CONFLUENCE_SETUP_GUIDE.md for detailed setup instructions")
|
| 78 |
+
print("\nβ App will run WITHOUT Confluence integration.\n")
|
| 79 |
+
raise ValueError(f"Missing Confluence credentials: {', '.join(missing_vars)}")
|
| 80 |
+
|
| 81 |
# Create RAG pipeline with free local embeddings
|
| 82 |
_confluence_rag = ConfluenceRAG.from_env(
|
| 83 |
embedding_provider="huggingface", # Free, runs locally
|
docs/CONFLUENCE_SETUP_GUIDE.md
ADDED
|
@@ -0,0 +1,499 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Confluence Integration Setup Guide
|
| 2 |
+
|
| 3 |
+
This guide walks you through setting up Confluence integration for the Fraud Model Explainability Assistant.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## Prerequisites
|
| 8 |
+
|
| 9 |
+
- Access to a Confluence instance (Atlassian Cloud or Data Center)
|
| 10 |
+
- Permission to create API tokens
|
| 11 |
+
- Permission to read the Confluence spaces you want to search
|
| 12 |
+
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
## Step 1: Get Confluence API Credentials
|
| 16 |
+
|
| 17 |
+
### Option A: Atlassian Cloud (Most Common)
|
| 18 |
+
|
| 19 |
+
1. **Get your Confluence URL**:
|
| 20 |
+
- Go to your Confluence instance
|
| 21 |
+
- Copy the URL (e.g., `https://yourcompany.atlassian.net`)
|
| 22 |
+
|
| 23 |
+
2. **Create an API Token**:
|
| 24 |
+
- Go to https://id.atlassian.com/manage-profile/security/api-tokens
|
| 25 |
+
- Click **"Create API token"**
|
| 26 |
+
- Give it a label (e.g., "Fraud Assistant")
|
| 27 |
+
- Copy the token (you won't be able to see it again!)
|
| 28 |
+
|
| 29 |
+
3. **Get your email**:
|
| 30 |
+
- Use the email address associated with your Atlassian account
|
| 31 |
+
- Recommendation: Create a service account (e.g., `fraud-bot@yourcompany.com`)
|
| 32 |
+
|
| 33 |
+
### Option B: Confluence Data Center (Self-Hosted)
|
| 34 |
+
|
| 35 |
+
1. **Get your Confluence URL**:
|
| 36 |
+
- Your internal Confluence URL (e.g., `https://confluence.yourcompany.com`)
|
| 37 |
+
|
| 38 |
+
2. **Create a Personal Access Token**:
|
| 39 |
+
- Go to Confluence β Profile β Personal Access Tokens
|
| 40 |
+
- Click **"Create token"**
|
| 41 |
+
- Give it a name and select appropriate permissions
|
| 42 |
+
- Copy the token
|
| 43 |
+
|
| 44 |
+
3. **Authentication**:
|
| 45 |
+
- For Data Center, you may use username/password or PAT
|
| 46 |
+
- See confluence-ingestor documentation for details
|
| 47 |
+
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
## Step 2: Configure Environment Variables
|
| 51 |
+
|
| 52 |
+
### Create .env File
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
cd fraud_model_explainability_assistant
|
| 56 |
+
|
| 57 |
+
# Copy the example file
|
| 58 |
+
cp .env.example .env
|
| 59 |
+
|
| 60 |
+
# Edit with your credentials
|
| 61 |
+
nano .env # or use your preferred editor
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
### Edit .env File
|
| 65 |
+
|
| 66 |
+
```bash
|
| 67 |
+
# Confluence Configuration
|
| 68 |
+
CONFLUENCE_URL=https://yourcompany.atlassian.net # YOUR Confluence URL
|
| 69 |
+
CONFLUENCE_EMAIL=your.email@company.com # YOUR email
|
| 70 |
+
CONFLUENCE_API_TOKEN=ATATT3xFfGF0... # YOUR API token
|
| 71 |
+
|
| 72 |
+
# Embedding Provider (free, local)
|
| 73 |
+
EMBEDDING_PROVIDER=huggingface
|
| 74 |
+
|
| 75 |
+
# Vector Store
|
| 76 |
+
VECTOR_STORE_TYPE=chroma
|
| 77 |
+
CHROMA_PERSIST_DIRECTORY=./chroma_db
|
| 78 |
+
|
| 79 |
+
# Optional: OpenAI (if not using Bedrock)
|
| 80 |
+
OPENAI_API_KEY=sk-... # YOUR OpenAI key (optional)
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
**Important**: Never commit `.env` to git! It contains secrets.
|
| 84 |
+
|
| 85 |
+
---
|
| 86 |
+
|
| 87 |
+
## Step 3: Install Dependencies
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
# Make sure you're in the fraud assistant directory
|
| 91 |
+
cd fraud_model_explainability_assistant
|
| 92 |
+
|
| 93 |
+
# Install confluence-ingestor with Strands adapter
|
| 94 |
+
pip install confluence-ingestor[strands,huggingface,chroma]
|
| 95 |
+
|
| 96 |
+
# Verify installation
|
| 97 |
+
python -c "from confluence_ingestor import ConfluenceRAG; print('β
Installation successful')"
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
---
|
| 101 |
+
|
| 102 |
+
## Step 4: Identify Confluence Spaces to Ingest
|
| 103 |
+
|
| 104 |
+
### Find Your Spaces
|
| 105 |
+
|
| 106 |
+
1. Go to Confluence β Spaces β View All Spaces
|
| 107 |
+
2. Identify spaces with relevant documentation:
|
| 108 |
+
- Model governance documentation
|
| 109 |
+
- Compliance policies
|
| 110 |
+
- Fraud investigation procedures
|
| 111 |
+
- Training materials
|
| 112 |
+
- Regulatory guidelines
|
| 113 |
+
|
| 114 |
+
### Recommended Spaces for Fraud Assistant
|
| 115 |
+
|
| 116 |
+
| Space Purpose | Example Space Key | Priority |
|
| 117 |
+
|---------------|-------------------|----------|
|
| 118 |
+
| Model Governance | `fraud-model-governance` | βββββ |
|
| 119 |
+
| Compliance Policies | `compliance-policies` | βββββ |
|
| 120 |
+
| Investigation Playbooks | `fraud-investigation` | ββββ |
|
| 121 |
+
| Regulatory Prep | `regulatory-compliance` | ββββ |
|
| 122 |
+
| Team Procedures | `fraud-analytics-team` | βββ |
|
| 123 |
+
|
| 124 |
+
### Get Space Keys
|
| 125 |
+
|
| 126 |
+
1. Go to a Confluence space
|
| 127 |
+
2. Look at the URL: `https://yourcompany.atlassian.net/wiki/spaces/SPACEKEY/`
|
| 128 |
+
3. The `SPACEKEY` is what you need
|
| 129 |
+
|
| 130 |
+
---
|
| 131 |
+
|
| 132 |
+
## Step 5: Test Confluence Connection
|
| 133 |
+
|
| 134 |
+
### Quick Connection Test
|
| 135 |
+
|
| 136 |
+
```bash
|
| 137 |
+
cd fraud_model_explainability_assistant
|
| 138 |
+
|
| 139 |
+
# Test Confluence connection
|
| 140 |
+
python -c "
|
| 141 |
+
from confluence_ingestor import ConfluenceClient
|
| 142 |
+
|
| 143 |
+
client = ConfluenceClient.from_env()
|
| 144 |
+
spaces = client.list_spaces()
|
| 145 |
+
|
| 146 |
+
print('β
Connected to Confluence!')
|
| 147 |
+
print(f'Found {len(spaces)} spaces')
|
| 148 |
+
for space in spaces[:5]:
|
| 149 |
+
print(f' - {space.key}: {space.name}')
|
| 150 |
+
"
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
**Expected Output**:
|
| 154 |
+
```
|
| 155 |
+
β
Connected to Confluence!
|
| 156 |
+
Found 15 spaces
|
| 157 |
+
- FMG: Fraud Model Governance
|
| 158 |
+
- CP: Compliance Policies
|
| 159 |
+
- FI: Fraud Investigation
|
| 160 |
+
...
|
| 161 |
+
```
|
| 162 |
+
|
| 163 |
+
**If you see errors**:
|
| 164 |
+
- `401 Unauthorized`: Check your email and API token
|
| 165 |
+
- `404 Not Found`: Check your Confluence URL
|
| 166 |
+
- `403 Forbidden`: You don't have permission to access Confluence
|
| 167 |
+
|
| 168 |
+
---
|
| 169 |
+
|
| 170 |
+
## Step 6: Ingest Confluence Spaces
|
| 171 |
+
|
| 172 |
+
### Initial Ingestion (One-Time Setup)
|
| 173 |
+
|
| 174 |
+
This downloads your Confluence content and creates a searchable vector database.
|
| 175 |
+
|
| 176 |
+
```bash
|
| 177 |
+
cd fraud_model_explainability_assistant
|
| 178 |
+
|
| 179 |
+
python << 'EOF'
|
| 180 |
+
from confluence_ingestor import ConfluenceRAG
|
| 181 |
+
|
| 182 |
+
# Initialize RAG pipeline
|
| 183 |
+
print("Initializing Confluence RAG...")
|
| 184 |
+
rag = ConfluenceRAG.from_env(
|
| 185 |
+
embedding_provider="huggingface",
|
| 186 |
+
vector_store_type="chroma"
|
| 187 |
+
)
|
| 188 |
+
|
| 189 |
+
# Ingest spaces (this may take 5-10 minutes)
|
| 190 |
+
spaces = {
|
| 191 |
+
"fraud-model-governance": 100, # Adjust space keys and limits
|
| 192 |
+
"compliance-policies": 50,
|
| 193 |
+
"fraud-investigation": 75,
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
for space_key, max_pages in spaces.items():
|
| 197 |
+
print(f"\nIngesting {space_key} (max {max_pages} pages)...")
|
| 198 |
+
try:
|
| 199 |
+
stats = rag.ingest_space(space_key, max_pages=max_pages, force=False)
|
| 200 |
+
|
| 201 |
+
if stats.get("skipped"):
|
| 202 |
+
print(f" β {stats['reason']}")
|
| 203 |
+
else:
|
| 204 |
+
print(f" β
Ingested {stats['pages']} pages")
|
| 205 |
+
print(f" Created {stats['chunks']} chunks")
|
| 206 |
+
except Exception as e:
|
| 207 |
+
print(f" β Error: {e}")
|
| 208 |
+
|
| 209 |
+
print("\nβ
Ingestion complete!")
|
| 210 |
+
print("Vector database saved to: ./chroma_db/")
|
| 211 |
+
EOF
|
| 212 |
+
```
|
| 213 |
+
|
| 214 |
+
**Expected Output**:
|
| 215 |
+
```
|
| 216 |
+
Initializing Confluence RAG...
|
| 217 |
+
Downloading model... (first time only, ~400MB)
|
| 218 |
+
|
| 219 |
+
Ingesting fraud-model-governance (max 100 pages)...
|
| 220 |
+
β
Ingested 87 pages
|
| 221 |
+
Created 1,245 chunks
|
| 222 |
+
|
| 223 |
+
Ingesting compliance-policies (max 50 pages)...
|
| 224 |
+
β
Ingested 42 pages
|
| 225 |
+
Created 628 chunks
|
| 226 |
+
|
| 227 |
+
β
Ingestion complete!
|
| 228 |
+
Vector database saved to: ./chroma_db/
|
| 229 |
+
```
|
| 230 |
+
|
| 231 |
+
**Time**: 5-10 minutes for ~300 pages (first time only)
|
| 232 |
+
|
| 233 |
+
---
|
| 234 |
+
|
| 235 |
+
## Step 7: Test the Integration
|
| 236 |
+
|
| 237 |
+
### Test Search Functionality
|
| 238 |
+
|
| 239 |
+
```bash
|
| 240 |
+
python << 'EOF'
|
| 241 |
+
from confluence_ingestor import ConfluenceRAG
|
| 242 |
+
|
| 243 |
+
rag = ConfluenceRAG.from_env()
|
| 244 |
+
|
| 245 |
+
# Test search
|
| 246 |
+
results = rag.search("fair lending policy synthetic ID", k=3)
|
| 247 |
+
|
| 248 |
+
print(f"Found {len(results)} results:\n")
|
| 249 |
+
for i, result in enumerate(results, 1):
|
| 250 |
+
print(f"{i}. {result.title}")
|
| 251 |
+
print(f" Space: {result.space_key}")
|
| 252 |
+
print(f" Score: {result.score:.4f}")
|
| 253 |
+
print(f" Content: {result.content[:150]}...")
|
| 254 |
+
print(f" Source: {result.source}\n")
|
| 255 |
+
EOF
|
| 256 |
+
```
|
| 257 |
+
|
| 258 |
+
**Expected Output**:
|
| 259 |
+
```
|
| 260 |
+
Found 3 results:
|
| 261 |
+
|
| 262 |
+
1. Fair Lending Policy - Synthetic Identity Detection
|
| 263 |
+
Space: compliance-policies
|
| 264 |
+
Score: 0.8523
|
| 265 |
+
Content: Our fair lending policy addresses synthetic identity detection through the following guidelines...
|
| 266 |
+
Source: https://yourcompany.atlassian.net/wiki/spaces/CP/pages/12345
|
| 267 |
+
|
| 268 |
+
2. Model Validation Report - XGBoost v3.2
|
| 269 |
+
Space: fraud-model-governance
|
| 270 |
+
Score: 0.7891
|
| 271 |
+
Content: The model validation for XGBoost v3.2 includes fair lending compliance testing...
|
| 272 |
+
Source: https://yourcompany.atlassian.net/wiki/spaces/FMG/pages/67890
|
| 273 |
+
|
| 274 |
+
3. Investigation Playbook - Synthetic ID Fraud
|
| 275 |
+
Space: fraud-investigation
|
| 276 |
+
Score: 0.7654
|
| 277 |
+
Content: When investigating synthetic identity fraud, follow these procedures...
|
| 278 |
+
Source: https://yourcompany.atlassian.net/wiki/spaces/FI/pages/11111
|
| 279 |
+
```
|
| 280 |
+
|
| 281 |
+
---
|
| 282 |
+
|
| 283 |
+
## Step 8: Run the Enhanced Fraud Assistant
|
| 284 |
+
|
| 285 |
+
```bash
|
| 286 |
+
# Run the Confluence-integrated version
|
| 287 |
+
python confluence_integration_example.py
|
| 288 |
+
```
|
| 289 |
+
|
| 290 |
+
**The app will**:
|
| 291 |
+
1. Initialize Confluence RAG (reads from `./chroma_db/`)
|
| 292 |
+
2. Create the Confluence search tool
|
| 293 |
+
3. Add it to the Strands agent
|
| 294 |
+
4. Launch the Gradio UI
|
| 295 |
+
|
| 296 |
+
**Test it**:
|
| 297 |
+
1. Open http://localhost:7860
|
| 298 |
+
2. Ask: "What does our fair lending policy say about phone type features?"
|
| 299 |
+
3. The agent should search Confluence and cite specific policy documents!
|
| 300 |
+
|
| 301 |
+
---
|
| 302 |
+
|
| 303 |
+
## Troubleshooting
|
| 304 |
+
|
| 305 |
+
### Error: "3 validation errors for ConfluenceConfig"
|
| 306 |
+
|
| 307 |
+
**Cause**: Environment variables not loaded
|
| 308 |
+
|
| 309 |
+
**Fix**:
|
| 310 |
+
```bash
|
| 311 |
+
# Check if .env exists
|
| 312 |
+
ls -la .env
|
| 313 |
+
|
| 314 |
+
# If missing, create it from .env.example
|
| 315 |
+
cp .env.example .env
|
| 316 |
+
|
| 317 |
+
# Edit with your credentials
|
| 318 |
+
nano .env
|
| 319 |
+
|
| 320 |
+
# Verify variables are set
|
| 321 |
+
python -c "import os; from dotenv import load_dotenv; load_dotenv(); print('URL:', os.getenv('CONFLUENCE_URL'))"
|
| 322 |
+
```
|
| 323 |
+
|
| 324 |
+
### Error: "401 Unauthorized"
|
| 325 |
+
|
| 326 |
+
**Cause**: Invalid email or API token
|
| 327 |
+
|
| 328 |
+
**Fix**:
|
| 329 |
+
1. Re-generate your API token at https://id.atlassian.com/manage-profile/security/api-tokens
|
| 330 |
+
2. Double-check your email is correct
|
| 331 |
+
3. Make sure there are no extra spaces in `.env`
|
| 332 |
+
|
| 333 |
+
### Error: "404 Not Found"
|
| 334 |
+
|
| 335 |
+
**Cause**: Incorrect Confluence URL
|
| 336 |
+
|
| 337 |
+
**Fix**:
|
| 338 |
+
1. Check your Confluence URL format
|
| 339 |
+
2. For Atlassian Cloud: `https://yourcompany.atlassian.net` (no `/wiki` suffix)
|
| 340 |
+
3. For Data Center: `https://confluence.yourcompany.com`
|
| 341 |
+
|
| 342 |
+
### Error: "403 Forbidden"
|
| 343 |
+
|
| 344 |
+
**Cause**: User doesn't have permission to access Confluence
|
| 345 |
+
|
| 346 |
+
**Fix**:
|
| 347 |
+
1. Log into Confluence with the same email/token
|
| 348 |
+
2. Verify you can view the spaces you're trying to ingest
|
| 349 |
+
3. Contact your Confluence admin to grant read access
|
| 350 |
+
|
| 351 |
+
### Error: "Module not found: confluence_ingestor"
|
| 352 |
+
|
| 353 |
+
**Cause**: Package not installed
|
| 354 |
+
|
| 355 |
+
**Fix**:
|
| 356 |
+
```bash
|
| 357 |
+
pip install confluence-ingestor[strands,huggingface,chroma]
|
| 358 |
+
```
|
| 359 |
+
|
| 360 |
+
### Error: "Slow search queries"
|
| 361 |
+
|
| 362 |
+
**Cause**: Large vector database or slow embeddings
|
| 363 |
+
|
| 364 |
+
**Fix**:
|
| 365 |
+
1. Reduce `max_pages` when ingesting
|
| 366 |
+
2. Consider using OpenAI embeddings (faster but costs money)
|
| 367 |
+
3. Filter searches to specific spaces
|
| 368 |
+
|
| 369 |
+
### Error: "Out of disk space"
|
| 370 |
+
|
| 371 |
+
**Cause**: Vector database and model cache are large
|
| 372 |
+
|
| 373 |
+
**Fix**:
|
| 374 |
+
1. Vector database: ~150 MB per 100 pages
|
| 375 |
+
2. HuggingFace model: ~400 MB (one-time)
|
| 376 |
+
3. Free up space or use a smaller corpus
|
| 377 |
+
|
| 378 |
+
---
|
| 379 |
+
|
| 380 |
+
## Maintenance
|
| 381 |
+
|
| 382 |
+
### Update Confluence Content (Daily/Weekly)
|
| 383 |
+
|
| 384 |
+
```bash
|
| 385 |
+
# Re-ingest spaces to pick up new content
|
| 386 |
+
python << 'EOF'
|
| 387 |
+
from confluence_ingestor import ConfluenceRAG
|
| 388 |
+
|
| 389 |
+
rag = ConfluenceRAG.from_env()
|
| 390 |
+
|
| 391 |
+
# Force re-ingestion
|
| 392 |
+
for space in ["fraud-model-governance", "compliance-policies"]:
|
| 393 |
+
print(f"Updating {space}...")
|
| 394 |
+
stats = rag.ingest_space(space, max_pages=100, force=True)
|
| 395 |
+
print(f" β
Updated {stats['pages']} pages")
|
| 396 |
+
EOF
|
| 397 |
+
```
|
| 398 |
+
|
| 399 |
+
### Automated Updates (Optional)
|
| 400 |
+
|
| 401 |
+
Add to your deployment:
|
| 402 |
+
|
| 403 |
+
```python
|
| 404 |
+
from apscheduler.schedulers.background import BackgroundScheduler
|
| 405 |
+
|
| 406 |
+
def refresh_confluence():
|
| 407 |
+
rag = ConfluenceRAG.from_env()
|
| 408 |
+
for space in ["fraud-model-governance", "compliance-policies"]:
|
| 409 |
+
rag.ingest_space(space, max_pages=100, force=True)
|
| 410 |
+
|
| 411 |
+
scheduler = BackgroundScheduler()
|
| 412 |
+
scheduler.add_job(refresh_confluence, 'cron', hour=2) # 2 AM daily
|
| 413 |
+
scheduler.start()
|
| 414 |
+
```
|
| 415 |
+
|
| 416 |
+
---
|
| 417 |
+
|
| 418 |
+
## Security Best Practices
|
| 419 |
+
|
| 420 |
+
### 1. Use a Service Account
|
| 421 |
+
|
| 422 |
+
Create a dedicated Confluence user:
|
| 423 |
+
- Email: `fraud-bot@yourcompany.com`
|
| 424 |
+
- Name: "Fraud Model Assistant"
|
| 425 |
+
- Purpose: Read-only access to specific spaces
|
| 426 |
+
|
| 427 |
+
### 2. Limit Permissions
|
| 428 |
+
|
| 429 |
+
Grant minimal access:
|
| 430 |
+
- β
Read access to relevant spaces
|
| 431 |
+
- β No write access
|
| 432 |
+
- β No admin access
|
| 433 |
+
|
| 434 |
+
### 3. Secure Credentials
|
| 435 |
+
|
| 436 |
+
- β
Store in `.env` (never commit to git)
|
| 437 |
+
- β
Use environment variables in production
|
| 438 |
+
- β
Rotate API tokens regularly
|
| 439 |
+
- β Never hard-code credentials
|
| 440 |
+
|
| 441 |
+
### 4. Add to .gitignore
|
| 442 |
+
|
| 443 |
+
```bash
|
| 444 |
+
# Add to .gitignore
|
| 445 |
+
echo ".env" >> .gitignore
|
| 446 |
+
echo "chroma_db/" >> .gitignore
|
| 447 |
+
echo "*.log" >> .gitignore
|
| 448 |
+
```
|
| 449 |
+
|
| 450 |
+
---
|
| 451 |
+
|
| 452 |
+
## Next Steps
|
| 453 |
+
|
| 454 |
+
Once setup is complete:
|
| 455 |
+
|
| 456 |
+
1. β
Test with simple queries
|
| 457 |
+
2. β
Add more Confluence spaces as needed
|
| 458 |
+
3. β
Customize space filters for different use cases
|
| 459 |
+
4. β
Share with your team
|
| 460 |
+
5. β
Monitor usage and performance
|
| 461 |
+
6. β
Set up automated updates
|
| 462 |
+
|
| 463 |
+
---
|
| 464 |
+
|
| 465 |
+
## Support
|
| 466 |
+
|
| 467 |
+
### Documentation
|
| 468 |
+
|
| 469 |
+
- **confluence-ingestor**: See `/confluence-ingestor/README.md`
|
| 470 |
+
- **Strands Agents**: https://strandsagents.com/latest/documentation/docs/
|
| 471 |
+
|
| 472 |
+
### Common Issues
|
| 473 |
+
|
| 474 |
+
Check `CONFLUENCE_INTEGRATION_ANALYSIS.md` for:
|
| 475 |
+
- Architecture details
|
| 476 |
+
- Performance optimization
|
| 477 |
+
- Advanced configuration
|
| 478 |
+
- ROI analysis
|
| 479 |
+
|
| 480 |
+
---
|
| 481 |
+
|
| 482 |
+
## Summary Checklist
|
| 483 |
+
|
| 484 |
+
- [ ] Create Confluence API token
|
| 485 |
+
- [ ] Create `.env` file with credentials
|
| 486 |
+
- [ ] Install `confluence-ingestor[strands,huggingface,chroma]`
|
| 487 |
+
- [ ] Test Confluence connection
|
| 488 |
+
- [ ] Identify relevant Confluence spaces
|
| 489 |
+
- [ ] Ingest spaces (5-10 minutes)
|
| 490 |
+
- [ ] Test search functionality
|
| 491 |
+
- [ ] Run enhanced fraud assistant
|
| 492 |
+
- [ ] Add to `.gitignore`
|
| 493 |
+
- [ ] Share with team
|
| 494 |
+
|
| 495 |
+
**Estimated Time**: 30-60 minutes (including ingestion)
|
| 496 |
+
|
| 497 |
+
---
|
| 498 |
+
|
| 499 |
+
**Need Help?** Check the troubleshooting section or review the detailed analysis in `CONFLUENCE_INTEGRATION_ANALYSIS.md`.
|
docs/QUICK_START.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Quick Start: Fraud Assistant with Confluence Integration
|
| 2 |
+
|
| 3 |
+
Follow these steps to add Confluence search to your fraud explainability assistant in **under 10 minutes**.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## TL;DR (For the Impatient)
|
| 8 |
+
|
| 9 |
+
```bash
|
| 10 |
+
# 1. Install dependencies
|
| 11 |
+
pip install -r requirements-with-confluence.txt
|
| 12 |
+
|
| 13 |
+
# 2. Create .env file with your Confluence credentials
|
| 14 |
+
cp .env.example .env
|
| 15 |
+
nano .env # Add your Confluence URL, email, and API token
|
| 16 |
+
|
| 17 |
+
# 3. Test it
|
| 18 |
+
python confluence_integration_example.py
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
Then ask: **"What does our fair lending policy say about synthetic ID detection?"**
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
## Step-by-Step Setup
|
| 26 |
+
|
| 27 |
+
### Step 1: Get Confluence API Token (2 minutes)
|
| 28 |
+
|
| 29 |
+
1. Go to https://id.atlassian.com/manage-profile/security/api-tokens
|
| 30 |
+
2. Click **"Create API token"**
|
| 31 |
+
3. Label it: "Fraud Assistant"
|
| 32 |
+
4. **Copy the token** (you won't see it again!)
|
| 33 |
+
|
| 34 |
+
### Step 2: Configure Environment (1 minute)
|
| 35 |
+
|
| 36 |
+
```bash
|
| 37 |
+
cd fraud_model_explainability_assistant
|
| 38 |
+
|
| 39 |
+
# Copy example file
|
| 40 |
+
cp .env.example .env
|
| 41 |
+
|
| 42 |
+
# Edit with your credentials
|
| 43 |
+
nano .env # or use your preferred editor
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
**Edit these 3 lines** in `.env`:
|
| 47 |
+
```bash
|
| 48 |
+
CONFLUENCE_URL=https://yourcompany.atlassian.net # YOUR Confluence URL
|
| 49 |
+
CONFLUENCE_EMAIL=your.email@company.com # YOUR email
|
| 50 |
+
CONFLUENCE_API_TOKEN=ATATT3xFfGF0... # YOUR token (paste here)
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
Save and close.
|
| 54 |
+
|
| 55 |
+
### Step 3: Install Dependencies (2 minutes)
|
| 56 |
+
|
| 57 |
+
```bash
|
| 58 |
+
# Install everything needed
|
| 59 |
+
pip install -r requirements-with-confluence.txt
|
| 60 |
+
|
| 61 |
+
# Verify installation
|
| 62 |
+
python -c "from confluence_ingestor import ConfluenceRAG; print('β
Ready!')"
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
### Step 4: Identify Confluence Spaces (1 minute)
|
| 66 |
+
|
| 67 |
+
Find the "space keys" for your Confluence spaces:
|
| 68 |
+
|
| 69 |
+
1. Open your Confluence
|
| 70 |
+
2. Go to a space
|
| 71 |
+
3. Look at the URL: `https://yourcompany.atlassian.net/wiki/spaces/SPACEKEY/`
|
| 72 |
+
4. The `SPACEKEY` is what you need
|
| 73 |
+
|
| 74 |
+
**Recommended spaces**:
|
| 75 |
+
- Model governance docs (e.g., `fraud-model-governance`)
|
| 76 |
+
- Compliance policies (e.g., `compliance-policies`)
|
| 77 |
+
- Investigation playbooks (e.g., `fraud-investigation`)
|
| 78 |
+
|
| 79 |
+
### Step 5: Update Space Keys in Code (1 minute)
|
| 80 |
+
|
| 81 |
+
Edit `confluence_integration_example.py` line 88:
|
| 82 |
+
|
| 83 |
+
```python
|
| 84 |
+
spaces = {
|
| 85 |
+
"your-governance-space": 100, # Replace with YOUR space key
|
| 86 |
+
"your-compliance-space": 50, # Replace with YOUR space key
|
| 87 |
+
"your-playbooks-space": 75, # Replace with YOUR space key
|
| 88 |
+
}
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
### Step 6: Run Initial Ingestion (5 minutes)
|
| 92 |
+
|
| 93 |
+
This downloads and indexes your Confluence content (one-time):
|
| 94 |
+
|
| 95 |
+
```bash
|
| 96 |
+
python confluence_integration_example.py
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
**What happens**:
|
| 100 |
+
1. Connects to Confluence β
|
| 101 |
+
2. Downloads pages from your spaces (~5 min)
|
| 102 |
+
3. Creates searchable vector database
|
| 103 |
+
4. Launches web UI
|
| 104 |
+
|
| 105 |
+
**First time only**: Downloads ~400MB ML model (free, runs locally)
|
| 106 |
+
|
| 107 |
+
### Step 7: Test It! (1 minute)
|
| 108 |
+
|
| 109 |
+
1. Open http://localhost:7860 in your browser
|
| 110 |
+
2. Try these questions:
|
| 111 |
+
|
| 112 |
+
**Question 1** (tests Confluence search):
|
| 113 |
+
```
|
| 114 |
+
What does our fair lending policy say about phone type features?
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
**Question 2** (tests fraud analysis):
|
| 118 |
+
```
|
| 119 |
+
Why was application APP-78432 flagged as high risk?
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
**Question 3** (tests compliance with policy citation):
|
| 123 |
+
```
|
| 124 |
+
Check fair lending compliance for APP-55555 and cite relevant policies
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
If the agent cites specific Confluence pages in its response, **it's working!** π
|
| 128 |
+
|
| 129 |
+
---
|
| 130 |
+
|
| 131 |
+
## What You Just Built
|
| 132 |
+
|
| 133 |
+
Your fraud assistant now has access to:
|
| 134 |
+
- β
Company fair lending policies
|
| 135 |
+
- β
Model governance documentation
|
| 136 |
+
- β
Investigation procedures
|
| 137 |
+
- β
Compliance guidelines
|
| 138 |
+
- β
Historical precedents
|
| 139 |
+
|
| 140 |
+
**Use cases unlocked**:
|
| 141 |
+
- Executive briefings with policy citations
|
| 142 |
+
- Regulatory examination support
|
| 143 |
+
- Analyst training and investigation support
|
| 144 |
+
- Audit trail documentation
|
| 145 |
+
|
| 146 |
+
---
|
| 147 |
+
|
| 148 |
+
## Troubleshooting
|
| 149 |
+
|
| 150 |
+
### "3 validation errors for ConfluenceConfig"
|
| 151 |
+
|
| 152 |
+
**Problem**: Missing Confluence credentials
|
| 153 |
+
|
| 154 |
+
**Fix**:
|
| 155 |
+
```bash
|
| 156 |
+
# Check if .env exists
|
| 157 |
+
ls -la .env
|
| 158 |
+
|
| 159 |
+
# If missing:
|
| 160 |
+
cp .env.example .env
|
| 161 |
+
|
| 162 |
+
# Edit with your credentials
|
| 163 |
+
nano .env
|
| 164 |
+
|
| 165 |
+
# Verify:
|
| 166 |
+
cat .env | grep CONFLUENCE
|
| 167 |
+
```
|
| 168 |
+
|
| 169 |
+
### "401 Unauthorized"
|
| 170 |
+
|
| 171 |
+
**Problem**: Wrong email or API token
|
| 172 |
+
|
| 173 |
+
**Fix**:
|
| 174 |
+
1. Re-generate API token at https://id.atlassian.com/manage-profile/security/api-tokens
|
| 175 |
+
2. Double-check email is correct
|
| 176 |
+
3. Remove any extra spaces in `.env`
|
| 177 |
+
|
| 178 |
+
### "Space 'xyz' not found"
|
| 179 |
+
|
| 180 |
+
**Problem**: Space key doesn't exist or you don't have access
|
| 181 |
+
|
| 182 |
+
**Fix**:
|
| 183 |
+
1. Check the space key in Confluence URL
|
| 184 |
+
2. Verify you can view the space when logged in
|
| 185 |
+
3. Update space keys in `confluence_integration_example.py` line 88
|
| 186 |
+
|
| 187 |
+
### "Module not found: confluence_ingestor"
|
| 188 |
+
|
| 189 |
+
**Problem**: Package not installed
|
| 190 |
+
|
| 191 |
+
**Fix**:
|
| 192 |
+
```bash
|
| 193 |
+
pip install -r requirements-with-confluence.txt
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
---
|
| 197 |
+
|
| 198 |
+
## Next Steps
|
| 199 |
+
|
| 200 |
+
Once it's working:
|
| 201 |
+
|
| 202 |
+
1. **Add more spaces**: Edit the `spaces` dict in the code
|
| 203 |
+
2. **Customize prompts**: Update `ENHANCED_PROMPT` for your use case
|
| 204 |
+
3. **Set up auto-updates**: See `CONFLUENCE_INTEGRATION_ANALYSIS.md`
|
| 205 |
+
4. **Share with team**: Deploy on internal server
|
| 206 |
+
5. **Monitor usage**: Track which policies are searched most
|
| 207 |
+
|
| 208 |
+
---
|
| 209 |
+
|
| 210 |
+
## Full Documentation
|
| 211 |
+
|
| 212 |
+
- **Detailed Setup**: See `CONFLUENCE_SETUP_GUIDE.md`
|
| 213 |
+
- **Architecture & ROI**: See `CONFLUENCE_INTEGRATION_ANALYSIS.md`
|
| 214 |
+
- **Confluence-Ingestor Docs**: See `../confluence-ingestor/README.md`
|
| 215 |
+
|
| 216 |
+
---
|
| 217 |
+
|
| 218 |
+
## Summary Checklist
|
| 219 |
+
|
| 220 |
+
- [ ] Get Confluence API token (2 min)
|
| 221 |
+
- [ ] Create `.env` with credentials (1 min)
|
| 222 |
+
- [ ] Install dependencies (2 min)
|
| 223 |
+
- [ ] Find your Confluence space keys (1 min)
|
| 224 |
+
- [ ] Update space keys in code (1 min)
|
| 225 |
+
- [ ] Run initial ingestion (5 min)
|
| 226 |
+
- [ ] Test with sample questions (1 min)
|
| 227 |
+
|
| 228 |
+
**Total Time**: ~10 minutes
|
| 229 |
+
|
| 230 |
+
---
|
| 231 |
+
|
| 232 |
+
## Support
|
| 233 |
+
|
| 234 |
+
**Having issues?** Check:
|
| 235 |
+
1. `CONFLUENCE_SETUP_GUIDE.md` - Detailed troubleshooting
|
| 236 |
+
2. `CONFLUENCE_INTEGRATION_ANALYSIS.md` - Architecture details
|
| 237 |
+
3. The "Troubleshooting" section above
|
| 238 |
+
|
| 239 |
+
**Still stuck?** Review the error message - it usually tells you what's missing!
|
| 240 |
+
|
| 241 |
+
---
|
| 242 |
+
|
| 243 |
+
**You're done!** Your fraud assistant can now search company documentation and cite specific policies. π
|
requirements-with-confluence.txt
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Core Requirements (Original)
|
| 2 |
+
# ==============================
|
| 3 |
+
|
| 4 |
+
# Strands Agents SDK with OpenAI provider support
|
| 5 |
+
strands-agents[openai]>=1.0.0
|
| 6 |
+
|
| 7 |
+
# Gradio for web interface
|
| 8 |
+
gradio>=4.0.0
|
| 9 |
+
|
| 10 |
+
# HTTP client
|
| 11 |
+
httpx>=0.24.0
|
| 12 |
+
|
| 13 |
+
# Environment variable management
|
| 14 |
+
python-dotenv>=1.0.0
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Confluence Integration (Optional but Recommended)
|
| 18 |
+
# ==================================================
|
| 19 |
+
|
| 20 |
+
# Confluence document ingestion and RAG
|
| 21 |
+
# Install with: pip install -r requirements-with-confluence.txt
|
| 22 |
+
# Or: pip install confluence-ingestor[strands,huggingface,chroma]
|
| 23 |
+
|
| 24 |
+
confluence-ingestor[strands,huggingface,chroma]>=0.3.0
|
| 25 |
+
|
| 26 |
+
# Optional: If you want to use OpenAI embeddings instead of HuggingFace
|
| 27 |
+
# Uncomment below and set EMBEDDING_PROVIDER=openai in .env
|
| 28 |
+
# openai>=1.0.0
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
# Development/Production (Optional)
|
| 32 |
+
# ==================================
|
| 33 |
+
|
| 34 |
+
# Task scheduling for automated Confluence updates
|
| 35 |
+
# apscheduler>=3.10.0
|
| 36 |
+
|
| 37 |
+
# Logging and monitoring
|
| 38 |
+
# python-json-logger>=2.0.0
|