Google Adds Code Generation To Bard |
Written by Kay Ewbank | |||
Wednesday, 26 April 2023 | |||
Google has announced that its Generative Pre-trained Transformer (GPT) Bard now has the ability to generate programming code, and to debug and explain existing code. There are a few AI code assistants out there - Copilot, Codex, Bayou and CodeWhisperer to name just the best known, but Google's Bard hasn't been promoted as such until now. The initial launch version supports more than 20 programming languages including C++, Go, Java, Javascript, Python and Typescript. Developers will also be able to export Python code to Google Colab, and to get help writing SQL statements and functions for Google Sheets. The full list as reported by Bard when we asked what programming languages it knows was Python, JavaScript, Java, C++, Go, PHP, Ruby, Swift, Kotlin, Rust and Julia, and it can also generate code in other languages, including HTML, CSS, SQL, JSON, YAML and XML. When we asked Bard how you can use it to help with coding, it said we could ask it to generate code, as an example "you could ask me to generate a function that takes two numbers as input and returns their sum". Another option was to ask Bard to debug code "For example, you could ask me to find the error in a piece of code that is not working correctly."
You can also ask Bard to explain code. To test this out, we gave it some code from the extracts from Programmer's Python Async on process based parallelism elsewhere on the i-programmer website: import multiprocessing def myProcess(): while True: pass if __name__ == '__main__': p0=multiprocessing.current_process() p1=multiprocessing.Process(target=myProcess, and it responded with: The code you have provided is a simple example of how to use the I then tried it with some SQL, asking what was wrong with the query: SELECT user_id, first_name, last_name, class, COUNT(*) AS total_students FROM students GROUP BY class HAVING class IN ('JSS1') The answer correctly suggested that the query is missing a WHERE clause, as the HAVING clause is only used to filter the results of a GROUP BY query, but it cannot be used to filter the rows that are selected before the GROUP BY operation is performed. There was more detailed explanation, and the suggested improvement was:
Some commentators have suggested that Bard's programming abilities aren't real, but based on my afternoon of testing, it's a lot better than that. The Bard site says that "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." I'd recommend you sign up for the experimental version and try it out - Bard may surprise you. The age of AI coding assistance is here and Bard is the latest member. Will it soon be the age of the AI coder?
More InformationRelated ArticlesBing+GPT: This Is Not A Search Engine Chat GPT 4 - Still Not Telling The Whole Truth Google's Large Language Model Takes Control Open AI And Microsoft Exciting Times For AI The Unreasonable Effectiveness Of GPT-3 The Robots Are Coming - AlphaCode Can Program! The Unreasonable Effectiveness Of GPT-3 To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |
|||
Last Updated ( Wednesday, 02 August 2023 ) |