fecb-rag / README.md
malaporte's picture
Upload folder using huggingface_hub
b095cd4 verified
|
Raw
History Blame Contribute Delete
2.21 kB

A newer version of the Gradio SDK is available: 6.20.0

Upgrade
metadata
title: FECB RAG Search
emoji: πŸ“š
colorFrom: green
colorTo: blue
sdk: gradio
sdk_version: 6.14.0
app_file: app.py
pinned: false
license: mit

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

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

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

export ANTHROPIC_API_KEY=sk-ant-...

5. Run the app

python app.py

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

Configuration

All settings can be overridden with environment variables:

Variable Default Description
ANTHROPIC_API_KEY β€” Required. Your Anthropic key
CLAUDE_MODEL claude-sonnet-4-6 Claude model to use
EMBED_MODEL BAAI/bge-small-en-v1.5 HuggingFace embedding model
TOP_K 5 Number of documents to retrieve
INDEX_DIR faiss_index FAISS index directory
META_FILE metadata.json Metadata file path
PDF_DIR pdfs PDF source directory (ingest)