This is a quick-and-dirty all-JavaScriptweb app that summarizes how the risks identified by a corporation in its annual 10K filings have changed over time. It use LlamaExtract, part of LlamaCloud, and of the course the LlamaIndex framework. It expects to work on 10K filings; you can find Apple's 10K filings for many years on their investor relations site.
We hope this gives you a useful jumping-off point for your own projects using LlamaExtract!
You'll need a few values in your .env.local
file to get this working:
NEXTAUTH_URL
which can be set tohttp://localhost:3000
for testingNEXTAUTH_SECRET
which can be any random stringGOOGLE_CLIENT_ID
andGOOGLE_CLIENT_SECRET
which you can get from the Google Cloud Console by creating a new OAuth client.LLAMA_CLOUD_API_KEY
which you can get from the LlamaCloud Console for free.LLAMA_EXTRACT_AGENT_ID
which you can get from the "Extraction" screen of your LlamaCloud project. You should use the UI to create your schema.ANTHROPIC_API_KEY
which you can get from the Anthropic Console.
npm install
npm run dev
The web app has only a handful of API routes:
/api/auth
for authentication (handled by NextAuth)/api/process
accepts the uploaded file and kicks off the extraction job/api/status
is a polling endpoint for the client to check on the status of the job/api/result
fetches the results of the extraction once ready/api/summarize
takes multiple years of risks and summarizes them, then returns the summary as HTML