Ask My Docs
Questions about ten companies' 10-K annual reports, answered with a citation for every sentence — or refused when the filings don't say. Every pull request is graded, and blocked if quality drops.
Example
Question
How fast did Microsoft's cloud business grow in fiscal 2026?
Answer
Microsoft Cloud revenue increased 27% to $214.4 billion in fiscal 2026 . Azure and other cloud services revenue increased 41% .
MSFT-2026-00068
- Microsoft Cloud revenue increased 27% to $214.4 billion.
- Commercial remaining performance obligation increased 84% to $678 billion.
- Microsoft 365 Commercial cloud revenue increased 17%.
- Azure and other cloud services revenue increased 41%.
Out of scope
What will Apple's revenue be in 2030?
I can't answer that from the documents.
Real output. Tap a citation to see the exact line in the filing that supports it.
At a glance
- Right source in the top 5
- Faithfulness
- Out-of-scope questions refused
- Median answer time
Why
A 10-K is a company's annual report to the SEC: a hundred-plus pages of risk factors, segment tables and footnotes. A chatbot over them is easy to demo and hard to trust, because it will happily make up a number that sounds right.
This one answers only from the filings of Apple, Microsoft, NVIDIA, Tesla, Amazon, Alphabet, Meta, JPMorgan, Netflix and AMD. Each sentence points to the passage it came from, a checker deletes any sentence it can't back up, and it says so when the answer isn't there.
What makes it production-grade is measurement: a hand-built test set, an independent grader, and a CI gate that fails the pull request when quality slips.
How it works
-
1. Read the filings
Download each 10-K from SEC EDGAR, keep the page and section (Item 1A. Risk Factors) for every line, and cut it into 500-token chunks that overlap by 100.
-
2. Search two ways
Keyword search finds exact terms like "CET1" or "MI308"; vector search finds meaning, so "head office" finds "headquarters". Reciprocal Rank Fusion merges the two rankings.
-
3. Re-rank closely
A cross-encoder reads the question with each of the 20 candidates and keeps the best 5. If even the best is irrelevant, it refuses without calling the LLM.
-
4. Answer, then check
Claude writes an answer with a chunk id after each sentence. A checker drops any sentence whose cited chunk doesn't contain its numbers and most of its words.
-
5. Gate every change
On each pull request, GitHub Actions rebuilds the index, runs the test set and fails the build if any score falls under its threshold.
Query path
Results
Test set: 63 questions I wrote and checked against the filings. 52 have an answer, each tied to an exact quote; 11 must be refused (future years, companies not in the corpus, investment advice). Claude Opus 5.5 grades the answers through RAGAS.
Right source in the top 5
Re-ranking is the largest single gain. It costs about 0.75 s per question, close to half the answer time.
- Faithfulnessclaims backed by the sources
- Context recallreference found in what was retrieved
- Answer correctnessvs. the reference answer
- Citationssentences with a valid source
- Refusalsrefused exactly when it should
- Answer timemedian / 95th percentile
Where it fails. All three refusal mistakes were answerable questions whose source was never retrieved; the model then correctly said it couldn't answer. Retrieval, not generation, is what to improve next.
Quality gate
To prove the gate works, I wrote a deliberately bad prompt that drops the grounding, citation and refusal rules, and ran both prompts through the same CI check (3 companies, 39 questions).
-
answer_v2
Faithful 99% · top 5 93% · refusals 100% · cited 95%
-
answer_broken_demo
Refusals 28% · top 5 still 93% · nothing left to grade for faithfulness
Why it failed. The broken prompt stopped citing, so the checker refused every answer. Retrieval stayed at 93%, so the scores point at the part that broke. Thresholds: 85% for faithfulness, refusals and citations; 80% for top 5.
What went wrong
-
Microsoft's sections came out wrong
Its 10-K repeats "Item 1" as a header on every page, so the parser took a page header for the section start. Now it takes the first line with a section title that isn't a table-of-contents row.
-
The re-ranker was marked wrong for being right
JPMorgan states its CET1 ratio in three places and I had labelled one. Test labels are now computed from evidence quotes, and a question can list several.
-
Short correct answers were refused
"Cupertino, California [AAPL-2026-00056]" was too short to count as a claim. Anything with a citation now counts; a unit test caught it.
-
A metric scored perfect answers 0
RAGAS FactualCorrectness returned 0 even for exact matches. I checked it against known answers and switched to AnswerAccuracy, which graded them correctly.
Stack
Retrieval
- bge-small-en-v1.5Local embeddings
- ChromaDBVector store on disk
- rank-bm25Keyword search
- bge-reranker-baseCross-encoder re-ranker
Generation and evals
- Claude Haiku 5.5Answers, versioned prompts
- RAGAS + Claude Opus 5.5Independent grader
- GitHub ActionsQuality gate on every PR
- FastAPI + StreamlitAPI and UI