class BedrockInternal method that handles batching and configuration for a runnable
Call out to Bedrock service model.
Run the LLM on the given prompts and input.
Create a unique cache key for a specific call to a specific language model.
Get the identifying parameters of the LLM.
Return the string type key uniquely identifying this class of LLM.
Default streaming implementation.
Helper method to transform an Iterator of Input values into an Iterator of
Assigns new fields to the dict output of this runnable. Returns a new runnable.
Convert a runnable to a tool. Return a new instance of RunnableToolLike
Default implementation of batch, which calls invoke N times.
Run the LLM on the given prompts and input, handling caching.
This method takes prompt values, options, and callbacks, and generates
Get the number of tokens in the content.
Get the parameters used to invoke the model
This method takes an input and options, and returns a string. It
Pick keys from the dict output of this runnable. Returns a new runnable.
Create a new runnable sequence that runs each individual runnable in series,
Stream output in chunks.
Generate a stream of events emitted by the internal steps of the runnable.
Stream all output from a runnable, as reported to the callback system.
Default implementation of transform, which buffers input and then calls stream.
Bind config to a Runnable, returning a new Runnable.
Create a new runnable from the current one that will try invoking
Bind lifecycle listeners to a Runnable, returning a new Runnable.
Add retry logic to an existing runnable.
Model wrapper that returns outputs formatted to match the given schema.
The name of the serializable. Override to provide an alias or
A path to the module that contains the class, eg. ["langchain", "llms"]
The async caller should be used by subclasses to make any async calls, which will thus benefit from the concurrency and retry logic.
AWS Credentials.
If no credentials are provided, the default credentials from @aws-sdk/credential-provider-node will be used.
Override the default endpoint hostname.
A path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.
Max tokens.
Model to use. For example, "amazon.titan-tg1-large", this is equivalent to the modelId property in the list-foundation-models api.
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.
Whether or not to stream responses
Temperature.
Whether to print out response text.
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.