Skip to main content

Retriever

A retriever in LlamaIndex is what is used to fetch Nodes from an index using a query string. Aa VectorIndexRetriever will fetch the top-k most similar nodes. Meanwhile, a SummaryIndexRetriever will fetch all nodes no matter the query.

const retriever = vectorIndex.asRetriever({
similarityTopK: 3,
});

// Fetch nodes!
const nodesWithScore = await retriever.retrieve({ query: "query string" });

API Reference