CoolFace
Apppublic

CGIAR/fecb-rag

sourceHugging Facemitupdated 4mo agoView on Hugging Face
0likes
App README

FECB RAG Search App

A RAG (Retrieval-Augmented Generation) application that lets you search and query a collection of PDF documents using semantic AI search, powered by Claude (Anthropic).

Project Structure

FECB/
├── app.py           # Gradio web interface
├── ingest.py        # PDF ingestion & FAISS index builder
├── requirements.txt
├── pdfs/            # Drop your PDF files here
├── faiss_index/     # Generated by ingest.py (do not edit)
└── metadata.json    # Generated by ingest.py

Setup

1. Install dependencies

bash
pip install -r requirements.txt

2. Add your PDFs

Copy your PDF files into the pdfs/ folder (subdirectories are supported).

3. Build the vector index

bash
python ingest.py

Options:

--pdf-dir       Path to PDF folder (default: pdfs)
--index-dir     Where to save the FAISS index (default: faiss_index)
--chunk-size    Characters per chunk (default: 800)
--chunk-overlap Overlap between chunks (default: 100)

4. Set your Anthropic API key

bash
export ANTHROPIC_API_KEY=sk-ant-...

5. Run the app

bash
python app.py

Open http://localhost:7860 in your browser.

Configuration

All settings can be overridden with environment variables:

VariableDefaultDescription
ANTHROPIC_API_KEYRequired. Your Anthropic key
CLAUDE_MODELclaude-sonnet-4-6Claude model to use
EMBED_MODELBAAI/bge-small-en-v1.5HuggingFace embedding model
TOP_K5Number of documents to retrieve
INDEX_DIRfaiss_indexFAISS index directory
META_FILEmetadata.jsonMetadata file path
PDF_DIRpdfsPDF source directory (ingest)