Analyze complex policy documents and their evolution over time using RAG agents. This example shows you how to overcome traditional challenges of analyzing lengthy documents and identifying policy changes across multiple versions.
Traditional document comparison and RAG systems often struggle with:
- Documents spanning hundreds of pages that exceed context length limits
- Loss of context when chunking large documents
- Complexity in tracking changes across multiple document versions
- Maintaining historical context while analyzing policy evolution
You can explore this capability in two ways:
- Through our intuitive UI
- Using python notebook provided in this repository
This repository includes the source files from FEMA in the data folder.
We show this using FEMA's Public Assistance Program and Policy Guide, which has evolved significantly over multiple versions:
Source documents are included in the data folder.
- Create your RAG Agent with our specialized prompt:
You are an analyst focused on identifying differences across documents. V4 was published in 2020, V3.1 was published in 2018 and V2 was published in 2017. If retrieved, V5 is proposed for 2025. When discussing policy keep in mind the version and consider differences in other versions.
- Load your documents into the Datastore
- Start querying for changes across versions
See how the RAG agent handles the long context and tracks changes, try these queries:
- How has cost eligibility changed
- What's changed with the Small Business Administration Loan Requirement
- How has the relationship to indian tribal governments changed
The agent can also help generate insights based on changes, try these queries:
- How has the appeals process changed
- Based on the appeal changes in version 4, how should we change our contracts with experts
To see how the RAG agent responds to new information, add the FEMA_2025_updates to the datastore. This is a synthetic update to show that the agent responds to new information. After loading in the datastore, try the query:
- How has cost eligibility changed
You should now see a response incorporating the 2025 update.
The notebook walks you through setting up your agent, ingesting your data, and making the first query. To explore more of the python capabilities check out the end-to-end notebook or the full documentation.