How it works
Crawl the source pages
Start with a bounded page count and path scope. Inspect the result before widening it.TypeScript ingestion
Filter unsuccessful or empty pages before indexing:numFailed and numSkipped are not the same as an endpoint-level failure. Decide whether your ingestion job can accept a partial corpus or should retry missing URLs.
followSubdomains defaults to false. Treat documentation hosts and other subdomains as explicit source decisions; keep the urlRegex scope consistent if you enable them. The crawler treats www and the apex domain as equivalent, but your index should still normalize the URLs it accepts.
Normalize page identity before chunking
Use one canonical key for a page before generating chunk IDs. Drop fragments and known tracking parameters, but preserve query parameters that change the document, language, or version. Only merge trailing-slash variants, redirects, or canonical-link targets when you have verified they identify the same content.page-identity.ts
Chunk with source metadata
Split on semantic boundaries first, then enforce your embedding model’s token limit. A useful record contains enough metadata to cite, replace, and delete the chunk later.Embed and index
Use the same embedding model and dimensions for ingestion and retrieval. Batch requests within your provider’s limits.batchesOf, embeddingProvider, and vectorIndex represent your chosen libraries. Store the embedding-model version with the index so a model migration becomes an explicit reindex operation.
Retrieve with citations
At query time:- Apply the caller’s access-control filter.
- Embed the question with the same model used for the corpus.
- Retrieve a small candidate set.
- Optionally rerank it.
- Give the answer model the chunk text, heading, and source URL.
- Require citations to come only from the supplied URLs.
- Return “I don’t have enough evidence” when retrieval is weak.
Refresh and delete stale content
Upserts add new or changed chunks but do not remove deleted pages or sections. Check crawl coverage before treating missing content as deleted: a failed or skipped page may still exist. On a complete, validated refresh:- record the set of source URLs and chunk IDs found in the new crawl;
- upsert new and changed chunks;
- delete old IDs that are no longer present;
- keep the previous successful index active until the new run passes checks;
- swap versions atomically when possible.
Stage replacement chunks under a new version so a failed embedding batch cannot leave a page half-updated. Keep tenant and document access filters attached to both versions. An upsert of new chunk IDs alone is insufficient: obsolete IDs must be retired after the new version is ready.
Evaluate answers and coverage
Create a small, representative question set before launch and track:
Re-run the evaluation when you change the crawl scope, chunker, embedding model, index settings, reranker, or prompt.
Crawl a website
Collect linked pages for your content pipeline.
Discover website URLs
Find URLs before setting your crawl scope.
Zero data retention
Understand retention controls and eligibility requirements.