News / Developers

Einstein GPT for Developers Now Available

By Andrew Cook

We first saw a glimpse of what was then called Apex GPT back at Trailblazer DX, showing how developers can make use of natural language processing to enhance their code-writing capabilities. Starting this week, this exciting feature is now in open beta.

Einstein for Developers empowers developers and IT teams to increase the pace of software development and enhance developer productivity. It simplifies the start of development by creating smart Apex based on natural language prompts. With Einstein for Developers, developers can accelerate coding tasks by scanning for code vulnerabilities and getting real-time code suggestions within the Salesforce integrated development environment.

What is Einstein for Developers?

Einstein for Developers is a generative AI coding tool built exclusively for Salesforce-specific coding languages. Built using CodeGen, Salesforce’s open-source Large Language Model (LLM), it turns simple English prompts into executable code. You don’t write any code yourself; instead, you describe what the code should do, in natural language – and the machine writes it for you.

Unlike other AI Coding Tools, Einstein for Developers is built right into the Salesforce Platform. This means that it has access to your org’s metadata and will make recommendations based on your existing code, perfect for if you write your classes and triggers in a certain way. It also makes use of the AI Trust Layer, ensuring your code stays safe and secure.

Enabling your Org

Einstein for Developers is incredibly easy to enable. This can be done by going into setup and searching “Einstein for Developers” in the search bar. Now just hit the enable button!

Getting Started

Once your org is enabled, you can set up the Einstein for Developers extension in your VS Code Desktop by using a shared VSIX file. Additionally, Einstein will soon be accessible within Code Builder, the web-based integrated development environment (IDE), which is anticipated to be widely available in October. 

To utilize the Einstein for Developers tool effectively:

  1. Open your VS Code, go to File → Open Folder in the menu, and either open an existing Salesforce DX project or set up a new project.
  2. To work with Einstein for Developers, execute the SFDX: Authorize an Org command to connect to a Salesforce sandbox org or scratch org. You will be able to use Einstein for Developers within this environment.

Once this is done, you can start generating Apex code by writing a prompt via the Command Palette command: ‘SFDX: Generate Code with Einstein’. One thing to bear in mind is that you need to be within an Apex file (.cls) for the command to appear (something that had me scratching my head for a good 10 minutes before realizing why the command wasn’t showing).

If you are using scratch orgs, activate Einstein for Developers by enabling the add-on scratch org feature. Simply edit and save the config/project-scratch-def.json file in your DX project and add the EinsteinGPTForDevelopers feature to your existing feature list.

Examples

The first thing I tried was to create an Apex class that retrieves the number of contact records associated to an account. I specified this in my prompt and was giving a fully working Apex Class:

Next, I wanted a test class for the Apex Class that was created. Again, I specified this in my prompt and was given the following:

Obviously, as this is still in beta the code will not be 100% right all of the time. But my first impressions of Einstein for Developers are nothing but positive!

Summary

As Einstein for Developers continues to grow – with added support for LWC, enhanced intelligent code completion, and interactive assistance – you’ll have the opportunity to accelerate your development on the Salesforce Platform like never before. Don’t miss the chance to try out the beta version here.

The Author

Andrew Cook

Andrew is a Salesforce Technical Instructor at Salesforce Ben. He is 14x certified and has worked in the ecosystem for 12 years.

Leave a Reply