Ga naar hoofdinhoud

Class: CohereRerank

Implements

Constructors

constructor

new CohereRerank(topN): CohereRerank

Constructor for CohereRerank.

Parameters

NameTypeDescription
topNCohereRerankOptionsNumber of nodes to return.

Returns

CohereRerank

Defined in

packages/core/src/postprocessors/rerankers/CohereRerank.ts:24

Properties

apiKey

apiKey: null | string = null

Defined in

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


client

Private client: null | CohereClient = null

Defined in

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


model

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

Defined in

packages/core/src/postprocessors/rerankers/CohereRerank.ts:15


topN

topN: number = 2

Defined in

packages/core/src/postprocessors/rerankers/CohereRerank.ts:14

Methods

postprocessNodes

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

Reranks the nodes using the Cohere API.

Parameters

NameTypeDescription
nodesNodeWithScore<Metadata>[]Array of nodes with scores.
query?stringQuery string.

Returns

Promise<NodeWithScore<Metadata>[]>

Implementation of

BaseNodePostprocessor.postprocessNodes

Defined in

packages/core/src/postprocessors/rerankers/CohereRerank.ts:47