langchain.js
    Preparing search index...

    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 Summary)

    Implements

    • BaseBedrockInput
    Index

    Constructors

    • Parameters

      • Optionalfields: any

      Returns Bedrock

    Properties

    codec: EventStreamCodec = ...
    credentials: CredentialType

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

    endpointHost?: string

    Override the default endpoint hostname.

    fetchFn: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | URL | Request, init?: RequestInit): Promise<Response>;
    }

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

    Type Declaration

      • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
      • Parameters

        • input: URL | RequestInfo
        • Optionalinit: RequestInit

        Returns Promise<Response>

      • (input: string | URL | Request, init?: RequestInit): Promise<Response>
      • Parameters

        • input: string | URL | Request
        • Optionalinit: RequestInit

        Returns Promise<Response>

    lc_serializable: boolean = true
    maxTokens?: number = undefined

    Max tokens.

    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.

    modelKwargs?: Record<string, unknown>

    Additional kwargs to pass to the model.

    modelProvider: 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.

    stopSequences?: string[]
    streaming: boolean = false

    Whether or not to stream responses

    temperature?: number = undefined

    Temperature.

    Accessors

    • get lc_aliases(): Record<string, string>

      Returns Record<string, string>

    • get lc_attributes(): undefined | SerializedFields

      Returns undefined | SerializedFields

    • get lc_secrets(): undefined | { [key: string]: string }

      Returns undefined | { [key: string]: string }

    Methods

    • Call out to Bedrock service model. Arguments: prompt: The prompt to pass into the model.

      Returns: The string generated by the model.

      Example: response = model.invoke("Tell me a joke.")

      Parameters

      • prompt: string
      • options: unknown
      • OptionalrunManager: any

      Returns Promise<string>

    • Returns string

    • Parameters

      • reader: any

      Returns { "[asyncIterator]"(): AsyncGenerator<Uint8Array<ArrayBuffer>, void, unknown> }

    • Parameters

      • prompt: string
      • options: unknown
      • fields: {
            bedrockMethod: "invoke" | "invoke-with-response-stream";
            endpointHost: string;
            provider: string;
        }

      Returns Promise<any>

    • Parameters

      • prompt: string
      • options: unknown
      • OptionalrunManager: any

      Returns AsyncGenerator<GenerationChunk>

    • Parameters

      • Optionaloptions: unknown

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

    • Returns string