Bard AI now capable of code generation, translation: How can developers benefit?
Google’s chatbot is now fluent in more than 20 programming languages
![Bard: A low-down shot of an illuminated pale blue Google logo, hanging from the ceiling in a pitch black room](https://cdn.mos.cms.futurecdn.net/aVfddWpFYvfwifZqwfQ3b6-320-80.jpg)
Google has announced that Bard, its conversational AI chatbot, can now generate and rewrite code based on natural language prompts.
Bard is now capable of generating code in more than 20 programming languages and can translate code from one language to another through an update that could make the chatbot far more useful to developers and students.
The tool is fluent in popular languages including Python, Java, C++, Go, Swift, HTML, and Fortran, and even the notoriously difficult Malbolge.
Users can ask Bard to redraft code to make it as efficient as possible, or submit extracts for review and detailed explanation.
“We are seeing high interest in AI-assisted code generation, code analysis, and code search capabilities with enterprise developers.
Arun Chandrasekaran, Gartner
If a user has generated Python code through Bard, it can be exported to their Google Drive in one click for use in Colab, Google’s in-browser service for writing and executing Python code.
In addition to its new programming capabilities, Google has added the ability for Bard to create functions for use in Google Sheets.
This could prove especially useful for data entry and statistical analysis, particularly if wielded by a finance or sales worker with a strong grip on the data but little experience with coding.
Get the ITPro. daily newsletter
Receive our latest news, industry updates, featured resources and more. Sign up today to receive our FREE report on AI cyber crime & security - newly updated for 2024.
In December, Google brought no-code machine learning (ML) to Google Sheets through the SimpleML add-on. In combination with this, Bard’s function generation may be best used as a powerful addition to existing productivity apps.
“Code generation and code analysis are highly sought-after capabilities for Bard users,” said Arun Chandrasekaran, distinguished VP and analyst at Gartner, to ITPro.
“We are seeing high interest in AI-assisted code generation, code analysis, and code search capabilities with enterprise developers.
“I view Bard’s capabilities as an evolution and it is too early to pronounce if this will be a differentiator for Google. Moreover, this offering is still mostly aimed at individual developers rather than enterprise developers, where integration with IDE engines, security controls, and code privacy governance capabilities are all deemed important.”
Comparing AI code generation
Bard is the latest AI tool to become capable of code generation. Microsoft’s AI pair programmer GitHub Copilot was made generally available in June 2022, offering developers automatic code suggestions and software evaluation.
The tool has proved hugely popular, with GitHub having recently revealed that Copilot is used by more than 5,000 businesses and is being used by developers to generate 46% of their code across all languages.
The Total Economic Impact™ of Juniper Networks wired and wireless access drive by Mist AI
In March GitHub launched Copilot X, an updated offering powered by GPT-4 that added extra features to the tool so developers can ask for detailed code breakdowns through natural language prompts.
Bola Rotibi, chief of enterprise research at CCS Insight, told ITPro that the update was a good move by Google that has put it on a more competitive front with other firms.
“The ability to support multiple languages and to really engage through natural language-based conversation will help developers of all abilities to get a better understanding of the code they and others write within the different languages supported,” she said.
“It is a move that is in line with the continued developments made by Microsoft within its Copilot range of solutions and in particular the strengthened capabilities of GitHub Copilot X which homes in on the pair programming value that generative AI brings to the field.
“With AWS also demonstrating its prowess in this field with its Amazon CodeWhisperer, you start to see the competitive front line for generative AI in the software development market take shape.”
Code generation has also been a much-used feature of ChatGPT since its launch, with OpenAI’s powerful Codex model allowing for code generation, translation, and explanation.
Since its release in February, Bard has been unable to generate code on demand. However, in early ITPro tests, Bard proved capable of producing short Python snippets
Unlike ChatGPT, Bard provides citations for code that it generates if it draws on specific repositories or code under an open source license.
This is a feature that is also present in Bing’s GPT-4-powered chatbot, in line with the search engine functionality of both services.
Stating where information was sourced from, instead of using it purely to train or inform models, could prevent Google and Microsoft from issues surrounding data scraping.
StackOverflow has stated that AI firms using public data, such as the mass of coding answers available on its forums, should in turn give this back to the public.
“It might be in the self-interest of each developer to simply turn to the AI for a quick answer, but unless we all continue contributing knowledge back to a shared, public platform, we risk a world in which knowledge is centralized inside the black box of AI models that require users to pay in order to access their services,” wrote Prashanth Chandrasekar, CEO at StackOverflow.
Reddit has also put in new terms of use for its API, requiring those seeking to use Reddit user data for training a machine learning (ML) or AI model will be required to “enter into a separate agreement with Reddit” and pay the company for access.
Google has warned against fully trusting generative AI, and the Bard documentation has encouraged users to follow citations to read original sources wherever possible.
“Bard is still an early experiment, and may sometimes provide inaccurate, misleading, or false information while presenting it confidently,” wrote Paige Bailey, group product manager at Google Research.
“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.”
In ITPro tests, it produced code to suit a number of different tasks, from printing “Hello World” in a number of different languages to Python and Java solutions for bubble sort algorithms and encrypting plaintext using Advanced Encryption Standard (AES).
ITPro had been able to make Bard generate simple Python code snippets prior to the code update. However, the chatbot had been unwilling to acknowledge its ability to generate code.
Sometimes the same content may be found on multiple web pages and Bard attempts to point to a popular source.
Regarding citations to code repositories, the citation may also reference an applicable open-source license.
Rory Bathgate is Features and Multimedia Editor at ITPro, overseeing all in-depth content and case studies. He can also be found co-hosting the ITPro Podcast with Jane McCallion, swapping a keyboard for a microphone to discuss the latest learnings with thought leaders from across the tech sector.
In his free time, Rory enjoys photography, video editing, and good science fiction. After graduating from the University of Kent with a BA in English and American Literature, Rory undertook an MA in Eighteenth-Century Studies at King’s College London. He joined ITPro in 2022 as a graduate, following four years in student journalism. You can contact Rory at rory.bathgate@futurenet.com or on LinkedIn.
Most Popular
Resources
Get the ITPro. daily newsletter
Receive our latest news, industry updates, featured resources and more. Sign up today to receive our FREE report on AI cyber crime & security - newly updated for 2024.