Metadata-Version: 2.4
Name: confluence-chatbot
Version: 0.1.0
Summary: Turn your Confluence docs into an AI chatbot in 5 minutes. Smart chunking, diagram support, and local or AWS deployment.
Author: Prashant Singh
License-Expression: MIT
Project-URL: Homepage, https://github.com/pr-ashant-singh/confluence-chatbot
Project-URL: Repository, https://github.com/pr-ashant-singh/confluence-chatbot
Keywords: rag,confluence,chatbot,embeddings,s3-vectors,llm,ollama,bedrock
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: boto3>=1.35.0
Requires-Dist: atlassian-python-api>=3.41.0
Requires-Dist: beautifulsoup4>=4.12.0
Requires-Dist: loguru>=0.7.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: requests>=2.31.0
Provides-Extra: local
Requires-Dist: sentence-transformers>=3.0.0; extra == "local"
Requires-Dist: faiss-cpu>=1.8.0; extra == "local"
Provides-Extra: ollama
Requires-Dist: ollama>=0.3.0; extra == "ollama"
Provides-Extra: bedrock
Provides-Extra: all
Requires-Dist: sentence-transformers>=3.0.0; extra == "all"
Requires-Dist: faiss-cpu>=1.8.0; extra == "all"
Requires-Dist: ollama>=0.3.0; extra == "all"
Provides-Extra: dev
Requires-Dist: ruff>=0.5.0; extra == "dev"
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
Dynamic: license-file

# confluence-chatbot

Turn your Confluence docs into a searchable AI chatbot in 5 minutes.

`confluence-chatbot` ingests your Confluence spaces — text, tables, and architecture diagrams — into a local vector store, then answers questions using RAG (Retrieval-Augmented Generation) with source attribution.

## Features

- **Smart chunking** — splits by headings, keeps tables whole, handles pages without structure
- **Diagram understanding** — uses a vision model (LLaVA) to describe architecture diagrams as searchable text
- **Fully local** — runs with FAISS + Ollama, zero cloud costs for development
- **Production-ready** — swap to S3 Vectors + Bedrock for AWS deployment
- **Incremental sync** — only re-processes changed pages (coming in v0.2)
- **Source attribution** — every answer cites exactly which page and section it came from

## Quick Start

### Install

```bash
pip install confluence-chatbot[all]
```

### Configure

Create a `.env` file:

```env
CONFLUENCE_URL=https://yourcompany.atlassian.net
CONFLUENCE_EMAIL=you@company.com
CONFLUENCE_API_TOKEN=your-api-token
```

### Prerequisites

```bash
# Install and start Ollama (for local LLM)
brew install ollama
ollama serve  # in a separate terminal

# Pull the models
ollama pull llama3.1:8b    # for answer generation
ollama pull llava:13b      # for diagram description (optional)
```

### Use as a Library

```python
from confluence_chatbot import ConfluenceChatbot

rag = ConfluenceChatbot(
    confluence_url="https://yourcompany.atlassian.net",
    confluence_email="you@company.com",
    confluence_token="your-token",
    vector_store="faiss",
    embedding_model="BAAI/bge-large-en-v1.5",
    llm="ollama/llama3.1:8b",
)

# Ingest a space
rag.sync(spaces=["ENG"])

# Ask questions
answer = rag.ask("How does our caching layer work?")
print(answer.text)
print(answer.sources)
```

### Use as CLI

```bash
# Sync a Confluence space
confluence-chatbot sync --space ENG

# Sync specific pages
confluence-chatbot sync --page-id 1234567890

# Ask a question
confluence-chatbot ask "How does caching work?"

# Interactive mode
confluence-chatbot ask
```

## Configuration Options

| Parameter | Default | Description |
|-----------|---------|-------------|
| `vector_store` | `"faiss"` | `"faiss"` (local) or `"s3vectors"` (AWS) |
| `embedding_model` | `"BAAI/bge-large-en-v1.5"` | Any sentence-transformers model |
| `llm` | `"ollama/llama3.1:8b"` | Ollama model for answer generation |
| `enable_image_description` | `False` | Describe diagrams with vision model |
| `image_model` | `"llava:13b"` | Vision model for diagrams |
| `top_k` | `5` | Number of chunks to retrieve per query |

## How It Works

```
Confluence → Fetch pages → Smart chunk (text/tables/images)
                                    ↓
                         Embed (BAAI/bge-large-en-v1.5)
                                    ↓
                         Store in FAISS (local) or S3 Vectors (AWS)
                                    ↓
User question → Embed → Similarity search → Top-K chunks
                                    ↓
                         LLM generates grounded answer
                                    ↓
                         Answer + source citations
```

## Install Options

```bash
# Lightweight (no local models, for use with Bedrock APIs)
pip install confluence-chatbot

# With local embedding model (BAAI, requires PyTorch ~800MB)
pip install confluence-chatbot[local]

# With local LLM via Ollama
pip install confluence-chatbot[ollama]

# Full local setup (recommended for development)
pip install confluence-chatbot[all]
```

## Project Structure

```
src/confluence_chatbot/
├── core.py                  # Main ConfluenceChatbot orchestrator
├── models.py                # Data models (Page, Chunk, Answer)
├── cli.py                   # Command-line interface
├── ingest/
│   ├── confluence_client.py # Confluence API integration
│   ├── html_parser.py       # Parse Confluence HTML
│   ├── chunker.py           # Smart content-aware chunking
│   └── image_describer.py   # Vision model for diagrams
├── embedding/
│   ├── base.py              # Abstract embedding interface
│   └── sentence_transformer.py  # Local embedding (BAAI)
├── vector_store/
│   ├── base.py              # Abstract vector store interface
│   ├── faiss_store.py       # Local FAISS implementation
│   └── s3_vectors.py        # AWS S3 Vectors implementation
└── generation/
    ├── base.py              # Abstract LLM interface
    └── ollama_llm.py        # Local Ollama implementation
```

## Roadmap

- [x] v0.1 — Core pipeline: sync, chunk, embed, query, answer (local)
- [ ] v0.2 — Incremental sync, Bedrock LLM + embeddings, CLI improvements
- [ ] v0.3 — Slack bot example, Streamlit UI, evaluation tooling
- [ ] v1.0 — Production deployment guide, CDK infrastructure

## License

MIT
