A type of Large Language Model (LLM) that interacts with the Bedrock service. It extends the base LLM class and implements the BaseBedrockInput interface. The class is designed to authenticate and interact with the Bedrock service, which is a part of Amazon Web Services (AWS). It uses AWS credentials for authentication and can be configured with various parameters such as the model to use, the AWS region, and the maximum number of tokens to generate.

Hierarchy (view full)

Implements

  • BaseBedrockInput

Constructors

Properties

codec: EventStreamCodec = ...
credentials: CredentialType

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

fetchFn: {
    (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
    (input: RequestInfo, 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: URL | RequestInfo
      • Optionalinit: RequestInit

      Returns Promise<Response>

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

      • input: RequestInfo
      • Optionalinit: RequestInit

      Returns Promise<Response>

model: string = "amazon.titan-tg1-large"

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

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.

streaming: boolean = false

Whether or not to stream responses

endpointHost?: string

Override the default endpoint hostname.

maxTokens?: number = undefined

Max tokens.

modelKwargs?: Record<string, unknown>

Additional kwargs to pass to the model.

stopSequences?: string[]
temperature?: number = undefined

Temperature.

Methods

  • Parameters

    • Optionaloptions: unknown

    Returns {
        maxTokens: undefined | number;
        model: string;
        modelKwargs: undefined | Record<string, unknown>;
        region: string;
        stop: any;
        temperature: undefined | number;
    }

    • maxTokens: undefined | number
    • model: string
    • modelKwargs: undefined | Record<string, unknown>
    • region: string
    • stop: any
    • temperature: undefined | number