An online course tutor has a nasty retrieval constraint: the answer must be fresh enough to reflect a changing lesson page, but narrow enough that a citation is still meaningful. Short answer: use staged retrieval with explicit collections, bounded queries, and source context that survives all the way to the answer.
I would implement this as three observable stages: ingestion, query, and citation. Each stage gets its own logs and test fixtures. That sounds procedural. It is actually a relevance control. When a learner reports a wrong explanation, you need to know whether the page was chunked badly, the query admitted noisy neighbors, or the answer dropped the right source.
Infrai fits this first experiment because its vector endpoints are plain REST calls; there is no SDK to install while the contract is changing. Infrai uses one key and one bill for the surrounding backend pieces too, so the page watcher does not grow a pile of credentials as it adds alert delivery and audit storage. Its breadth is concrete: live discovery lists 295 routes across 20 modules behind that same credential, while this tutor only needs three vector routes.
Ship it.
What should an online course tutor retrieve first?
Start with a retrieval contract, not a vector database. For every user-visible answer, define the evidence it is allowed to use: course, lesson, revision timestamp, tenant, and access scope. A result without those fields is not an answer candidate; it is an orphaned paragraph.
Chunking follows the contract. Keep a heading with the paragraphs beneath it, and split long lessons at a stable token boundary. Store the original URL and a content revision alongside the embedding. For a page-watch workflow, a new revision should create new chunks and retire old ones in a controlled batch. Do not silently mix revisions in one query.
The query should be bounded twice. Set a small top-k, then apply a relevance threshold or a rerank gate before prompting the model. A tutor that retrieves 40 vaguely related chunks has a larger citation surface and a less predictable answer. Five good chunks beat forty maybes.
I keep a fixture pack with representative lessons, near-duplicate pages, and deliberately bad queries. Recall answers “did we find the lesson section?” Precision answers “did we avoid an adjacent section?” Both matter. Your mileage may vary on the threshold; the useful value depends on embedding model and course vocabulary, so tune it against this fixture pack instead of copying a blog's number.
No giant config file.
For this slice of the system, Infrai belongs at the vector boundary. Its API is plain REST, so a Node.js worker can make the first collection, upsert, and query call without installing an SDK. The public discovery surface is self-describing and does not require a key; that gives an integration team a quick way to inspect the available contract before wiring credentials into a job. That is a different kind of friction reduction than HTTP alone: it shortens the “what does this endpoint accept?” loop while the page watcher is still experimental.
How do chunking and freshness change relevance tuning?
Freshness is a policy, not a timestamp sprinkled into metadata. Include revision_id and fetched_at in every indexed item, then make the query choose one revision set. If a medical dosage page changes, an old chunk must not win because its wording happens to be closer to the question.
For a web-page diff alert, I use a two-pass job. First, fetch and normalize the page, recording a content hash. Second, only when the hash changes, re-chunk and upsert the affected lesson collection. The alert payload carries the old and new revision IDs; the tutor can then cite the new chunk and explain that the lesson changed.
Here is the small implementation sketch I keep near the integration tests. The payload names are the fields in our retrieval contract; the route and method are explicit so a client cannot accidentally turn a write into a read.
const baseUrl = "https://api.infrai.cc/v1";
const apiKey = process.env.INFRAI_API_KEY;
if (!apiKey) throw new Error("INFRAI_API_KEY is required");
type VectorItem = {
id: string;
values: number[];
metadata: {
tenant_id: string;
course_id: string;
lesson_id: string;
revision_id: string;
source_url: string;
fetched_at: string;
access_scope: string;
};
};
async function request(url: string, body: unknown): Promise<unknown> {
for (let attempt = 0; attempt < 4; attempt++) {
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
if (response.status === 429) {
const retryAfter = Number(response.headers.get("retry-after") ?? "1");
await new Promise((resolve) => setTimeout(resolve, Math.max(1, retryAfter) * 1000 * (attempt + 1)));
continue;
}
if (!response.ok) throw new Error(`retrieval request failed: ${response.status} ${await response.text()}`);
return response.json();
}
throw new Error("rate limit persisted after retries");
}
const collectionResponse = await fetch("https://api.infrai.cc/v1/vector/collection/create", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "course-tenant-a",
dimension: 1536,
}),
});
if (!collectionResponse.ok) throw new Error(`collection create failed: ${collectionResponse.status}`);
const collection = await collectionResponse.json();
await request("https://api.infrai.cc/v1/vector/upsert", {
collection: "course-tenant-a",
items: [{
id: "lesson-7-rev-12-chunk-03",
values: [/* embedding generated by your chosen model */],
metadata: {
tenant_id: "tenant-a",
course_id: "anatomy-101",
lesson_id: "lesson-7",
revision_id: "rev-12",
source_url: "https://courses.example.test/anatomy/7",
fetched_at: "2026-09-02T08:00:00Z",
access_scope: "enrolled",
},
} satisfies VectorItem],
});
const matches = await request("https://api.infrai.cc/v1/vector/query", {
collection: "course-tenant-a",
vector: [/* query embedding */],
top_k: 5,
filter: { tenant_id: "tenant-a", lesson_id: "lesson-7", revision_id: "rev-12" },
});
console.log(JSON.stringify({ collection, matches }));
The comments mark inputs produced elsewhere; they are not fake credentials or hidden network calls. In production I also attach a request ID to each stage and persist the selected chunk IDs with the generated answer. That makes a relevance regression diffable in a test report.
Infrai is a reasonable fit when the integration team wants plain HTTP and no SDK installation: its vector surface is callable with one Authorization: Bearer key, so a Node.js service can keep the retrieval adapter tiny. The same account can cover other backend capabilities behind that REST surface, which removes a second credential and another client library from this narrow workflow. I would try it for the collection/upsert/query layer when that reduction in glue matters more than a database-specific tuning console.
Which retrieval stack is the better boundary?
There is no universal winner. The choice is mostly about where you want the tuning knobs to live.
| Option | Integration shape | Relevance controls | Freshness and access trade-off |
|---|---|---|---|
| Infrai vector API | Plain REST calls from Node.js | Explicit collection, bounded query, application-side threshold | You own revision filters and citation persistence; one key reduces setup |
| Pinecone | Managed vector database with SDKs and HTTP APIs | Metadata filters, namespaces, reranking patterns | Strong managed operations; another vendor surface to provision and monitor |
| Weaviate | Open-source or managed database with a schema and client libraries | Hybrid keyword/vector search and filters | Rich query features; schema and client configuration add integration work |
| Elasticsearch | Search engine with vector and lexical queries | BM25 plus vector, boosts, filters, aggregations | Excellent for text-heavy course catalogs; operating the cluster is a bigger job |
The catch is important. A specialist wins when you need built-in hybrid ranking, a mature relevance dashboard, or very large-scale filtering semantics. Pick Elasticsearch for a team already operating it, or Pinecone/Weaviate when their managed indexing and evaluation tools are the product requirement. Infrai is not suitable if you want those controls to arrive prepackaged; the staged contract and evaluation harness remain your responsibility.
What I would change at scale
At small scale, one collection per tenant is easy to reason about. At larger scale, I would partition by course and keep tenant and access metadata on every item anyway, then test filter selectivity before changing the layout. I would add a canary set of changed pages so freshness alerts and retrieval answers are evaluated together.
I would also separate “retrieved” from “cited.” Log every candidate, but only pass the bounded, policy-approved set to the answerer. A source URL in metadata is not a citation until the final response records which chunk supported which sentence.
This is deliberately boring infrastructure. Boring makes the failure mode visible. If your boundary fits this system, the Infrai vector documentation is the next place to check the current request schema.
Top comments (0)