|
| 1 | +# 📚 Table of Contents |
| 2 | + |
| 3 | +- [📚 Table of Contents](#-table-of-contents) |
| 4 | +- [🤖 UNEP Knowledge Base import script](#-unep-knowledge-base-import-script) |
| 5 | + - [🔐 Environment Variables](#-environment-variables) |
| 6 | + - [🚀 Running the Script](#-running-the-script) |
| 7 | + - [📁 Directory Structure](#-directory-structure) |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +# 🤖 UNEP Knowledge Base import script |
| 12 | + |
| 13 | +This script automates the process of collecting, saving, and uploading PDF documents from [GlobalPlasticsHub](https://globalplasticshub.org) into a RAG (Retrieval-Augmented Generation) system. |
| 14 | + |
| 15 | +This Python script supports three main operation modes: |
| 16 | + |
| 17 | +1. **CSV Only** – Save PDF URLs to a CSV file. |
| 18 | +2. **CSV + Download** – Save URLs and download the corresponding PDFs. |
| 19 | +3. **Full Process** – Save URLs, download PDFs, and upload/process them in RAG. |
| 20 | + |
| 21 | +## 🔐 Environment Variables |
| 22 | + |
| 23 | +Before running the script, set RAG credentials in your shell or environment: |
| 24 | + |
| 25 | +``` bash |
| 26 | +export RAG_USERNAME="rag_admin" |
| 27 | +export RAG_PASSWORD="RAGadmin1" |
| 28 | +``` |
| 29 | + |
| 30 | +## 🚀 Running the Script |
| 31 | + |
| 32 | +To execute the script: |
| 33 | + |
| 34 | +```bash |
| 35 | +./dev.sh exec script python -m kb_init_unep |
| 36 | +``` |
| 37 | + |
| 38 | +You will be prompted to: |
| 39 | +- Choose the operation mode: |
| 40 | + 1: Save PDF URLs to CSV only. |
| 41 | + 2: Save to CSV and download PDFs. |
| 42 | + 3: Full process (CSV + download + upload to RAG). |
| 43 | + |
| 44 | +- Enter the number of documents to import. |
| 45 | +- Provide a description for the RAG knowledge base. |
| 46 | + |
| 47 | +## 📁 Directory Structure |
| 48 | +```bash |
| 49 | +./downloads/unep/unep_files.csv – Stores PDF URLs and offsets. |
| 50 | +./downloads/unep/ – Folder where downloaded PDF files are saved. |
| 51 | +``` |
0 commit comments