Knowledge Library — domain-aware AI / enterprise differentiator
5
Built a RAG knowledge system that made AI SQL generation org-aware — became a core enterprise differentiator
AI generated syntactically correct but semantically wrong SQL because it had no idea what each org's data meant. Built an async ingestion pipeline with Pub/Sub + Pinecone hybrid search + Cohere reranking so customers could inject their own docs, definitions, and rules — retrieved at query time. Became a key driver for enterprise sales.
At Doowii, we built an AI analytics platform converting natural language to SQL for enterprise customers. SQL quality was highly variable — not because the model was bad, but because it had no understanding of each org's world. Things like what a "churned customer" means at that company, internal table naming conventions, domain rules that only exist as tribal knowledge. The AI would produce syntactically valid SQL that was semantically wrong.
T — Task
Design and build a system that let enterprise customers inject their own domain knowledge — docs, definitions, business rules — and have it automatically retrieved and used as context at query time. The core challenge was a distributed systems problem: async ingestion and vector embedding at scale, retrieval under tight latency budgets, and correct scoping per organization and per user.
A — Action
Defined four knowledge types (free-text instructions, key-value definitions, categorical knowledge with org overrides, uploaded PDFs), each with distinct ingestion logic. Built an async decoupled pipeline: the webserver writes metadata to Firestore and publishes a Pub/Sub message; a Cloud Run service parses, chunks, embeds (dense + sparse), and writes to Pinecone — status tracked across PENDING → PROCESSING → COMPLETED. At query time, the LangGraph agent runs hybrid search, uses Cohere reranking (top 5 of 50), expands matched chunks for ~1,000 tokens of context, with org-level and user-level retrieval running in parallel. Added a 5s timeout and 3 retry attempts for graceful degradation.
R — Result
SQL generation accuracy on org-specific questions improved significantly — especially for queries hinging on company-specific terminology and business rules. Became a core enterprise differentiator: prospects could upload their own docs and watch the AI answer live questions about their data correctly during demos.
meaningful SQL accuracy improvementasync pipeline — zero latency impactkey enterprise sales driverorg + user scoped retrieval
90-second version — ready to say out loud
"The AI on our platform could generate syntactically correct SQL, but it often got the semantics completely wrong for a given customer. Not because the model was bad — but because it had no idea what their data actually meant. What does 'churned customer' mean at this company? What are their internal table naming conventions? That kind of domain knowledge only exists as tribal knowledge inside the org.
So I designed and built a system we called the Knowledge Library. The idea was: let customers inject their own context — PDFs, free-text definitions, business rules — and have that context automatically retrieved and injected at query time.
The hardest part was building this without impacting latency at all. I decoupled ingestion completely using Pub/Sub: when a customer uploads knowledge, a Cloud Run worker parses, chunks, and embeds it asynchronously — dense and sparse vectors into Pinecone — completely off the critical path. At query time, our LangGraph agent runs hybrid search, reranks the top results with Cohere, and injects the most relevant context before generating SQL. Org-level and user-level retrieval run in parallel. I added a 5-second timeout and retry logic so it degrades gracefully if anything goes wrong.
The impact was real. SQL accuracy on org-specific questions improved meaningfully. And it opened up a new kind of enterprise demo: a prospect could upload their own documentation and then watch the AI correctly answer live questions about their data — right there in the room. That became one of our biggest sales differentiators."
"Most technically complex thing you've built"
Lead with: the distributed systems challenge — async pipeline, hybrid vectors, retrieval under latency budgets
Walk through the architecture: Pub/Sub → Cloud Run → Pinecone → LangGraph agent. Show depth.
"Improved a product in a meaningful way"
Lead with: the business problem — AI that sounded right but was wrong for the org
The SQL accuracy improvement + the live demo story is the most compelling result — use it
"Ambiguous problem, no clear solution"
Lead with: the design space — four knowledge types, each with different ingestion needs
Emphasize that you had to define what "domain knowledge" even meant before building anything
"Built something that helped enterprise customers"
Lead with: the personalization angle — org-specific context = AI that actually works for your business
Close on the demo moment: upload your docs, watch the AI answer your questions live
This story works especially well for AI-first companies (like Box) who care about unlocking organizational knowledge. Connect the dots: "The challenge Box faces — making AI useful against a company's own content — is exactly the problem I was solving at Doowii."