Skip to content

CohereRerankingModel

Namespace: Vercel.AI.Cohere

public sealed class CohereRerankingModel : IRerankingModel

Cohere rerank model.

Inheritance: object

Implements: IRerankingModel

View source

CohereRerankingModel(CohereProvider, string)

Section titled “CohereRerankingModel(CohereProvider, string)”
public CohereRerankingModel(CohereProvider provider, string modelId)

Creates a reranking model.

Parameters

Name Type Description
provider CohereProvider
modelId string

View source

public string ModelId { get; }

Model id.

Value: string

View source

public string Provider { get; }

Provider id.

Value: string

View source

DoRerankAsync(string, IReadOnlyList<string>, int?, CancellationToken, IReadOnlyDictionary<string, string?>?)

Section titled “DoRerankAsync(string, IReadOnlyList<string>, int?, CancellationToken, IReadOnlyDictionary<string, string?>?)”
public Task<RerankResult> DoRerankAsync(string query, IReadOnlyList<string> documents, int? topN, CancellationToken cancellationToken, IReadOnlyDictionary<string, string?>? headers = null)

Reranks documents for a query. <code class=“paramref”>headers</code> are sent with this call and override the provider headers.

Parameters

Name Type Description
query string
documents IReadOnlyList<string>
topN int?
cancellationToken CancellationToken
headers IReadOnlyDictionary<string, string>

Returns: Task<RerankResult>

View source

RerankAsync(CohereRerankRequest, CancellationToken)

Section titled “RerankAsync(CohereRerankRequest, CancellationToken)”
public Task<CohereRerankResult> RerankAsync(CohereRerankRequest request, CancellationToken cancellationToken)

Reranks text or JSON documents and returns the response body.

Parameters

Name Type Description
request CohereRerankRequest
cancellationToken CancellationToken

Returns: Task<CohereRerankResult>

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product