0.1.14 • Published 12 months ago

@gptlabs/upg v0.1.14

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
12 months ago
  __  ______  ____ _    UPG CLI
 / / / / __ \/ __ `/    Public Beta
/ /_/ / /_/ / /_/ /     
\__,_/ .___/\__, /      🇺🇸  Built by GPT Labs
    /_/    /____/       Now officially a CIA front company!
                        (c) 2022 MIT License

This is an initial public release. It will be ugly. Please send feedback to @gptlabs on Twitter.

What is UPG?

UPG is a tool for creating and editing programs given a target (language) and a description.

You can put anything you want in those fields, but some targets are supported out of the box for execution (TypeScript using tsmodule, Python using python3, and OS-specific shell commands zsh, bash, and cmd). You can still execute non-supported targets by telling the CLI what command to run to execute the output file.

Installing

Using Yarn:

yarn global add @gptlabs/upg

Using NPM:

npm i -g @gptlabs/upg

After installing, you can update with upg update.

Usage

Create

To create a new program, run upg. You will be prompted to enter a language and a description of what the program will do.

Edit

When you have a program loaded, either by creating a new one or using upg load <file>, you can edit it by describing the changes that need to be made.

Explain

When you have a program loaded, you can ask UPG to explain it using the Explain command. We attempt to generate the most useful, detailed explanation possible.

Example: Terminal

By default, the language is set to an OS-specific shell: zsh for Mac, bash for Linux, and cmd for Windows.

Converting files with ffmpeg

  1. Generating ffmpeg spaghetti to convert all .mov files in the current directory to .mp4:

    npm.io

  2. Converting screen recordings of these demos to .gif for use in this README:

    npm.io

Example: Other programs

You can generate programs for any language.

Plotting the Mandelbrot set with Python

An oldie but a goodie.

npm.io

Generating and demonstrating the Y combinator function

Also adds a demo, and executes using TS Module¹.

npm.io

¹ Similar to ts-node, but won't throw on account of type errors. You'll need to install @tsmodule/tsmodule for now to run TS.

Solving nontrivial problems using an edit loop

UPG did not generate a solution to the minimum edit distance problem immediately. It initially contained errors and would not run.

First, errors were fixed using Edit to tell it: fix errors: [pasted errors]. If you are able to identify the error logically and say it conversationally rather than paste an error, that is better. (The person who generated this solution was flying completely blind, could not solve this problem if they wanted to, and had never written C.)

Then, failed cases were fixed using the following Edit pattern: functionName(input) should equal A, got B. This was sufficient through trial and error to fix the output for certain cases, until it passed for all tests.

Finally, once it converged on a working solution, it was asked to optimize performance using the Edit command: refactor: make it faster. (For some reason, that spell works very well for performance optimization.)

npm.io

Converting to other languages

You can translate programs to other languages using the edit feature. The language context will not automatically change yet - in the meantime, use Save to write to yc.py and then upg load yc.py to run it as Python.

Translating from TypeScript to Python

Translates the Y combinator output above.

npm.io

Translating comments

UPG can translate comments and languages extremely reliably, for basically any language you could name. It speaks English, Chinese, and Japanese very fluently. See examples below for even harder language targets.

Difficulty: EASY

Translates the comments in the generated minimum edit distance solution to English.

npm.io

Difficulty: HARD

Translates the comments in the same solution to Latin.

Something interesting actually happens in this translation, where GPT-3 chooses a Romanian (Latin-descended) word inițializare over the most likely best choice initiāre ("to begin", "to initiate"), due to it looking closer to English initialize. But it remains a reliable transation more or less.

npm.io

Difficulty: SUICIDE

Translates the comments in the same solution to Māori, an Eastern Polynesian language with approximately 180,000 native speakers.

It seems to drop the macrons (e.g. ā) due to code comments almost always being ASCII only.

npm.io

Example: Explanations

Use the Explain command after loading a program to generate a detailed explanation of what it does.

Explaining the UPG-generated solution to the minimum edit distance problem

The following explanation was generated:

The program is a solution to the Levenshtein Distance problem, which is the minimum number of edits (insertions, deletions, or substitutions) needed to transform one string into another. The program uses a dynamic programming approach to solving the problem.

npm.io

Known issues

  1. It is not possible yet to switch the language context for a translation, i.e. the CLI cannot know the above example was translated to Python, and if you select Run, it will attempt to execute it as TS.

    This will be solved in future versions, but for now, use Copy or Save to get it out of the CLI and execute it manually, or load it with upg load [new-file] and then Run.

    See the Convert to other languages section above.

0.1.15-canary.5

12 months ago

0.1.15-canary.4

1 year ago

0.1.15-canary.3

1 year ago

0.1.15-canary.2

1 year ago

0.1.15-canary.1

1 year ago

0.1.15-canary.0

1 year ago

0.1.14

1 year ago

0.1.13

1 year ago

0.1.13-canary.7

1 year ago

0.1.13-canary.6

1 year ago

0.1.13-canary.5

1 year ago

0.1.13-canary.4

1 year ago

0.1.13-canary.3

1 year ago

0.1.13-canary.2

1 year ago

0.1.13-canary.1

1 year ago

0.1.13-canary.0

1 year ago

0.1.12

1 year ago

0.1.12-canary.9

1 year ago

0.1.12-canary.8

1 year ago

0.1.12-canary.7

1 year ago

0.1.12-canary.6

1 year ago

0.1.12-canary.5

1 year ago

0.1.12-canary.4

1 year ago

0.1.12-canary.3

1 year ago

0.1.12-canary.2

1 year ago

0.1.12-canary.1

1 year ago

0.1.11-canary.2

1 year ago

0.1.11-canary.1

1 year ago

6.0.0-canary.0

1 year ago

5.0.0-canary.0

1 year ago

4.0.0-canary.0

1 year ago

2.0.0-canary.0

1 year ago

1.0.0-canary.0

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.27

1 year ago

0.0.24

1 year ago

0.0.23

1 year ago

0.0.22

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.17

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago