Trying Internal Document Search with Claude: A Half-Day RAG Misadventure
I hooked up internal wiki and meeting-notes search using Claude instead of GPT. Spoiler: I'm happy with it.
I was already using OpenAI text-embedding-3-small for embeddings, but I switched only the generation model to Claude Sonnet. Even with the same chunks, the answers feel much less half-hearted. I like its habit of grounding responses with citations like "According to the document..."
Here's what I banged my head against:
- Setting chunk size to 800 tokens with 150 overlap dramatically improved answer quality. At first I used 1500, and the context got mixed up and it was a mess.
- Adding document creation date and department to metadata and applying filters made the biggest difference in practice.
- top_k of 5 was too few; around 8 was a good balance.
- Putting one line in the system prompt — "If you don't know, say you don't know" — is really important.
Cost comes out to about $20/month. A team of 12 uses it, and at that level it's basically coffee money.
That said, the Claude API rate limits are a bit tight, so queue management is essential when running batches. That cost me a whole day T_T
If anyone has gone with LlamaIndex instead of LangChain, I'd love to hear your experience. I'm weighing it these days.
4 answers
Metadata filters—this is so true. Quality is decided here.
Isn't top_k 8 a bit high? In my case, once it goes past 5, noise gets mixed in and the answer actually goes off track. Since it depends on chunk size and the nature of the document, treating 8 as the definitive answer no matter what is a bit questionable.
Overlap 150—totally agree. I also set it generously to 300 at first, but the same paragraph ended up included twice, so search results were flooded with duplicates lol. If the problem is sentences getting cut off at chunk boundaries, the answer is splitting by headings during document preprocessing rather than increasing overlap. Especially for structured docs like wikis.
Since rate limits came up, let me add one thing: when running batches, don’t stop at just adding exponential backoff to the retry logic—it’s more convenient to move requests that hit a 429 into a separate dead-letter queue and reprocess them in a batch later. If you run without that, you can lose a whole day in no time... But $20 a month seems pretty tight for a team of 12. Is that figure coming out without using prompt caching? I’m curious, because with long system prompts, caching can make a twofold difference.