rerank(
documents: string[] | DocumentInterface<Record<string, any>>[] | Record<| Name | Type | Description |
|---|---|---|
documents* | string[] | DocumentInterface<Record<string, any>>[] | Record<string, unknown>[] | A list of documents as strings, DocumentInterfaces, or objects with a |
query* | string | The query to use for reranking the documents. |
options | RerankingRequestWithoutInput |
const documents = ["To bake bread you need flour", "To bake bread you need yeast"];
const query = "What do you need to bake bread?";
const result = await reranker.rerank(documents, query);
console.log(result);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.
Optional parameters for reranking.