Bard now helps you code
Since we launched Bard, our experiment that lets you collaborate with generative AI, coding has been one of the top requests we’ve received from our users. As a product lead in Google Research — and a passionate engineer who still programs every day — I’m excited that today we’re updating Bard to include that capability.
Bard can now generate code for you, and you can easily export Python code to Google Colab.
In addition to generating code, Bard can help explain code snippets for you. This is particularly helpful if you’re learning about programming for the first time, or if you need some additional support to understand what a block of code might output.
Ask Bard to explain code. For example, "Tell me about the code within the google/jax GitHub repo."
Bard can also help you debug code, even code that Bard wrote. If Bard gives you an error message or code that doesn't do what you intended, just tell Bard “this code didn’t work, please fix it,” and Bard can help you debug.
Bard helps debug error messages.
Bard is still an early experiment, and may sometimes provide inaccurate, misleading or false information while presenting it confidently. When it comes to coding, Bard may give you working code that doesn’t produce the expected output, or provide you with code that is not optimal or incomplete. Always double-check Bard’s responses and carefully test and review code for errors, bugs and vulnerabilities before relying on it. Despite these challenges, we believe Bard’s new capabilities can help you by offering new ways to write code, create test cases, or update APIs. If Bard quotes at length from an existing open source project, it will cite the source.
In many cases, Bard can also help optimize your code by making it faster or more efficient. Just respond to Bard’s initial output with “Could you please make that code faster?” or “Find error handling clauses you might have missed.”
Bard is already helping people with everyday tasks, from crafting presentations and writing lesson plans to inventing new recipes or planning a workout routine. With new coding capabilities, we’re excited to apply generative AI to accelerate software development, inspire innovation, and help people solve complex engineering challenges.
For the latest Bard updates, visit our Experiment updates page. We’re excited to see what you build!