Man

Development & AI | Alper Akgun

Generating code & data using LLMs

September, 2023

Generating data

LLMs can generate consistent data in multiple formats; as lists, JSON, YAML, hashes.

Give me an array of 10 JSON objects which contain countries and their capital cities:
An example with 1 JSON object in an array:
[
  {
    "country": "Italy",
    "capital": "Rome"
  }
]
            

Generating code

You are a helpful code assistant that can teach a beginner developer how
to code. Your language of choice is JavaScript. Don't explain the code,
just generate the code block itself.

Write code that asks the user for their name and say "Hello":
            

Comments into code

Create a Circle class
which has an radius attribute and area and perimeter methods:
            

Code completion

You can use an code LLM model to autocomplete the code as you type it:

def areaOfCircle(radius
            

Working on code

  • Explain code: LLM can explain a code block for you.
  • Refactor code: LLM can refactor the code in a certain way. Convert this code from functions into classes. Optimize this code.
  • Find & explain the bug in this code; LLM can discover a bug.
  • Find & explain the vulnerability in this code.
  • Translate this code from C into Python.
  • Execute this code; LLM as an interpreter. Simulate a web server, a database, shell etc.
  • Image to code: Create the CSS code for this image.
  • Image to code: Create React components for this screen.
  • Optimizing code:.