A collection of Python scripts utilizing AWS Bedrock Claude Sonnet 4.6 model, providing various text processing capabilities including translation, summarization, and text formalization.
- Ask Me Anything - Ask Claude AI any question
- Text Formalization - Rewrite text into formal and logically clear versions
- Meeting Summarization - Generate summaries for meetings
- Translation - Bidirectional translation between English and Traditional Chinese
- Text Summarization - Generate text summaries in Traditional Chinese
- Streaming Output - All features support real-time streaming responses
- Python 3.12
- PDM (Python Development Master) - Python package manager
- AWS account with Bedrock access permissions
- Configured AWS credentials (via AWS CLI or environment variables)
PDM is the recommended package manager for this project. Install it using:
# macOS/Linux
curl -sSL https://pdm-project.org/install-pdm.py | python3 -
# Or using pip
pip install --user pdm
# Or using Homebrew (macOS)
brew install pdmFor more installation options, visit: https://pdm-project.org/latest/#installation
git clone <repository-url>
cd raycast-bedrock-scripts
# Install dependencies using PDM
pdm installUse PDM to run scripts in the managed environment:
# Run any script using pdm run
pdm run python source/ask-me-anything.py "Your question"
# Or activate the virtual environment
eval $(pdm venv activate)
python source/ask-me-anything.py "Your question"Ensure your AWS credentials are properly configured with permissions to access Bedrock services.
View available Anthropic models:
aws bedrock list-foundation-models --region=us-west-2 --by-provider anthropic --query "modelSummaries[*].modelId"Default Model: The scripts use global.anthropic.claude-sonnet-4-6 (Claude Sonnet 4.6) by default in the ap-northeast-1 region.
Note: All commands below can be prefixed with pdm run to use the PDM-managed environment:
pdm run python source/script-name.py [arguments]Ask Claude AI any question:
# Direct question input
pdm run python source/ask-me-anything.py "What is AWS Lambda?"
# Read question from file
pdm run python source/ask-me-anything.py -f question.txt
# Save response to file
pdm run python source/ask-me-anything.py "Explain Docker" -o answer.txt
# Using shell script
./ask-me-anything.sh "Your question here"Rewrite text into formal and logically clear versions:
# Direct text input
pdm run python source/formal-text-with-bedrock.py "casual text here"
# Read from file
pdm run python source/formal-text-with-bedrock.py -f input.txt -o formal.txt
# Using shell script
./formal-text-with-bedrock.sh "text to formalize"Generate summaries for AWS Cloud Support meetings:
# Read meeting notes from file
pdm run python source/generate-taiwan-meeting-summarize.py -f meeting.txt
# Save summary
pdm run python source/generate-taiwan-meeting-summarize.py -f meeting.txt -o summary.txt
# Using shell script
./generate-taiwan-meeting-summarize.sh# Translate Traditional Chinese to English
pdm run python source/translate-article-to-english.py "要翻譯的中文文字"
# Translate from file
pdm run python source/translate-article-to-english.py -f chinese.txt -o english.txt
# Using shell script
./translate-article-to-english.sh# Translate English to Traditional Chinese
pdm run python source/translate-article-to-taiwannese.py "Text to translate"
# Translate from file
pdm run python source/translate-article-to-taiwannese.py -f english.txt -o chinese.txt
# Using shell script
./translate-article-to-taiwannese.shGenerate Traditional Chinese summaries:
# Direct text input
pdm run python source/summarize-taiwanese-text-with-bedrock.py "長篇文字內容"
# Read from file
pdm run python source/summarize-taiwanese-text-with-bedrock.py -f article.txt -o summary.txt
# Using shell script
./summarize-taiwanese-text-with-bedrock.shAll scripts support the following options:
--model MODEL_ID # Specify model ID to use
--max-tokens N # Set maximum tokens for response (default: 4096)
--temperature T # Set generation temperature (default: 1.0)
-f, --file FILE # Read input from file
-o, --output FILE # Save output to fileExample:
pdm run python source/ask-me-anything.py \
--model global.anthropic.claude-sonnet-4-6 \
--max-tokens 2048 \
--temperature 0.7 \
-f input.txt \
-o output.txt.
├── source/
│ ├── base_cli.py # Base CLI framework (shared logic)
│ ├── ask-me-anything.py # Q&A system
│ ├── formal-text-with-bedrock.py # Text formalization
│ ├── generate-taiwan-meeting-summarize.py # Meeting summarization
│ ├── translate-article-to-english.py # Translate to English
│ ├── translate-article-to-taiwannese.py # Translate to Traditional Chinese
│ ├── summarize-taiwanese-text-with-bedrock.py # Traditional Chinese summarization
│ ├── AnthropicBedrock.py # Generic summarization
│ ├── config_manager.py # Configuration management
│ ├── constants.py # Constants definition
│ └── test_cli.py # Test suite
├── *.sh # Shell script wrappers
├── pyproject.toml # PDM project configuration
├── pdm.lock # PDM lock file
└── README.md # This file
pdm run python source/test_cli.pypdm add package-namepdm updateThis project uses PDM for dependency management. All dependencies are defined in pyproject.toml:
boto3- AWS SDK for Pythonanthropic[bedrock]- Anthropic Claude SDK with Bedrock supportargparse- Command-line argument parsing
PDM automatically manages the virtual environment and ensures consistent dependency versions across all environments.
- All scripts use streaming output for real-time response viewing
- Input text must be UTF-8 encoded
- Ensure AWS credentials have sufficient permissions to access Bedrock services
- Using Bedrock services incurs costs - monitor your usage
Scripts include comprehensive error handling:
- File existence checks
- UTF-8 encoding validation
- Empty input validation
- Model ID validation
- API error handling
Please refer to the project license documentation.
Issues and Pull Requests are welcome.