UPDATED 11:10 EST / APRIL 21 2023

AI

Google Bard AI chatbot can now generate and debug code

Google LLC updated its Bard artificial intelligence chatbot’s capabilities today so that it can now assist with developing software, including code generation, debugging and explaining what code snippets do.

The chatbot’s rivals, OpenAI LP’s ChatGPT and Microsoft Corp.’s Bing AI already support code generation. Paige Bailey, group product manager at Google Research, said that the feature has been “one of the top requests” for the chatbot since its early access release a few months ago, in a blog post about the announcement.

“We’re launching these capabilities in more than 20 programming languages including C++, Go, Java, Javascript, Python and Typescript,” said Bailey.

Users need only explain what kind of code they want generated to the bot including the language and parameters and the bot will generate a code snippet. It can also export Python code directly into Colab, Google’s cloud-based tool for coding machine learning and data science models using the Chrome browser. The chatbot can also help users write functions for Google Sheets.

“In addition to generating code, Bard can help explain code snippets for you,” Bailey said. “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.”

Users can feed the chatbot their own snippet of code for it to examine and explain or they can give it a link to a GitHub repository. It will then scan the code and give a detailed explanation of what happens, including a breakdown of its various functions and capabilities. That would be particularly useful for understanding each of the elements of a library or lengthy code that doesn’t have good documentation.

The chatbot can also help with debugging code by sifting through it to discover errors or vulnerabilities, Bailey explained, “even code that Bard wrote.” Users can ask Bard to help debug any code that it’s given just by asking it to “fix it.”

In fact, Bailey warns users that Bard itself is still experimental and “may sometimes provide inaccurate, misleading or false information while presenting it confidently.” This is a real issue with all generative AI models that can create software code. As a result, Bard might produce working code that won’t produce expected outputs or even generate incomplete code.

AI chatbots are well known for being “confidently wrong” when generating content due to what are called “hallucinations.” Google Bard itself made a factual error during its press debut in February.

“Always double-check Bard’s responses and carefully test and review code for errors, bugs and vulnerabilities before relying on it,” said Bailey.

Since Bard’s training set includes code from all over the internet, including open-source repositories, if the bot quotes at length from an open-source project, it will cite the source. That way the user will be able to track down the original source of the code and get ahead of any licenses that might be involved.

Photo: Pixabay

A message from John Furrier, co-founder of SiliconANGLE:

Your vote of support is important to us and it helps us keep the content FREE.

One click below supports our mission to provide free, deep, and relevant content.  

Join our community on YouTube

Join the community that includes more than 15,000 #CubeAlumni experts, including Amazon.com CEO Andy Jassy, Dell Technologies founder and CEO Michael Dell, Intel CEO Pat Gelsinger, and many more luminaries and experts.

“TheCUBE is an important partner to the industry. You guys really are a part of our events and we really appreciate you coming and I know people appreciate the content you create as well” – Andy Jassy

THANK YOU