MixedbreadAIReranker
Defined in: providers/mixedbread/src/MixedbreadAIReranker.ts:78
Node postprocessor that uses MixedbreadAI's rerank API.
This class utilizes MixedbreadAI's rerank model to reorder a set of nodes based on their relevance to a given query. The reranked nodes are then used for various applications like search results refinement.
Examples
Implements
BaseNodePostprocessor
Constructors
new MixedbreadAIReranker()
new MixedbreadAIReranker(
params
):MixedbreadAIReranker
Defined in: providers/mixedbread/src/MixedbreadAIReranker.ts:89
Constructor for MixedbreadRerank.
Parameters
params
Partial
<MixedbreadAIRerankerParams
>
An optional object with properties to configure the instance.
Returns
Throws
If the API key is not provided or found in the environment variables.
Properties
requestParams
requestParams:
RerankingRequestWithoutInput
Defined in: providers/mixedbread/src/MixedbreadAIReranker.ts:79
requestOptions
requestOptions:
RequestOptions
Defined in: providers/mixedbread/src/MixedbreadAIReranker.ts:80
Methods
postprocessNodes()
postprocessNodes(
nodes
,query
?):Promise
<NodeWithScore
<Metadata
>[]>
Defined in: providers/mixedbread/src/MixedbreadAIReranker.ts:142
Reranks the nodes using the mixedbread.ai API.
Parameters
nodes
NodeWithScore
<Metadata
>[]
Array of nodes with scores.
query?
MessageContent
Query string.
Returns
Promise
<NodeWithScore
<Metadata
>[]>
A Promise that resolves to an ordered list of nodes with relevance scores.
Throws
If query is undefined.
Example
Implementation of
BaseNodePostprocessor.postprocessNodes
rerank()
rerank(
nodes
,query
,options
?):Promise
<RankedDocument
[]>
Defined in: providers/mixedbread/src/MixedbreadAIReranker.ts:187
Returns an ordered list of documents sorted by their relevance to the provided query.
Parameters
nodes
A list of documents as strings, DocumentInterfaces, or objects with a pageContent
key.
BaseNode
<Metadata
>[] | string
[] | Record
<string
, unknown
>[]
query
string
The query to use for reranking the documents.
options?
RerankingRequestWithoutInput
Optional parameters for reranking.
Returns
Promise
<RankedDocument
[]>
A Promise that resolves to an ordered list of documents with relevance scores.