Aller au contenu principal

Class: CohereRerank

Implements

Constructors

new CohereRerank()

new CohereRerank(topN): CohereRerank

Constructor for CohereRerank.

Parameters

topN: CohereRerankOptions

Number of nodes to return.

Returns

CohereRerank

Source

packages/llamaindex/src/postprocessors/rerankers/CohereRerank.ts:26

Properties

apiKey

apiKey: null | string = null

Source

packages/llamaindex/src/postprocessors/rerankers/CohereRerank.ts:18


client

private client: null | CohereClient = null

Source

packages/llamaindex/src/postprocessors/rerankers/CohereRerank.ts:20


model

model: string = "rerank-english-v2.0"

Source

packages/llamaindex/src/postprocessors/rerankers/CohereRerank.ts:17


topN

topN: number = 2

Source

packages/llamaindex/src/postprocessors/rerankers/CohereRerank.ts:16

Methods

postprocessNodes()

postprocessNodes(nodes, query?): Promise <NodeWithScore <Metadata>[]>

Reranks the nodes using the Cohere API.

Parameters

nodes: NodeWithScore <Metadata>[]

Array of nodes with scores.

query?: MessageContent

Query string.

Returns

Promise <NodeWithScore <Metadata>[]>

Implementation of

BaseNodePostprocessor . postprocessNodes

Source

packages/llamaindex/src/postprocessors/rerankers/CohereRerank.ts:49