Overview
This guide will help you integrate and use the Mixedbread AI reranking API. The reranking API allows you to reorder a list of documents based on a given query, improving the relevance of search results or any ranked list.Installation
To get started, install the@langchain/mixedbread-ai
package:
Authentication
Obtain your API key by signing up at Mixedbread AI. You can then set theMXBAI_API_KEY
environment variable to your Mixedbread AI API key or pass it directly as the apiKey
option when constructing the class.
Using Reranking
TheMixedbreadAIReranker
class provides access to the reranking API. Here’s how to use it:
- Import the Class: First, import the
MixedbreadAIReranker
class from the package.
- Instantiate the Class: Create an instance of
MixedbreadAIReranker
with your API key.
- Rerank Documents: Use the
rerankDocuments
method to reorder documents based on a query.