The Developer Publishing Hub
One platform to write, cross-post to Dev.to, Medium, WordPress, Hashnode, and Bluesky, and protect your SEO with canonical links. Zero paywalls and full content ownership.
Markdown supported · ⌘↵ to post
The paragraph-based chunker needs one additional size guard: a single paragraph can exceed max_tokens, because it is appended after the overflow check and is never split. That matters when the embedding endpoint truncates long inputs without rejecting them.
The stored chunk can then contain a relevant sentence that never contributed to its vector, making the failure look like weak semantic retrieval. I would add a long-paragraph fixture and assert the final token count using the embedding tokenizer, including any contextual prefix. Record truncation explicitly or reject oversized chunks before indexing, so the text you inspect is the text the embedding model actually saw.
Abhinav Sharma
Framing RAG as a search system with a language model on the end is the clearest mental model of it. Most bad answers really are retrieval misses upstream, and walking the failure modes per stage is more useful than another architecture diagram.