jisc logo

Code Generator

Utilise a LLM to generate code.

The following demonstration uses Google Cloud's PaLM 2 language model. It attempts to write you a function based on requirements you specify. It utilises two different models that allow you to Generate (code-bison) and Complete (code-gecko) code.

Instructions
  1. Select from one of the example functions or select a model from the drop-down and enter an prompt.
  2. Click the Analyse button.
  3. View the generated code created by Google PaLM 2 .
More information about this demo

This demo utilises a Large Language Model (LLM); PaLM 2 from Google. A LLM is a form of Artificial Intelligence (AI), built on a expansive dataset, predominantly scraped from the internet. The main uses for these models are to generate, complete and summarise text, and in this case code. They work by, based on the initial text input, continually predicting the most likely next token or word to create meaningful responses, in most cases. When working with such models, providing the best prompt to the model is important and this is known as prompt-engineering.


Things to consider

These tools will generate different responses to prompts each time they are run, so if you don't like a response, rerun the same parameters and get a differently constructed function. Google Clouds PaLM 2 Model offers Multilinguality, Reasoning and Coding abilities, also coming in a variety of different sizes which allows it to be run on a variety of different machines; resulting in a highly versatile model.