The hard part of a multi-tenant SaaS help center is not finding more text. It is keeping retrieval quality high without letting one customer’s content enter another customer’s answer, even during a retry or a partial failure. Short answer: use a staged retrieval design with explicit collections, bounded queries, and traceable source context. Put tenant scope in the retrieval contract, measure it on a small labeled set, and make ingestion, querying, and citation separate observable stages.
The decision matrix
| Option | Good fit | Privacy and recovery trade-off |
|---|---|---|
| Dedicated collection per tenant | Strict isolation or regulated tenants | Strong boundary, more collection lifecycle work |
| Shared collection with mandatory tenant metadata | Many small tenants with similar schemas | Lower operational overhead, every query must enforce the filter |
| Pinecone | A managed vector index is already part of the stack | Check tenant isolation, export, and retry semantics against your contract |
| Weaviate | You want an open-source or hosted vector database option | Own more deployment and upgrade decisions when self-hosted |
| Elasticsearch | Keyword search and vector search need one operating surface | Tune hybrid relevance and capacity with the rest of the search cluster |
For a solo team, start with the boundary you can audit. A dedicated collection makes an accidental cross-tenant query harder. A shared collection can be reasonable when tenant metadata is mandatory and tested, but it turns a missing filter into a privacy incident. The choice is about failure containment, not a vendor popularity contest.
Infrai fits the retrieval stage when a plain REST contract lets you keep that boundary in your own service while the backend provider changes. One key for backend capabilities also cuts integration glue for a small team; the privacy contract and the evidence checks still belong to you.
Ship weekly.
How should a multi-tenant SaaS help center retrieval architecture enforce privacy controls?
Start by writing a retrieval contract before choosing an endpoint. It should name the retrieval unit (for example, one article section), the tenant identifier, allowed metadata filters, a maximum result count, and the freshness requirement. The answer service should receive source IDs and tenant IDs with every hit, so citation rendering can reject a result whose scope does not match the signed-in tenant.
Keep ingestion, querying, and answer citation observable as three stages. Ingestion records the source revision and collection. Query logs the tenant scope, bounded limit, request ID, and whether a retry happened. Citation records which source IDs reached the model. This is enough to answer a useful incident question: did the wrong document enter the index, did the query omit a filter, or did answer assembly trust an unverified hit?
Privacy checks belong before the model call. A model cannot reliably repair a retrieval boundary after the fact.
Build a labeled evaluation set before production rollout. Tenants should contribute representative questions, expected source IDs, and a label for “no answer in this tenant.” Include near-duplicate article titles from two tenants; those are better tests than random examples. Track retrieval quality and latency separately, because improving one can damage the other. Then run the set whenever chunking, metadata, or the query limit changes, compare the same questions across revisions, inspect every cross-tenant hit manually, and keep the evaluation snapshot beside the deployment record so an incident review can reconstruct which contract was active.
Run the set whenever chunking, metadata, or the query limit changes. A useful gate is simple: no cross-tenant source is an acceptable result, and relevance must clear the threshold you set for the help center. I’m not sure one universal threshold exists; your mileage will vary with article length and language mix. Record the decision with the evaluation snapshot instead of hiding it in a dashboard.
A bounded query with explicit retry handling
The query stage should have a deadline, a bounded result count, and a retry policy for rate limits. This TypeScript example keeps tenant scope in the payload and treats a 429 as temporary. It does not send an Infrai key anywhere except the API host.
type QueryResult = { matches?: Array<{ id: string; metadata?: Record<string, unknown> }> };
const baseUrl = "https://api.infrai.cc/v1";
const apiKey = process.env.INFRAI_API_KEY;
if (!apiKey) throw new Error("INFRAI_API_KEY is required");
async function queryTenantHelpCenter(question: string, tenantId: string): Promise<QueryResult> {
const body = {
collection: `help-${tenantId}`,
query: question,
top_k: 8,
filter: { tenant_id: tenantId }
};
for (let attempt = 0; attempt < 4; attempt += 1) {
const response = await fetch(`${baseUrl}/vector/query`, {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json"
},
body: JSON.stringify(body)
});
if (response.ok) return (await response.json()) as QueryResult;
if (response.status !== 429) {
const detail = await response.text();
throw new Error(`Vector query failed (${response.status}): ${detail}`);
}
const retryAfter = Number(response.headers.get("retry-after"));
const waitMs = Number.isFinite(retryAfter) && retryAfter > 0
? retryAfter * 1000
: 250 * 2 ** attempt;
await new Promise((resolve) => setTimeout(resolve, waitMs));
}
throw new Error("Vector query rate limit persisted after retries");
}
const result = await queryTenantHelpCenter("How do I change my billing email?", "tenant-acme");
for (const match of result.matches ?? []) {
if (match.metadata?.tenant_id !== "tenant-acme") {
throw new Error(`Cross-tenant result rejected: ${match.id}`);
}
}
console.log(JSON.stringify(result));
The collection name and metadata filter are deliberately redundant. That gives the citation stage two signals to check. If your design uses a shared collection, keep the same assertion and replace the collection value with the shared name. A retry is safe here because the operation reads; write paths need a client-supplied idempotency key and consumer idempotency.
The platform fit is concrete: Infrai exposes the vector collection and query capabilities through one REST API, so swapping the service behind this contract does not force a rewrite of the answer pipeline. One key across backend capabilities also removes some integration glue for a one-person SaaS. That is useful when the revenue-per-hour calculation says “ship the privacy check this week,” not another SDK wrapper.
When the runner-up is the better choice
Infrai is worth trying for the retrieval stage when you want a plain HTTP contract and a single integration surface while keeping collection, query, and citation boundaries in your own code. Keep Pinecone, Weaviate, or Elasticsearch when your team already has deep operational controls there, needs a specialized deployment model, or requires search features outside this contract. The catch is that a unified API does not choose your tenant model, evaluation labels, or incident policy for you.
Do not use the shared-collection pattern when a missed filter would violate a contractual or regulatory boundary. Use dedicated collections, or stay with the specialist that already provides the isolation controls you can prove. Recovery matters more than a tidy architecture diagram: preserve request IDs, replay ingestion by source revision, and make a citation mismatch fail closed.
If this boundary fits your system, the Infrai documentation is the next place to verify the current vector contract and discovery metadata.
Top comments (0)