Skip to content

AmazonBedrockSigV4Fetch

Namespace: Vercel.AI.AmazonBedrock

public sealed class AmazonBedrockSigV4Fetch

SigV4 fetch wrapper. The credentials are read when each call is sent.

Inheritance: object

View source

AmazonBedrockSigV4Fetch(Func<CancellationToken, Task<AmazonBedrockCredentials>>, string)

Section titled “AmazonBedrockSigV4Fetch(Func<CancellationToken, Task<AmazonBedrockCredentials>>, string)”
public AmazonBedrockSigV4Fetch(Func<CancellationToken, Task<AmazonBedrockCredentials>> getCredentials, string service = "bedrock")

Creates a wrapper that signs for <code class=“paramref”>service</code>.

Parameters

Name Type Description
getCredentials Func<CancellationToken, Task<AmazonBedrockCredentials>>
service string

View source

public Func<AmazonBedrockPreparedCall, AmazonBedrockPreparedCall>? Transport { get; set; }

Optional transport. When unset, the prepared call is returned directly.

Value: Func<AmazonBedrockPreparedCall, AmazonBedrockPreparedCall>

View source

public Func<DateTimeOffset>? UtcNow { get; set; }

Clock used for signing. Tests can pin this.

Value: Func<DateTimeOffset>

View source

SendAsync(string, string?, string?, IReadOnlyDictionary<string, string?>?, CancellationToken)

Section titled “SendAsync(string, string?, string?, IReadOnlyDictionary<string, string?>?, CancellationToken)”
public Task<AmazonBedrockPreparedCall> SendAsync(string url, string? method, string? body, IReadOnlyDictionary<string, string?>? headers, CancellationToken cancellationToken = default)

Resolves the credentials, signs the call, then invokes Transport if one is set. Calls that are not signed never read the credentials. A credential failure propagates and the transport is not called.

Parameters

Name Type Description
url string
method string
body string
headers IReadOnlyDictionary<string, string>
cancellationToken CancellationToken

Returns: Task<AmazonBedrockPreparedCall>

View source

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