TypeScript client for bigRAG — a self-hostable RAG platform.
Works in Node.js 18+, browsers, Deno, Bun, and edge runtimes.
npm install @bigrag/clientPublished releases use CalVer in the form YYYY.M.D.
import { BigRAG } from "@bigrag/client";
const client = new BigRAG({
apiKey: "your-api-key",
baseUrl: "http://localhost:4000",
});
// List collections
const { collections } = await client.collections.list();
// Upload a document
const doc = await client.documents.upload("my_collection", file);
// Query
const results = await client.queries.query("my_collection", {
query: "What is RAG?",
top_k: 5,
});
// Poll document processing status
let current = doc;
while (current.status === "pending" || current.status === "processing") {
await new Promise((resolve) => setTimeout(resolve, 2000));
current = await client.documents.get("my_collection", doc.id);
console.log(current.progress?.message ?? current.status);
}| Option | Default | Description |
|---|---|---|
apiKey |
BIGRAG_API_KEY env var |
API key or session token |
baseUrl |
http://localhost:4000 |
bigRAG server URL |
timeout |
120000 |
Request timeout in milliseconds |
maxRetries |
2 |
Max retries on 5xx, infrastructure 429 responses, and network errors |
fetch |
globalThis.fetch |
Custom fetch implementation |
client.collectionsfor collection CRUD, stats, and analytics.client.documentsfor uploads, batch operations, chunks, elements, and status polling.client.queriesfor single, multi-collection, and batch retrieval queries.client.chatfor generated answers, question suggestions, and streaming.client.vectorsfor raw vector upsert and delete.client.webhooksfor webhook management and delivery replay.client.authfor setup, login, identity, password, and preferences.client.adminfor users, API keys, access logs, audit logs, runtime settings, vector storage overview, connectors, embedding presets, and MCP server keys.- Top-level status helpers (
getOverviewStatus,getCollectionsStatus,getUsageStatus,getAccessStatus) for pollable admin UI aggregates. client.connectors.s3for S3-compatible bucket-prefix sources and sync jobs.client.evaluationsfor golden-set retrieval evaluations.
import { BigRAG, AuthenticationError, NotFoundError } from "@bigrag/client";
try {
await client.collections.get("missing");
} catch (err) {
if (err instanceof NotFoundError) {
console.log("Collection not found");
} else if (err instanceof AuthenticationError) {
console.log("Invalid credentials");
}
}MIT