PDF Q&A Example#
This example demonstrates how to use NVIDIA’s Context-Aware RAG (CA-RAG) system for PDF document processing and question answering. The example shows how to:
Extract text and tables from PDF documents
Ingest documents into the CA-RAG system
Perform question answering on the ingested documents
Prerequisites#
NVIDIA API Keys:
Get your API keys from: build.nvidia.com
Export the following environment variables:
export NVIDIA_BUILD_API_KEY=your_build_api_key export NVIDIA_API_KEY=your_api_key
Install NV-Ingest:
Follow the installation instructions at: NV Ingest
Setup#
Start the required services using docker-compose:
Start the NV-Ingest client:
The example uses a pipeline configuration with Milvus for vector storage
Usage#
Document Processing:
Place your PDF documents in the
data/
directoryThe example processes PDFs to extract:
Text content
Tables
Charts
Note: Image extraction is not supported in the current version
Document Ingestion:
Documents are processed and uploaded to the ingestion service
The system maintains document order and metadata
A terminating document is added to mark the end of the document set
Question Answering:
Initialize the retrieval service with the same UUID used for ingestion
Send questions to the retrieval service
Receive answers based on the ingested document content
Example Notebook#
The pdf_qna.ipynb notebook provides a step-by-step walkthrough of the entire process, including:
Service initialization
Document processing and ingestion
Question answering examples
Notes#
The current version does not support image extraction from PDFs
For optimal PDF processing, especially for scanned documents, consider using the
nemoretriever_parse
extraction methodThe system uses markdown format for text extraction output