This is a Retrieval-Augmented Generation (RAG) application built using LangGraph and LangChain.
rag_app/
├── utils/ # Utilities for the graph
│ ├── __init__.py
│ ├── tools.py # Tools for document loading and processing
│ ├── nodes.py # Node functions for the graph
│ └── state.py # State definition for the graph
├── __init__.py
├── agent.py # Graph construction code
└── cli.py # Command-line interface
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install the package in development mode:
pip install -e .- Create a
.envfile with your API keys (if needed):
HUGGINGFACEHUB_API_TOKEN=your_token_here
- Create a
datadirectory for storing your documents:
mkdir -p data- Build and start the Docker container:
docker-compose up -d- Stop the container:
docker-compose downProcess a local PDF file:
rag-app file path/to/your/file.pdf --query "Your query here"Process a PDF from a URL:
rag-app url "https://example.com/document.pdf" --query "Your query here"If you don't provide a query, the system will run default queries to summarize the document.
Start the LangGraph server:
langgraph serve -t ragOr using Docker:
docker-compose up -dThen you can interact with the server using HTTP requests:
curl -X POST http://localhost:8000/rag/invoke \
-H "Content-Type: application/json" \
-d '{"query": "What is systems engineering?"}'pytestpython setup.py sdist bdist_wheelMIT