BaşlayınÜcretsiz Başlayın

Creating age-appropriate content filters

Expanding your work with the healthcare platform, they're developing content for different age groups in their family wellness program. When creating content for the different age groups, they need to ensure their AI responses are appropriate. You'll create a function that checks Claude's responses based on the target audience's age.

The json and boto3 libraries are preloaded, as well as the moderate_content() function defined in the previous exercise.

Bu egzersiz

Introduction to Amazon Bedrock

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Insert the "high" level of moderation to get the appropriate content check for the children's prompt.
  • Repeat for adults and teens, with gradually lower levels of moderations, and check the output.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

bedrock = boto3.client('bedrock-runtime', region_name='us-east-1')

prompt = "I have a bad headache: how much ibuprofen can I take, and how often?"

# Use a high level of moderation
print(f"Response for children: {moderate_content(____, '____')}")

# Repeat with medium and low
print(f"Response for teens: {moderate_content(prompt, '____')}")
print(f"Response for adults: {moderate_content(prompt, '____')}")
Kodu Düzenle ve Çalıştır