Dhiya — Browser-Native AI for JavaScript
An open-source client-side RAG library that runs entirely in the browser — WebGPU/WASM embeddings, IndexedDB storage, local answer generation. No server, no API keys, private by construction.
dhiya-npm on npm →What is dhiya-npm?
Dhiya (currently v2.1) is a complete retrieval-augmented generation pipeline that runs where your users already are: the browser. You hand it text, markdown, JSON, or a URL; it chunks the content on heading and paragraph boundaries, embeds the chunks locally with WebGPU (falling back to WASM), persists everything in IndexedDB, and answers questions with a local model grounded in the retrieved context. Retrieval is hybrid — vector similarity blended with BM25 keyword scoring — so exact terms like codes and product names rank as well as meaning-based matches.
Because every stage is client-side, the properties most teams struggle to bolt on come for free: no server to run, no API key to protect, no per-query bill that scales with traffic, and no user data crossing the network. The chatbot on this website runs on it.
Quickstart
Install from npm:
npm install dhiya-npmLoad your content and ask questions — with token streaming:
import { DhiyaClient } from 'dhiya-npm';
const client = new DhiyaClient();
await client.initialize();
await client.loadKnowledge({
type: 'text',
documentId: 'help',
content: 'Our warranty covers manufacturing defects for two years. Refunds can be requested within 30 days of purchase.'
});
// Streaming answer
const answer = await client.ask('What does the warranty cover?', {
onToken: (t) => appendToUI(t)
});
console.log(answer.text); // grounded answer
console.log(answer.sources); // matched chunks with similarity scores
console.log(answer.confidence); // 0..1There is also a drop-in <dhiya-chat> web-component widget for sites without a framework, and a useRAG React hook that manages the client lifecycle and streams answers into a chat array. A step-by-step walkthrough is in build a RAG chatbot with dhiya-npm.
Who built it, and why
Dhiya is built and maintained by Deep Parmar under Xwits Developers. It came out of a pattern I kept hitting in real projects: a site wants a help assistant over its own docs, but per-query API costs are hard to justify for a support widget, and sending user questions to a third-party server is a privacy conversation nobody wants to have. Small local models are now good enough for grounded Q&A over your own content — so Dhiya makes that the default architecture instead of the workaround.
The economics of this approach are covered in no-cost AI for the web with dhiya-npm, the architecture in client-side RAG in the browser, and where the project is heading in the 2026 roadmap. For the underlying tech, see Transformers.js in the browser and the WebGPU AI inference guide.
Private by construction, not by policy
Most "we respect your privacy" claims are policy promises. Dhiya's is structural: there is no server-side component to send data to. Embedding, retrieval, and generation all happen on the visitor's device, and the knowledge base lives in their browser's IndexedDB — which also means answers keep working offline after the initial model download. If your product handles data you would rather not ship to an API provider, that distinction matters more than any terms-of-service clause.
Frequently asked questions
What is dhiya-npm?
dhiya-npm is an open-source, browser-native AI library for JavaScript and TypeScript. It runs a complete retrieval-augmented generation (RAG) pipeline — chunking, embeddings, vector search, storage, and answer generation — entirely inside the browser using WebGPU or WASM. There is no server, no API key, and no per-request cost. It is published on npm as dhiya-npm.
Does dhiya send my data to a server?
No. Dhiya is private by construction: documents are chunked and embedded locally, vectors are stored in the browser's IndexedDB, and answers are generated by a local model on the user's device. User data never leaves the browser, which also means the knowledge base works offline after the initial model download.
Who created dhiya?
Dhiya was created by Deep Parmar, an AI engineer in Ahmedabad, India, and is maintained under Xwits Developers Pvt Ltd. Deep built it after repeatedly hitting the same wall in client work: most websites that want an AI assistant cannot justify per-query API costs or shipping user data to a third party.
How is dhiya different from calling an AI API?
An AI API sends every query and its context to a remote server and bills per token. Dhiya inverts that model: the models run in the visitor's browser via WebGPU or WASM, so there are no API keys to leak, no per-request costs that scale with traffic, and no user data crossing the network. The trade-off is that it uses small local models suited to grounded Q&A over your own content, not a frontier-scale chat model.
Want browser-native AI in your product?
I am happy to talk through whether client-side RAG fits your use case. Browse the rest of my projects or learn more about me.
Get in touch →