ferruzzi commented on code in PR #48468: URL: https://github.com/apache/airflow/pull/48468#discussion_r2019048150
########## providers/amazon/tests/system/amazon/aws/example_bedrock_batch_inference.py: ########## @@ -0,0 +1,184 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +import json +import logging +from datetime import datetime +from tempfile import NamedTemporaryFile + +from airflow.decorators import task +from airflow.models.baseoperator import chain +from airflow.models.dag import DAG +from airflow.providers.amazon.aws.hooks.bedrock import BedrockHook +from airflow.providers.amazon.aws.hooks.s3 import S3Hook +from airflow.providers.amazon.aws.operators.bedrock import ( + BedrockBatchInferenceOperator, + BedrockInvokeModelOperator, +) +from airflow.providers.amazon.aws.operators.s3 import ( + S3CreateBucketOperator, + S3DeleteBucketOperator, +) +from airflow.providers.amazon.aws.sensors.bedrock import ( + BedrockBatchInferenceScheduledSensor, +) +from airflow.utils.trigger_rule import TriggerRule + +from system.amazon.aws.utils import SystemTestContextBuilder + +log = logging.getLogger(__name__) + + +# Externally fetched variables: +ROLE_ARN_KEY = "ROLE_ARN" +sys_test_context_task = SystemTestContextBuilder().add_variable(ROLE_ARN_KEY).build() + +DAG_ID = "example_bedrock_batch_inference" + +####################################################################### +# NOTE: +# Access to the following foundation model must be requested via +# the Amazon Bedrock console and may take up to 24 hours to apply: +####################################################################### + +CLAUDE_MODEL_ID = "anthropic.claude-3-sonnet-20240229-v1:0" +ANTHROPIC_VERSION = "bedrock-2023-05-31" + +# Batch inferences currently require a minimum of 100 prompts per batch. +MIN_NUM_PROMPTS = 300 Review Comment: 🤷♀️ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org