AWS News Blog
New Customization Capability in Amazon CodeWhisperer Generates Even Better Suggestions (Preview)
|
An AI coding companion, such as Amazon CodeWhisperer, aims to improve developers’ productivity by helping them write code quickly and securely. However, in particular cases, developers need to have code recommendations based on their internal libraries and APIs they extensively use every day.
As most of the existing AI coding companion tools are trained only on open-source code, they lack the capability to customize the code recommendations using private code repositories. This limitation presents a variety of challenges for developers. Developers have a difficulty learning how to use internal libraries correctly and avoid security problems. For large codebases, it requires hours of reading documentation to understand what code needs to be written to complete the task.
Now in Preview — Amazon CodeWhisperer Customization Capability
Today, I’m excited to announce Amazon CodeWhisperer customization capability (in preview) that enables organizations to customize CodeWhisperer to generate specific code recommendations from private code repositories. With this feature, developers who are part of Amazon CodeWhisperer Professional tier can now receive real-time code recommendations that include their internal libraries, APIs, packages, classes, and methods.
Let’s say that you’re a developer working for a hypothetical food delivery company called AnyCompany. You’re given a task to process a list of unassigned food deliveries around the driver’s current location. Previously, with CodeWhisperer, it would not know the correct internal APIs to process unassigned food deliveries or getting driver’s current location as this isn’t publicly available information.
Now, with customization capability, you can ask CodeWhisperer to provide recommendations that include specific code related to the company’s internal services. The following screenshot shows how CodeWhisperer generates code based on the internal codebase just by writing a set of comments.
With the customization capability of utilizing your internal codebase, CodeWhisperer now understands the intent, determines which internal and public APIs are best suited to the task, and generates code recommendations.
How It Works
The explanation above described how you can use CodeWhisperer customization capability as a developer. Now, let me share how it works and how you can get started.
To create a customization, you need to complete the following steps as a CodeWhisperer administrator.
- Administer your end users as CodeWhisperer administrator.
- Connect to existing repositories. You can connect one or more code repositories in your GitHub, GitLab, or BitBucket account using AWS CodeStar Connections or manually upload all of your code into an Amazon Simple Storage Service (Amazon S3) bucket.
- Create a customization. CodeWhisperer will customize its model based on your codebase.
- Activate the customization for your team members. Once the customization is created, you can review and manually activate the customization to make it available automatically in your team members’ IDEs.
This capability provides two main advantages: providing real-time customized code recommendations that are specific to organizations and ensuring the protection of valuable intellectual property. Organizations can now promote the use of code that meets their quality and security standards based on their code in existing repositories.
Furthermore, CodeWhisperer helps to ensure the security of your code by providing the option to encrypt your customization data using customer managed keys in AWS Key Management Service (AWS KMS). This customization data will be deleted once the customization job finishes.
Let’s Get Started
Let me show you how you can use the Amazon CodeWhisperer customization capability.
To get started, I need to create a customization. I need to have administrator access to navigate to the Create customization page on the Amazon CodeWhisperer dashboard.
On the Create customization page, I can connect the desired private code repositories I want CodeWhisperer to customize. Currently, CodeWhisperer customization capability supports connection to GitHub, GitLab, and Bitbucket via AWS CodeStar Connections. If I have code that is not in any code repositories, I can also manually upload my code into an S3 bucket and define the Amazon S3 URI.
The following screenshot shows that I have existing connections with my code repositories using AWS CodeStar Connections. I can also create a new connection by selecting Create new connection.
Then, I can select Create Customization so CodeWhisperer can start customizing the model based on the code available in the connection. The duration to complete this process depends on the size of the code repositories.
When the customization is ready, CodeWhisperer will not activate it automatically. This gives me the flexibility to activate the customizations just when I need them. But before I demonstrate that, I’d like to explain the evaluation score.
In short, the evaluation score helps me to measure the customization’s accuracy in predicting and providing code recommendations based on the code in my code repositories. It provides a score in one of three categories: 1) Very Good, with a score ranging from 7–10; 2) Fair, with a score ranging from 4–7; and 3) Poor, with a score ranging from 0–4. It’s recommended to activate the customization if the evaluation score is 6 or higher. If the evaluation score is less than desired, I need to make sure that I’m providing enough code for customization and provide a new code dataset that extensively contains references to internal APIs.
Here, I can see the Evaluation score for my customization is 8, and I’m happy with this result. Then, I can select Activate to start using this customization.
Once I have activated the customizations, I can define the access to selected customizations by selecting Add users. Now, I can give access to the customizations for selected team members who have been added as users for Amazon CodeWhisperer Professional tier. To do that, I can follow the guide from the Administering end users page.
Then, once my team members sign in via AWS Toolkit in their IDEs, they will see the available customizations and can start using them.
With Amazon CodeWhisperer, I can create multiple customizations by providing different code repositories. This feature is useful if I want to build customizations for code recommendations for certain teams.
As administrator, I can also monitor the performance of each of the customizations by navigating to the CodeWhisperer dashboard page. This page summarizes useful data such as user activity, how many lines of code were suggested by CodeWhisperer and accepted by my team members, and how many security scans have successfully been run from IDEs.
Currently, you can customize CodeWhisperer recommendations on codebases written in Java, JavaScript, TypeScript, and Python. Files written in other languages supported by CodeWhisperer (C#, Go, Rust, PHP, Ruby, Kotlin, C, C++, Shell scripting, SQL and Scala) will not be used when creating the customization, or when providing customized recommendations in the IDE based on your internal code repositories.
Join the Public Preview
By securely leveraging customer’s internal codebase, Amazon CodeWhisperer unlocks the full potential of generative AI-powered coding that is customized to your unique requirements.
Join the public preview now and learn more on how to get started on the Amazon CodeWhisperer Customization page.
Happy coding!
— Donnie