Skip to main content
Voyage AI provides cutting-edge embedding/vectorizations models.
This notebook shows how to use Voyage AI’s rerank endpoint in a retriever. This builds on top of ideas in the ContextualCompressionRetriever.

Set up the base vector store retriever

Let’s start by initializing a simple vector store retriever and storing the 2023 State of the Union speech (in chunks). We can set up the retriever to retrieve a high number (20) of docs. You can use any of the following Embeddings models: (source):
  • voyage-3
  • voyage-3-lite
  • voyage-large-2
  • voyage-code-2
  • voyage-2
  • voyage-law-2
  • voyage-lite-02-instruct
  • voyage-finance-2
  • voyage-multilingual-2

Doing reranking with VoyageAIRerank

Now let’s wrap our base retriever with a ContextualCompressionRetriever. We’ll use the Voyage AI reranker to rerank the returned results. You can use any of the following Reranking models: (source):
  • rerank-2
  • rerank-2-lite
  • rerank-1
  • rerank-lite-1
You can of course use this retriever within a QA pipeline