Skip to content

AmazonBedrockRerankingModel

Namespace: Vercel.AI.AmazonBedrock

public sealed class AmazonBedrockRerankingModel : IRerankingModel, IRerankCaller

Amazon Bedrock Agent Runtime rerank model.

Inheritance: object

Implements: IRerankingModel, IRerankCaller

View source

AmazonBedrockRerankingModel(AmazonBedrockProvider, string)

Section titled “AmazonBedrockRerankingModel(AmazonBedrockProvider, string)”
public AmazonBedrockRerankingModel(AmazonBedrockProvider provider, string modelId)

Creates a reranking model.

Parameters

Name Type Description
provider AmazonBedrockProvider
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?, JsonElement?, CancellationToken)

Section titled “DoRerankAsync(string, IReadOnlyList<string>, int?, JsonElement?, CancellationToken)”
public Task<RerankResult> DoRerankAsync(string query, IReadOnlyList<string> documents, int? topN, JsonElement? providerOptions, CancellationToken cancellationToken)

Reranks text documents. <code class=“paramref”>providerOptions</code> is the V4 provider-options object (amazonBedrock or legacy bedrock).

Parameters

Name Type Description
query string
documents IReadOnlyList<string>
topN int?
providerOptions JsonElement?
cancellationToken CancellationToken

Returns: Task<RerankResult>

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

DoRerankAsync(RerankModelCall, CancellationToken)

Section titled “DoRerankAsync(RerankModelCall, CancellationToken)”
public Task<RerankModelResponse> DoRerankAsync(RerankModelCall call, CancellationToken cancellationToken)

Reranks text or object documents. Call headers are sent before SigV4 signing. The response carries the headers and raw body, with no warnings or provider metadata.

Parameters

Name Type Description
call RerankModelCall
cancellationToken CancellationToken

Returns: Task<RerankModelResponse>

View source

DoRerankObjectsAsync(string, IReadOnlyList<JsonElement>, int?, JsonElement?, CancellationToken)

Section titled “DoRerankObjectsAsync(string, IReadOnlyList<JsonElement>, int?, JsonElement?, CancellationToken)”
public Task<RerankResult> DoRerankObjectsAsync(string query, IReadOnlyList<JsonElement> documents, int? topN, JsonElement? providerOptions, CancellationToken cancellationToken)

Reranks JSON documents. Each value is sent as an inline JSON document.

Parameters

Name Type Description
query string
documents IReadOnlyList<JsonElement>
topN int?
providerOptions JsonElement?
cancellationToken CancellationToken

Returns: Task<RerankResult>

View source

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