🔥

Amazon CodeWhispererとGitHub Copilot

2023/04/14に公開

Amazon CodeWhispererがリリースされたぞ

CodeWhispererはGitHub CopilotのAWS版という認識。
https://aws.amazon.com/jp/blogs/machine-learning/announcing-new-tools-for-building-with-generative-ai-on-aws/

導入方法

https://aws.amazon.com/jp/codewhisperer/resources/#Getting_started
動画があるので、こちらを見て貰えばわかるよ。
Vistual Studio CodeからAWS Builderへの画面遷移する時にはコードがポップアップされるので、それを遷移先の画面で入力してね

Amazon CodeWhispererで試す

日本語で入力

やりたい事をコメントで入力し、関数作成のdefと入力

# S3バケットを作成する
def

↓ 以下が提案されます。

# S3バケットを作成する
import boto3
def create_bucket(bucket_name):
    s3 = boto3.resource('s3')
    bucket = s3.create_bucket(Bucket=bucket_name)
    return bucket

英語で入力

やりたい事をコメントで入力し、関数作成のdefと入力

# Create S3 bucket
def

↓ 以下が提案されます。

# Create S3 bucket
import boto3
def create_bucket(bucket_name, region=None):
    try:
        if region is None:
            s3_client = boto3.client('s3')

ちょっと出る内容が違うね。

GitHub Copilotで試す

日本語で入力

やりたい事をコメントで入力し、関数作成のdefと入力

# S3バケットを作成する
def

↓ 以下が提案されます。

# S3バケットを作成する
def lambda_handler(event, context):
    s3 = boto3.resource('s3')
    s3.create_bucket(Bucket='my-bucket')

英語で入力

やりたい事をコメントで入力し、関数作成のdefと入力

# S3バケットを作成する
def

↓ 以下が提案されます。

# Create S3 bucket
def create_bucket(bucket_name):
    s3 = boto3.resource('s3')
    bucket = s3.create_bucket(Bucket=bucket_name)
    return bucket

ちょっと出る内容が違うね。

所管

Amazon CodeWhispererとGitHub Copilotで簡単な提案をしてもらいました。

所管としてはCodeWhispererが少しもっさりしており(リージョンがバージニアしかないため?)、提案されるまでに時間が掛かります。「S3バケット作成文ってどう書くんだっけ?」とか調べるよりは早いですが、分かっているで勢いよく書く時は提案が間に合わない。

一方でGitHub Copilotはもっさり感はなくてスピーディーでした。

ともに偶々遅い・早いっていうのはあるかもですが、、、
Amazon CodeWhispererはセキュリティスキャンも出来るので担当者にローカルで確認してもらう流れが出来るのは良いなぁと感じました。

Discussion