Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

DeepsetAmazonBedrockGenerator

Generate text using large language models hosted on Haystack Platform's Amazon Bedrock account, so you don't need to create your own account.

Deprecation Notice

This component is deprecated. It will continue to work in your existing pipelines for now. You can replace it with the AmazonBedrockChatGenerator component.

DeepsetAmazonBedrockGenerator makes it possible to use models in Amazon Bedrock through Haystack Platform's Bedrock account. You don't need your own Bedrock account to use these models. To use models through your own Bedrock account, use AmazonBedrockGenerator.

For a full list of models, see Amazon Bedrock documentation.

Key Features

  • Accesses Amazon Bedrock models through Haystack Platform's account — no separate AWS account required.
  • String-based input and output interface, compatible with PromptBuilder.
  • Supports streaming responses token by token.
  • Configurable region, max length, and model-specific parameters.

Configuration

  1. Drag the DeepsetAmazonBedrockGenerator component onto the canvas from the Component Library.
  2. Click on the component to open the configuration panel.
  3. On the General tab:
    1. Enter the model name in the Model field (for example, meta.llama2-13b-chat-v1).
    2. Set the AWS region name. Supported regions are:
      • us-east-1: Works for most models.
      • us-west-2: Choose for newest models.
      • eu-central-1: Choose for EU-hosted models.
  4. Go to the Advanced tab to configure max_length, streaming_callback, and other model-specific kwargs.

Connections

DeepsetAmazonBedrockGenerator receives the prompt from PromptBuilder through its prompt input. It outputs generated text as a list of strings through its replies output, which you connect to AnswerBuilder.

Usage Examples

Basic Configuration

  DeepsetAmazonBedrockGenerator:
type: deepset_cloud_custom_nodes.generators.deepset_amazon_bedrock_generator.DeepsetAmazonBedrockGenerator
init_parameters:
model: amazon.titan-text-premier-v1:0

This example uses the Llama2 model hosted on Amazon Bedrock to generate answers. It gets the prompt with documents from PromptBuilder and then sends the generated replies to AnswerBuilder:

components:
# ...
prompt_builder:
type: haystack.components.builders.prompt_builder.PromptBuilder
init_parameters:
template: |-
You are a technical expert.
You answer questions truthfully based on provided documents.
For each document check whether it is related to the question.
Only use documents that are related to the question to answer it.
Ignore documents that are not related to the question.
If the answer exists in several documents, summarize them.
Only answer based on the documents provided. Don't make things up.
If the documents can't answer the question or you are unsure say: 'The answer can't be found in the text'.
These are the documents:
{% for document in documents %}
Document[{{ loop.index }}]:
{{ document.content }}
{% endfor %}
Question: {{question}}
Answer:

llm:
type: deepset_cloud_custom_nodes.generators.deepset_amazon_bedrock_generator.DeepsetAmazonBedrockGenerator
init_parameters:
model: "meta.llama2-13b-chat-v1"
aws_region_name: us-east-1 # Region name is required
max_length: 400
model_max_length: 4096
temperature: 0
streaming_callback: deepset_cloud_custom_nodes.callbacks.streaming.streaming_callback # makes this generator stream

answer_builder:
type: haystack.components.builders.answer_builder.AnswerBuilder

connections:
# ...
- sender: prompt_builder.prompt
receiver: llm.prompt
- sender: llm.replies
receiver: answer_builder.replies

Parameters

Inputs

ParameterTypeDescription
promptstrThe prompt with instructions for the model.
generation_kwargsOptional[Dict[str, Any]]Additional keyword arguments for text generation. These parameters potentially override the parameters passed in pipeline configuration.

Outputs

ParameterTypeDescription
repliesList[str]A list of strings containing the generated responses.

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
modelstrThe name or path of the model in Amazon Bedrock.
aws_region_namestr | NoneNoneThe AWS region. Supported regions: us-east-1 (works for most models), us-west-2 (newest models), eu-central-1 (EU-hosted models).
max_lengthint | None100The maximum length of generated text.
truncatebool | NoneTrueWhether to truncate the generated text to the maximum length.
streaming_callbackCallable[[StreamingChunk], None] | NoneNoneA callback function to handle streaming chunks.
kwargsAnyAdditional keyword arguments for the model. These arguments are model-specific. For supported arguments, check the model's documentation.

Run Method Parameters

This component doesn't accept any runtime parameters.