Are you sure you want to delete this access key?
You can run this example with:
npx promptfoo@latest init --example amazon-bedrock
Set up your AWS credentials:
export AWS_ACCESS_KEY_ID="your_access_key"
export AWS_SECRET_ACCESS_KEY="your_secret_key"
See authentication docs for other auth methods, including SSO profiles.
Request model access in your AWS region:
Install required dependencies:
# For basic Bedrock models
npm install @aws-sdk/client-bedrock-runtime
# For Knowledge Base examples
npm install @aws-sdk/client-bedrock-agent-runtime
This directory contains several example configurations for different Bedrock models:
promptfooconfig.claude.yaml
- Claude 3.7 Sonnetpromptfooconfig.llama.yaml
- Llama3promptfooconfig.mistral.yaml
- Mistralpromptfooconfig.nova.yaml
- Amazon's Nova modelspromptfooconfig.nova.tool.yaml
- Nova with tool usage examplespromptfooconfig.nova.multimodal.yaml
- Nova with multimodal capabilitiespromptfooconfig.titan-text.yaml
- Titan text generation examplespromptfooconfig.kb.yaml
- Knowledge Base RAG example with citations and contextTransformpromptfooconfig.yaml
- Combined evaluation across multiple providerspromptfooconfig.nova-sonic.yaml
- Amazon Nova Sonic model for audioThe Knowledge Base example (promptfooconfig.kb.yaml
) demonstrates how to use AWS Bedrock Knowledge Base for Retrieval Augmented Generation (RAG).
For this example, you'll need to:
providers:
- id: bedrock:kb:us.anthropic.claude-sonnet-4-20250514-v1:0
config:
region: 'us-east-2' # Change to your region
knowledgeBaseId: 'YOUR_KNOWLEDGE_BASE_ID' # Replace with your KB ID
When running the Knowledge Base example, you'll see:
contextTransform
feature extracting context from citations for evaluationThe example includes questions about promptfoo configuration, providers, and evaluation techniques that work well with the embedded promptfoo documentation.
Note: You'll need to update the knowledgeBaseId
with your actual Knowledge Base ID and ensure the Knowledge Base is configured to work with the selected Claude model.
For detailed Knowledge Base setup instructions, see the AWS Bedrock Knowledge Base Documentation.
Run the evaluation:
promptfoo eval -c [path/to/config.yaml]
View the results:
promptfoo view
Press p or to see the previous file or, n or to see the next file
Browsing data directories saved to S3 is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with AWS S3!
Are you sure you want to delete this access key?
Browsing data directories saved to Google Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with Google Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to Azure Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with Azure Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to S3 compatible storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with your S3 compatible storage!
Are you sure you want to delete this access key?