Educational examples of using Amazon Bedrock across multiple programming languages.
This repository contains code samples demonstrating how to use Amazon Bedrock with various programming languages. It's designed to show that generative AI is accessible to all developers, regardless of their preferred programming language.
Each example is thoroughly documented with inline comments explaining the code's functionality, making it easy to understand and adapt to your own projects.
Before running any of the examples, you'll need:
- An AWS account with access to Amazon Bedrock
- AWS credentials configured (via AWS CLI or environment variables)
- The appropriate AWS SDK for your chosen programming language
- Basic familiarity with your chosen programming language
- Python - Using boto3
- Java - Using the AWS SDK for Java v2
- JavaScript - Using AWS SDK for JavaScript v3
- C# - Using the AWS SDK for .NET
- PHP - Using the AWS SDK for PHP
Each language directory contains three core examples:
1. InvokeModel API
- Direct model invocation using native model payloads
- Demonstrates low-level API interaction
- Useful for fine-grained control over model parameters
2. Converse API
- A typed and unified API that works across different model providers
- Simplified request/response structure
- Ideal for production applications
3. ConverseStream API
- Streaming version of the Converse API
- Provides real-time response generation
- Perfect for interactive applications
Each example includes:
- Complete, working code
- Detailed comments explaining each section
- Configuration options
- Clone this repository
- Navigate to your preferred language directory
- Install the required dependencies
- Configure your AWS credentials
- Run the examples
This repository is for educational purposes only. The code samples are designed to be:
- Easy to understand
- Ready to run
- Simple to modify
- Adaptable for your own projects
As an educational repository, it does not accept Pull Requests or Issues. For the latest information on Amazon Bedrock, please refer to the official documentation.
This project is licensed under the MIT License - see the LICENSE file for details.