AIF-C01 Fundamentals of Generative AI • Complete Question Bank
Complete AIF-C01 Fundamentals of Generative AI question bank — all 0 questions with answers and detailed explanations.
Refer to the exhibit.
```
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "bedrock:InvokeModel",
"Resource": "arn:aws:bedrock:us-east-1:123456789012:model/anthropic.claude-v2"
},
{
"Effect": "Deny",
"Action": "bedrock:InvokeModel",
"Resource": "arn:aws:bedrock:us-east-1:123456789012:model/anthropic.claude-v2",
"Condition": {
"StringNotEquals": {
"aws:RequestedRegion": "us-east-1"
}
}
}
]
}
```Refer to the exhibit.
```
{
"modelId": "amazon.titan-text-lite-v1",
"contentType": "application/json",
"accept": "application/json",
"body": {
"inputText": "Summarize the following meeting notes: ...",
"textGenerationConfig": {
"maxTokenCount": 100,
"stopSequences": [],
"temperature": 0,
"topP": 0.9
}
}
}
```Refer to the exhibit.
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "bedrock:InvokeModel",
"Resource": "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-v2"
}
]
}
```Refer to the exhibit.
```yaml
Resources:
MyGuardrail:
Type: AWS::Bedrock::Guardrail
Properties:
Name: my-guardrail
TopicPolicy:
Topics:
- Name: sensitive-topic
Definition: "Do not discuss sensitive topics."
Type: DENY
ContentPolicy:
Filters:
- Type: SEXUAL
InputStrength: HIGH
OutputStrength: HIGH
```aws bedrock-runtime invoke-model \
--model-id anthropic.claude-v2 \
--body '{"prompt":"\n\nHuman: Summarize the following text: ...\n\nAssistant:","max_tokens_to_sample":200}' \
--cli-binary-format raw-in-base64-out \
--region us-east-1 \
output.json
The output.json file contains:
{"completion": " The summary is...", "stop_reason": "stop_sequence"}AWS CloudFormation template snippet:
Resources:
BedrockKnowledgeBase:
Type: AWS::Bedrock::KnowledgeBase
Properties:
Name: support-kb
RoleArn: arn:aws:iam::123456789012:role/BedrockKnowledgeBaseRole
KnowledgeBaseConfiguration:
Type: VECTOR
VectorKnowledgeBaseConfiguration:
EmbeddingModelArn: arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-embed-text-v1
StorageConfiguration:
Type: OPENSEARCH_SERVERLESS
OpensearchServerlessConfiguration:
CollectionArn: arn:aws:aoss:us-east-1:123456789012:collection/abc123
FieldMapping:
MetadataField: metadata
TextField: text
DataSource:
Type: AWS::Bedrock::DataSource
Properties:
KnowledgeBaseId: !Ref BedrockKnowledgeBase
Name: s3-source
DataSourceConfiguration:
Type: S3
S3Configuration:
BucketArn: arn:aws:s3:::my-docs-bucket
VectorIngestionConfiguration:
ChunkingConfiguration:
ChunkingStrategy: FIXED_SIZEError log from Amazon Bedrock:
{
"error": "AccessDeniedException",
"message": "User: arn:aws:iam::123456789012:role/MyAppRole is not authorized to perform: bedrock:InvokeModel on resource: arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-instant-v1"
}Refer to the exhibit.
Exhibit:
```
{
"outputText": "The quick brown fox...",
"stopReason": "max_tokens"
}
```Refer to the exhibit.
Exhibit:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "bedrock:InvokeModel",
"Resource": "arn:aws:bedrock:us-east-1:123456789012:model/anthropic.claude-v2",
"Condition": {
"IpAddress": {"aws:SourceIp": "10.0.0.0/8"}
}
}
]
}
```Refer to the exhibit.
Exhibit:
```json
"KnowledgeBaseConfiguration": {
"type": "SEMANTIC",
"vectorKnowledgeBaseConfiguration": {
"embeddingModelArn": "arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-embed-text-v1"
}
}
```{
"eventTime": "2024-03-15T12:00:00Z",
"eventSource": "bedrock.amazonaws.com",
"eventName": "InvokeModel",
"requestParameters": {
"modelId": "anthropic.claude-v2",
"body": "{\"prompt\":\"Human: ...\",\"max_tokens\":500}",
"inferenceType": "PROVISIONED"
},
"responseElements": {},
"errorCode": "ThrottlingException",
"errorMessage": "Rate exceeded"
}A SageMaker notebook cell output: "Model size: 7B parameters\nInference time on ml.g5.2xlarge: 250ms per token\nBatch size: 1\nMemory utilization: 90%"
A company is building a generative AI application to personalize email marketing campaigns. They use Amazon Bedrock with Anthropic Claude 3 Sonnet. The system takes customer data (name, purchase history) from an Amazon DynamoDB table and generates a personalized email body. During testing, the team notices that some emails contain factually incorrect information, such as recommending products the customer never purchased. The DynamoDB table is queried correctly and the correct data is passed to the model. The prompts include the customer data as context. The team has already tried adjusting the temperature and top-p parameters, but the issue persists.
They need to improve the factual accuracy of the generated emails without significantly increasing latency or cost. The application is currently deployed on a single AWS Lambda function that invokes Bedrock. The DynamoDB table is small (few thousand records).
Which course of action should the team take?
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "bedrock:InvokeModel",
"Resource": "arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-text-lite-v1"
}
]
}