Generative AI - creating coding suggestions in Python
As a data scientist, data analyst, developer, consultant or student you may have work or passion projects you would like to build quickly - let me introduce you to your new AI coding companion Amazon CodeWhisperer.
Let's increase your developer productivity, help you get started with generative AI, spend less time debugging code and tick the box where it is user-friendly and ready for organizations to use in a secure environment.
Learning Objectives
In this lesson you will learn the following:
- What is Amazon CodeWhisperer?
- What are the benefits?
- What are the common use cases?
- How do I install Amazon CodeWhisperer for work?
- How do I install Amazon CodeWhisperer for personal use?
What is Amazon CodeWhisperer?
Amazon CodeWhisperer is a machine learning-powered coding companion that suggests coding recommendations as you type comments in real-time using natural language processing to help you code faster.
VP of Databases, Analytics and ML, Dr Swami Sivasubramanian announced the general availability of Amazon CodeWhisperer last month on 13 April 2023.
The architecture of Amazon CodeWhisperer is based on large language models (LLMs) trained on billions of lines of code
What are the benefits?
Free to use for individual developers
Available in all AWS regions
Provides 50 security scans per user per month for individual use and 500 scans per user per month under professional tier
Provides data protection, is provided by the AWS Shared Responsibility model
Provides coding suggestions for many languages such as Ruby, Go, PHP, C++, C, Shell, Scala, Rust, Kotlin, SQL. The languages with the most support are Java, Python, JavaScript, TypeScript and C#.
What are the common use cases?
To help increase developer productivity, some use cases may include:
Providing a secure AI powered coding companion that will provide coding suggestions
Help to write less code for a nested SQL query
Help to write a repeatable function in Python
Management Consultants need to spend less time coding and more customer-facing time with their customer. Accenture is a case study for early adoption.
Pre-requisites
AWS recommends and provides some important tips here:
- Disable any existing VS code extensions
- Install the latest version of VS Code
- Install the latest version of AWS Toolkit
In the image below, I have to disable other VS code extensions and update to the latest version of AWS Toolkit.
Click Connect to AWS and select click here.
Tutorial 1: Install Amazon CodeWhisperer for individual use with IDE VS Code for Python
You may locate the instructions for installing Amazon CodeWhisperer here
Step 1: To get started you will have to create a builder ID which is your personal profile for authentication as an individual user. You do not need to have an existing AWS account.
Whether you are a data scientist, data analyst, student or just working on other personal projects you will need to have a Builder ID before you can use Amazon CodeWhisperer.
Step 2: Use a personal email address to sign up or sign-in with an AWS Builder ID
Step 3: Copy the code and proceed to the login.
Step 4: Enter your email address and full name.
Click allow access of AWS Toolkit to VS Code.
Step 5: You will receive verification that your email address was verified. Create a password and confirm your password.
Step 6: Enter the verification code that was emailed to your personal email address.
Step 7: You will receive information that you have been granted access and the authentication process was successful.
Step 8: Connect to AWS and sign-in with your AWS Builder ID.
Step 9: Once your AWS Builder ID is connected in AWS Toolkit for VS Code, open the side-bar menu to Code Whisperer.
Step 10: Click Start on the bottom right-handside corner.
Step 11: Go to File, New File and select Python.
You may start typing a few words in Python e.g. import pandas
You may accept the code suggestion by clicking tab on your keyboard.
Step 12: Import Python libraries
Step 13: Import Sklearn datasets
Step 14: Import the library that includes the functions to perform PCA
You may also watch this screencast 'Getting started with Amazon CodeWhisperer with VS Code' by Amazon Web Services
How would I use Amazon CodeWhisperer in my organization?
You will need to contact your IT Help Desk to request that an administrator download and install VS Code and then follow the steps here to create credentials for your IAM role from the IAM Identity Center (formerly called single sign-on access) for Amazon CodeWhisperer with your organization.
The pricing for Amazon CodeWhisperer at the professional tier is located here and billing is charged to your organization AWS account.
Conclusion
Amazon CodeWhisperer is easy to use and takes about 20 minutes to set up in AWS Toolkit with VS Code IDE for individual use for data science or data analysis using Python. Security scans are enabled to monitor code written by you or that is generated by Amazon Code Whisperer. An AWS Builder ID is your personal profile for authenticating a user with a valid email address.
References
This Month - AWS She Builds Global Mentorship application closing 31 May
AWS She Builds Application
Apply to participate in the free AWS She Builds Mentorship Program - APJ, EMEA or US. Learn cloud computing ☁️
If you aspire to be a women in tech or interested in learning more about cloud computing, you have until 31 May 2023 to submit your application. Early bird gets the worm! You may apply at this link
Next Month - AWS re:Inforce 2023 on June 13-14
Are you ready for AWS re:Inforce this year? Join the AWS Community in-person to experience two days of learning, networking with your peers as you further your learning in security, innovation and the latest announcements from the keynotes.
I hope you will be able to join AWS CISO CJ Moses for his keynote, the AWS Security community next month and register at this link. There are leadership sessions, partner sessions and expert sessions at the 300 and 400 levels which are focused-learning and interactive sessions.
You may watch the keynote from AWS re:Inforce 2022 and also follow the hashtag #AWSreInforce on Twitter
Until the next lesson, happy learning! 😀
Hello World: Meet Large Language Models
Top comments (0)