Question 1mediummultiple choice
Read the full NAT/PAT explanation →AIF-C01 Applications of Foundation Models • Complete Question Bank
Complete AIF-C01 Applications of Foundation Models 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",
"NotResource": "arn:aws:bedrock:us-east-1:123456789012:model/anthropic.claude-v2"
}
]
}
```Refer to the exhibit.
error: text generation failed with status code 400
{
"error": {
"message": "The model 'ai21.j2-mid-v1' does not support the 'maxTokens' parameter. Use 'maxTokens' with supported models or remove it.",
"type": "invalid_request_error"
}
}{
"EndpointConfigName": "my-fm-endpoint-config",
"ProductionVariants": [
{
"VariantName": "variant1",
"ModelName": "my-fm-model",
"InitialInstanceCount": 1,
"InstanceType": "ml.g5.xlarge",
"InitialVariantWeight": 1.0
}
]
}Resources:
BedrockAgent:
Type: AWS::Bedrock::Agent
Properties:
AgentName: MyAgent
FoundationModel: anthropic.claude-v2
Instruction: "You are a helpful assistant."
KnowledgeBases:
- KnowledgeBaseId: !Ref MyKnowledgeBase
PromptOverrideConfiguration: null
MyKnowledgeBase:
Type: AWS::Bedrock::KnowledgeBase
Properties:
Name: MyKB
RoleArn: !GetAtt KBRole.Arn
KnowledgeBaseConfiguration:
Type: VECTOR
VectorKnowledgeBaseConfiguration:
EmbeddingModelArn: !Sub arn:aws:bedrock:${AWS::Region}::foundation-model/amazon.titan-embed-text-v1
StorageConfiguration:
Type: OPENSEARCH_SERVERLESS
OpensearchServerlessConfiguration:
CollectionArn: !GetAtt MyCollection.Arn
VectorIndexName: my-index
MyCollection:
Type: AWS::OpenSearchServerless::Collection
Properties:
Name: my-collection
Type: VECTORSEARCHRefer to the exhibit.
$ aws bedrock-runtime invoke-model \
--model-id "amazon.titan-text-express-v1" \
--body '{"inputText": "What is AWS?"}' \
--cli-binary-format raw-in-base64-out \
response.json
An error occurred (ModelNotReadyException) when calling the InvokeModel operation: Model is not ready for inference.Refer to the exhibit.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "bedrock:InvokeModel",
"Resource": "arn:aws:bedrock:us-east-1:123456789012:model/amazon.titan-text-express-v1"
}
]
}Refer to the exhibit.
{
"outputText": "Artificial intelligence is...",
"stopReason": "stop_sequence"
}Refer to the exhibit.
```json
{
"output": {
"message": {
"content": [
{
"text": "The answer is 42"
}
],
"role": "assistant"
}
},
"stop_reason": "end_turn"
}
```Refer to the exhibit. ``` 2024-03-15T10:00:00Z [ERROR] Model invocation failed: AccessDeniedException: User: arn:aws:iam::123456789012:role/BedrockRole is not authorized to perform: bedrock:InvokeModel on resource: arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-v2 ```
Refer to the exhibit.
```json
{
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 500,
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}
```Refer to the exhibit.
{
"modelId": "anthropic.claude-v2",
"contentType": "application/json",
"accept": "application/json",
"body": {
"prompt": "Human: Summarize the following text in 50 words. Text: AWS is a cloud platform. Response:",
"max_tokens_to_sample": 200,
"temperature": 1.0,
"stop_sequences": ["\n\nHuman:"]
}
}Refer to the exhibit.
SageMaker Training Job Configuration:
{
"AlgorithmSpecification": {
"TrainingImage": "763104351884.dkr.ecr.us-west-2.amazonaws.com/huggingface-pytorch-training:1.13.1-transformers4.26.0-gpu-py39-cu117-ubuntu20.04",
"TrainingInputMode": "File"
},
"HyperParameters": {
"epochs": "3",
"per_device_train_batch_size": "8",
"learning_rate": "2e-5",
"max_seq_length": "512"
},
"InputDataConfig": [
{
"ChannelName": "train",
"DataSource": {
"S3DataSource": {
"S3DataType": "S3Prefix",
"S3Uri": "s3://my-bucket/train/"
}
},
"ContentType": "text/csv"
}
],
"OutputDataConfig": {
"S3OutputPath": "s3://my-bucket/output/"
},
"ResourceConfig": {
"InstanceType": "ml.p3.2xlarge",
"InstanceCount": 1,
"VolumeSizeInGB": 50
},
"RoleArn": "arn:aws:iam::123456789012:role/SageMakerRole",
"StoppingCondition": {
"MaxRuntimeInSeconds": 86400
}
}Refer to the exhibit.
CloudWatch Log message:
{
"timestamp": "2025-02-12T10:15:30.000Z",
"message": "ThrottlingException: Rate exceeded for modelId anthropic.claude-v2. RequestId: abc123",
"logGroup": "/aws/bedrock/modelinvocations",
"logStream": "modelinvocations/us-west-2/123456789012"
}Refer to the exhibit.
{
"completion": "The capital of France is Paris. The capital of Germany is Berlin. The capital of",
"stop_reason": "max_tokens",
"usage": {
"input_tokens": 10,
"output_tokens": 30
}
}Refer to the exhibit.
{
"message": "You do not have access to the requested model. Please request access via the AWS Management Console."
}A developer is trying to invoke the Claude v2 model in Amazon Bedrock from a Lambda function. The Lambda function's IAM role has the following policy attached:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "bedrock:InvokeModel",
"Resource": "*"
}
]
}When the Lambda function runs, it receives the error shown in the exhibit. Which additional step is most likely needed to resolve this issue?
Refer to the exhibit.
{
"error": {
"message": "Access denied. Please ensure you have the correct permissions to access the requested model.",
"type": "AccessDeniedException"
}
}
(This error is returned when calling the InvokeModel API in Amazon Bedrock with model ID 'anthropic.claude-v2'.)