const model = new BedrockChat({
model: "anthropic.claude-v2",
region: "us-east-1",
});
const res = await model.invoke([{ content: "Tell me a joke" }]);
console.log(res);

Hierarchy (view full)

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>

guardrailIdentifier: string = ""

Identifier for the guardrail configuration.

guardrailVersion: string = ""

Version for the guardrail configuration.

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

usesMessagesApi: boolean = false
endpointHost?: string

Override the default endpoint hostname.

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

Required when Guardrail is in use.

maxTokens?: number = undefined

Max tokens.

modelKwargs?: Record<string, unknown>

Additional kwargs to pass to the model.

stopSequences?: string[]

Use as a call option using .bind() instead.

temperature?: number = undefined

Temperature.

trace?: "ENABLED" | "DISABLED"

Trace settings for the Bedrock Guardrails.

Methods

  • Parameters

    • Optionaloptions: unknown

    Returns {
        guardrailConfig: undefined | {
            streamProcessingMode: "SYNCHRONOUS" | "ASYNCHRONOUS";
            tagSuffix: string;
        };
        max_tokens: undefined | number;
        modelKwargs: undefined | Record<string, unknown>;
        stop: any;
        temperature: undefined | number;
        tools: AnthropicTool[];
    }

    • guardrailConfig: undefined | {
          streamProcessingMode: "SYNCHRONOUS" | "ASYNCHRONOUS";
          tagSuffix: string;
      }
    • max_tokens: undefined | number
    • modelKwargs: undefined | Record<string, unknown>
    • stop: any
    • temperature: undefined | number
    • tools: AnthropicTool[]