Constructor for MixedbreadAIReranker.
Optional
params: Partial<MixedbreadAIRerankParams>An optional object with properties to configure the instance.
Compress documents using Mixedbread AI's reranking API.
A list of documents to compress.
The query to use for compressing the documents.
A Promise that resolves to a list of compressed documents.
Reranks a list of documents based on their relevance to a query using the Mixedbread AI API. Returns an ordered list of documents sorted by their relevance to the provided query.
A list of documents as strings, DocumentInterfaces, or objects with a pageContent
key.
The query to use for reranking the documents.
Optional
options: RerankingRequestWithoutInputOptional parameters for reranking.
A Promise that resolves to an ordered list of documents with relevance scores.
Document compressor that uses Mixedbread AI's rerank API.
This class utilizes Mixedbread AI's reranking model to reorder a set of documents based on their relevance to a given query. The reranked documents are then used for various applications like search results refinement.
Example
Example