Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion integrations/amazon-bedrock.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pip install amazon-bedrock-haystack

Once installed, you will have access to [AmazonBedrockChatGenerator](https://docs.haystack.deepset.ai/docs/amazonbedrockchatgenerator) and [AmazonBedrockGenerator](https://docs.haystack.deepset.ai/docs/amazonbedrockgenerator) components that support generative language models on Amazon Bedrock.
You will also have access to the [AmazonBedrockTextEmbedder](https://docs.haystack.deepset.ai/docs/amazonbedrocktextembedder) and [AmazonBedrockDocumentEmbedder](https://docs.haystack.deepset.ai/docs/amazonbedrockdocumentembedder), which can be used to compute embeddings.
The integration also includes [S3Downloader](https://docs.haystack.deepset.ai/docs/s3downloader) that allows downloading files from AWS S3 buckets to the local filesystem.
The integration also includes [S3Downloader](https://docs.haystack.deepset.ai/docs/s3downloader) that allows downloading files from AWS S3 buckets to the local filesystem, and [BedrockKnowledgeBaseRetriever](https://docs.haystack.deepset.ai/docs/bedrockknowledgebaseretriever) that retrieves documents from an Amazon Bedrock Managed Knowledge Base.

To use this integration, set the AWS credentials (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_DEFAULT_REGION`) as environment variables or passed as [Secret](https://docs.haystack.deepset.ai/docs/secret-management) arguments.

Expand Down Expand Up @@ -238,3 +238,23 @@ documents = [
# Run the pipeline
result = pipe.run({"downloader": {"documents": documents}})
```

### BedrockKnowledgeBaseRetriever

Before using this component, you need to set up an [Amazon Bedrock Knowledge Base](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html) and note its ID.

```python
from haystack.utils import Secret
from haystack_integrations.components.retrievers.amazon_bedrock import BedrockKnowledgeBaseRetriever

retriever = BedrockKnowledgeBaseRetriever(
knowledge_base_id="ABCDEFGHIJ",
aws_region_name=Secret.from_token("eu-central-1"),
)

result = retriever.run(query="What are the benefits of managed knowledge bases?")
for doc in result["documents"]:
print(doc.content)
print(doc.meta["source"])
print(doc.score)
```