AI / LlamaIndex Interview Questions
What is a retriever in LlamaIndex?
A retriever is the component responsible for fetching the Nodes most relevant to a given query from an index, without doing anything with an LLM to generate a final answer.
For a VectorStoreIndex, the default retriever is a VectorIndexRetriever, which embeds the query and performs a similarity search, controlled largely by the similarity_top_k parameter that sets how many Nodes come back.
You can get a retriever on its own with index.as_retriever(), which is useful when you want to inspect what would be retrieved, build a custom pipeline, or swap in a different retrieval strategy such as keyword or hybrid search without immediately synthesizing a response.
More Related questions...