interface BedrockChatFields {
    authorizationToken?: string;
    awsAccessKeyId?: string;
    awsContainerAuthorizationToken?: string;
    awsContainerAuthorizationTokenFile?: string;
    awsContainerCredentialsFullUri?: string;
    awsContainerCredentialsRelativeUri?: string;
    awsSecretAccessKey?: string;
    awsSessionToken?: string;
    cache?: boolean | BaseCache<Generation[]>;
    callbackManager?: CallbackManager;
    callbacks?: Callbacks;
    clientConfig?: any;
    clientPlugins?: Pluggable<any, any>[];
    configFilepath?: string;
    credentials?: CredentialType;
    credentialsFullUri?: string;
    disableStreaming?: boolean;
    durationSeconds: undefined | number;
    ec2MetadataV1Disabled?: boolean;
    endpointHost?: string;
    endpointUrl?: string;
    fetchFn?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>);
    filepath?: string;
    guardrailConfig?: {
        streamProcessingMode: "SYNCHRONOUS" | "ASYNCHRONOUS";
        tagSuffix: string;
    };
    guardrailIdentifier?: string;
    guardrailVersion?: string;
    ignoreCache?: boolean;
    logger?: Logger;
    maxConcurrency?: number;
    maxRetries?: number;
    maxTokens?: number;
    metadata?: Record<string, unknown>;
    mfaCodeProvider?: ((mfaSerial: string) => Promise<string>);
    model?: string;
    modelKwargs?: Record<string, unknown>;
    onFailedAttempt?: FailedAttemptHandler;
    parentClientConfig?: {
        profile?: string;
        region?: string | Provider<string>;
        [key: string]: unknown;
    };
    policy: undefined | string;
    policyArns: undefined | {
        arn?: string;
    }[];
    profile?: string;
    providerId: undefined | string;
    region?: string;
    roleArn: undefined | string;
    roleAssumer?: ((sourceCreds: AwsCredentialIdentity, params: AssumeRoleParams) => Promise<AwsCredentialIdentity>);
    roleAssumerWithWebIdentity?: ((params: AssumeRoleWithWebIdentityParams) => Promise<AwsCredentialIdentity>) & ((params: AssumeRoleWithWebIdentityParams) => Promise<AwsCredentialIdentity>);
    roleSessionName?: string;
    ssoAccountId?: string;
    ssoClient?: SSOClient;
    ssoRegion?: string;
    ssoRoleName?: string;
    ssoSession?: string;
    ssoStartUrl?: string;
    stopSequences?: string[];
    streaming?: boolean;
    tags?: string[];
    temperature?: number;
    timeout?: number;
    trace?: "ENABLED" | "DISABLED";
    verbose?: boolean;
    webIdentityTokenFile?: string;
}

Hierarchy

  • Partial<BaseBedrockInput>
  • BaseChatModelParams
  • Partial<DefaultProviderInit>
    • BedrockChatFields

Properties

authorizationToken?: string

BROWSER ONLY.

Providing this value will set an "Authorization" request header value on the GET request.

awsAccessKeyId?: string
awsContainerAuthorizationToken?: string

An alternative to awsContainerAuthorizationTokenFile, this is the token value itself.

For browser environments, use instead authorizationToken.

awsContainerAuthorizationTokenFile?: string

Will be read on each credentials request to add an Authorization request header value.

Not supported in browsers.

awsContainerCredentialsFullUri?: string

If this value is provided, it will be used as-is.

For browser environments, use instead credentialsFullUri.

awsContainerCredentialsRelativeUri?: string

If this value is provided instead of the full URI, it will be appended to the default link local host of 169.254.170.2.

Not supported in browsers.

awsSecretAccessKey?: string
awsSessionToken?: string
cache?: boolean | BaseCache<Generation[]>
callbackManager?: CallbackManager

Use callbacks instead

callbacks?: Callbacks
clientConfig?: any

STSClientConfig or SSOClientConfig to be used for creating inner client for auth operations.

clientPlugins?: Pluggable<any, any>[]
configFilepath?: string

The path at which to locate the ini config file. Defaults to the value of the AWS_CONFIG_FILE environment variable (if defined) or ~/.aws/config otherwise.

credentials?: CredentialType

AWS Credentials. If no credentials are provided, the default credentials from @aws-sdk/credential-provider-node will be used.

credentialsFullUri?: string

BROWSER ONLY.

In browsers, a relative URI is not allowed, and a full URI must be provided. HTTPS is required.

This value is required for the browser environment.

disableStreaming?: boolean

Whether to disable streaming.

If streaming is bypassed, then stream() will defer to invoke().

  • If true, will always bypass streaming case.
  • If false (default), will always use streaming case if available.
durationSeconds: undefined | number
ec2MetadataV1Disabled?: boolean

Only used in the IMDS credential provider.

endpointHost?: string

Override the default endpoint hostname.

endpointUrl?: string

Use endpointHost instead Override the default endpoint url.

fetchFn?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>)

A custom fetch function for low-level access to AWS API. Defaults to fetch().

Type declaration

    • (input, init?): Promise<Response>
    • Parameters

      • input: RequestInfo | URL
      • Optionalinit: RequestInit

      Returns Promise<Response>

filepath?: string

The path at which to locate the ini credentials file. Defaults to the value of the AWS_SHARED_CREDENTIALS_FILE environment variable (if defined) or ~/.aws/credentials otherwise.

guardrailConfig?: {
    streamProcessingMode: "SYNCHRONOUS" | "ASYNCHRONOUS";
    tagSuffix: string;
}

Required when Guardrail is in use.

guardrailIdentifier?: string

Identifier for the guardrail configuration.

guardrailVersion?: string

Version for the guardrail configuration.

ignoreCache?: boolean

When true, always reload credentials from the file system instead of using cached values. This is useful when you need to detect changes to the credentials file.

logger?: Logger

For credential resolution trace logging.

maxConcurrency?: number

The maximum number of concurrent calls that can be made. Defaults to Infinity, which means no limit.

maxRetries?: number

The maximum number of retries that can be made for a single call, with an exponential backoff between each attempt. Defaults to 6.

maxTokens?: number

Max tokens.

metadata?: Record<string, unknown>
mfaCodeProvider?: ((mfaSerial: string) => Promise<string>)

A function that returns a promise fulfilled with an MFA token code for the provided MFA Serial code. If a profile requires an MFA code and mfaCodeProvider is not a valid function, the credential provider promise will be rejected.

Type declaration

    • (mfaSerial): Promise<string>
    • Parameters

      • mfaSerial: string

        The serial code of the MFA device specified.

      Returns Promise<string>

model?: string

Model to use. For example, "amazon.titan-tg1-large", this is equivalent to the modelId property in the list-foundation-models api.

modelKwargs?: Record<string, unknown>

Additional kwargs to pass to the model.

onFailedAttempt?: FailedAttemptHandler

Custom handler to handle failed attempts. Takes the originally thrown error object as input, and should itself throw an error if the input error is not retryable.

parentClientConfig?: {
    profile?: string;
    region?: string | Provider<string>;
    [key: string]: unknown;
}

Present if the credential provider was created by calling the defaultCredentialProvider in a client's middleware, having access to the client's config.

The region of that parent or outer client is important because an inner client used by the credential provider may need to match its default partition or region with that of the outer client.

  • not truly deprecated, marked as a warning to not use this.
policy: undefined | string
policyArns: undefined | {
    arn?: string;
}[]
profile?: string

The configuration profile to use.

providerId: undefined | string
region?: string

The AWS region e.g. us-west-2. Fallback to AWS_DEFAULT_REGION env variable or region specified in ~/.aws/config in case it is not provided here.

roleArn: undefined | string
roleAssumer?: ((sourceCreds: AwsCredentialIdentity, params: AssumeRoleParams) => Promise<AwsCredentialIdentity>)

A function that assumes a role and returns a promise fulfilled with credentials for the assumed role.

Type declaration

    • (sourceCreds, params): Promise<AwsCredentialIdentity>
    • Parameters

      • sourceCreds: AwsCredentialIdentity

        The credentials with which to assume a role.

      • params: AssumeRoleParams

      Returns Promise<AwsCredentialIdentity>

roleAssumerWithWebIdentity?: ((params: AssumeRoleWithWebIdentityParams) => Promise<AwsCredentialIdentity>) & ((params: AssumeRoleWithWebIdentityParams) => Promise<AwsCredentialIdentity>)

A function that assumes a role with web identity and returns a promise fulfilled with credentials for the assumed role.

The credentials with which to assume a role.

roleSessionName?: string

The IAM session name used to distinguish sessions.

ssoAccountId?: string

The ID of the AWS account to use for temporary credentials.

ssoClient?: SSOClient
ssoRegion?: string

The AWS region to use for temporary credentials.

ssoRoleName?: string

The name of the AWS role to assume.

ssoSession?: string

SSO session identifier. Presence implies usage of the SSOTokenProvider.

ssoStartUrl?: string

The URL to the AWS SSO service.

stopSequences?: string[]

Optional additional stop sequences to pass to the model. Currently only supported for Anthropic and AI21.

Use .bind({ "stop": [...] }) instead

streaming?: boolean

Whether or not to stream responses

tags?: string[]
temperature?: number

Temperature.

timeout?: number

Default is 1000ms. Time in milliseconds to spend waiting between retry attempts.

trace?: "ENABLED" | "DISABLED"

Trace settings for the Bedrock Guardrails.

verbose?: boolean
webIdentityTokenFile?: string

File location of where the OIDC token is stored.