Load bills from Congress.gov as LLM fragments
Install this plugin in the same environment as LLM.
llm install llm-fragments-us-legislation
First set the environment variable CONGRESS_API_KEY
(sign up for a key here).
Then you can load in a bill like so:
# This bill is yuge, so use a model with enough context!
llm -f bill:hr1-119 'Summarize this bill' -m gemini-2.5-pro-preview-05-06
bill:BILL_ID[:OPTION]
Where:
BILL_ID
follows the format[type][number]-[congress]
type
:hr
(House) ors
(Senate)number
: Bill numbercongress
: Congress session number
OPTION
(optional): Specifies what content to retrieve
# Load full bill text
llm -f bill:hr1-119 'Summarize this bill' -m gemini-2.5-pro-preview-05-06
# Load table of contents only
llm -f bill:hr1-119:toc 'What are the main sections of this bill?'
# Load a specific section
llm -f bill:hr1-119:section-110101 'Is there language in here to prevent fraud?'
# Load multiple sections
llm -f bill:hr1-119:section-80101,80121 'What does this Alaska section do differently than the non-Alaska sections?'
# Store local responses of API calls with DEBUG=1
DEBUG=1 llm -f bill:hr1-119:section-80101,80121 'What does this Alaska section do differently than the non-Alaska sections?'
Option | Description | Example |
---|---|---|
(none) | Full bill text in XML format | bill:hr1-119 |
toc |
Table of contents only | bill:hr1-119:toc |
section-N |
Specific section by number | bill:hr1-119:section-1 |
section-N,M,P |
Multiple sections | bill:hr1-119:section-1,3,5 |
hr1-119
- House Resolution 1 from the 119th Congresss1046-118
- Senate Bill 1046 from the 118th Congresshr2-117
- House Resolution 2 from the 117th Congress
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-fragments-us-legislation
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
python -m pip install -e '.[test]'
To run the tests:
python -m pytest