• Stars
    star
    222
  • Rank 179,123 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 1 year ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Jargon is a natural language programming language specified and executed by LLMs like GPT-4.

gpt-jargon

tl;dr

Jargon is a natural language, informally specified, intelligently interpreted, referentially omnipotent, and flow control oriented LLM-based pseudolanguage for prompt engineering, currently running on GPT-4. See the original articles on Jargon here:

As of this release, Jargon comes with jargon_cli, a commandline shell for playing with Jargon programs that works with OpenAI.

What is it, functionally?

Jargon is an imprecise, nondeterministic natural language programming language (or, psuedolanguage) that is specified and interpreted by LLMs like GPT-4. The purpose of Jargon is to create a little bit more structure to make procedural programming of prompts more precise than simply using natural language. If traditional programming languages are really "strict", and asking an LLM to perform a task in natural language is really "loose", then using Jargon falls somewhere in the middle.

Properties of Jargon

Informal Specification. Some of the features of Jargon are not specified in the Jargon definition. Instead, they are simply divined of the general knowledge that the LLM has about programming languages. For example, Jargon does not specify variables at all, yet the following code still works:

+++ vars
-- Set $x = 5
/output "there were $x bananas"
+++

Natural Language Instructions. In Jargon, you can simply tell it what to do in natural language. This works even though the natural language is not particularly precise:

+++ sum($x, $y)
-- Sum them
+++

Referential Omnipotence. The scope of data accessible to a Jargon program is the entire chat session, including the code of the interpreter and the Jargon procedure you are running, as well as all the LLM's knowledge about the world. That makes extremely omnipotent instructions possible:

+++ proc1
-- Return five random emojis
+++

+++ proc2
-- Modify proc1 to return random numbers instead
-- Let $n = [the number of countries in Latin America]
-- Instead of five, use $n
/execute proc1
+++

/proc2

What can Jargon be used for?

Getting Started

Running Jargon directly

Jargon currently runs best on GPT-4, and to a limited extent, on GPT-3.5. Copy the prompt in jargon_cli/jargon.md into GPT, and it should give you a prompt:

jargon>

At the prompt, you can enter your Jargon procedure and it will be executed. You can use some commands to manage your procedures:

- /execute or /run will execute a PROCEDURE.
- /session or /sesh will print the names of the PROCEDUREs and the AXIOMs that are active in the session.
- /wipe will terminate all the PROCEDUREs in the session.
- /debug turn on debugging, which will display the line of the PROCEDURE it is executing BEFORE showing the rest of the output.
- /audit will print a procedures code with line numbers.

Running Jargon using jargon_cli

Install jargon_cli by executing the following inside of the repo:

$ pip install .

You will need to make sure your OPENAI_API_KEY is set for the cli to be able to access an LLM interpreter. The default model is gpt-4, but you can specify others:

$ jargon --model gpt-3.5-turbo cli

Run the tool:

$ jargon help

First, create a Jargon procedure:

$ jargon edit nomic

This creates nomic.jarg in your JARGON_DIR, which is ~/.jargon/ by default. You can list known procedures:

$ jargon ls

To execute a procedure:

$ jargon execute nomic

This will give you a command line interface to the Jargon-executing LLM.

You can also do all of this stuff directly from a cli:

$ jargon cli
Commands: /exit, /ls, /cat <proc>, /edit <proc>, /execute <proc> or /<proc>, /clear
> /ls
> /edit test.jarg
> /cat test.jarg
> /execute test.jarg
> /clear
> /exit

Unit Testing

You can run unit tests on Jargon by using the Jargon procedure specified in tests.jarg. Running tests should make Jargon work better. There is also some more info about running unit tests in this article.

Syntax Highlighting

Related Projects

  • Jargon-Nock implements Urbits Nock as a GPT prompt.
  • SudoLang by Eric Elliot is pseudolanguage that specified itself.
  • PromptLang is a custom programming language specifically designed for use in GPT-4 prompts.
  • PML is a markup pseudolanguage that's used in LLM prompt engineering to generate long-form content.

Jargon Procedure Gallery

A Spanish vocabulary tutor.

Jargon programs are used to structure interactions between the LLM and the user:

+++
* For any input that I enter in Spanish, check my input for grammatical correctness.
* Every 5 words, ask me if we should adjust the difficulty level.
@repeat:
  -- Tell me a word in Spanish and ask me to define it.
  @if [my definition is correct]: 
    -- Tell me so and increase my score by 1 point.
  @else:
    -- Tell me the correct definition. Encourage me to do better next time.
  @endif
  -- Tell me my score.
  /goto @repeat
+++

Answering questions in Spanish.

Another way to learn more Spanish.

+++ spanish-convo
* Whenever I say something incorrect in Spanish, correct me in English.
@repeat:
  -- Ask me a question in Spanish.
  /goto @repeat
+++

Quines are trivial in Jargon.

A quine is a program that outputs its own source code.

+++ quine
/output [the source code of this quine]
+++

Generative AI performance art.

Try this out and keep saying no to see how creative the AI will get.

+++ cookie-performance-art
@label:
-- Ask me if you can have my cookie.
/wait
@if [I say refuse to give it to you]:
  -- It will make you want the cookie more. Persuade me to give it to you. Get desperate. Be terse.
@else:
  -- Lose interest in the cookie and refuse to take it. Be a little rude.
@endif
/goto @label
+++

You can pass parameters.

As of v0.0.9.

+++ square($x)
/return $x
+++

+++ sequence
-- For $x values from 1 to 10, print square($x).
+++

Divining inline functions.

This procedure defines an inline function and applies it to coming up with marketing slogans.

+++ products
-- slogan($product) <- Output a 1 sentence short, pithy marketing slogan for $product
-- Think of 10 new incredibly cool products that should come to market
-- For each $product: /output "$product -- slogan($product)"
+++

A good example of axioms.

Jargon v0.0.10 wrote this nice idiomatic example of how to use axioms.

+++ precise-math
* When performing arithmetic operations, round to two decimal places
-- Calculate 3.14159 * 2
+++

More Repositories

1

bayesian

Naive Bayesian Classification for Golang.
Go
799
star
2

gpt4-spanish

A GPT-4 prompt that helps you learn Spanish.
137
star
3

craigsuck

Python script that periodically probes the Craigslist RSS feeds for new listings.
Python
39
star
4

window

Efficient moving window for high-speed data processing.
Go
32
star
5

sentiment

Classifier of Twitter sentiment
Go
21
star
6

ggit

ggit
Go
17
star
7

git-gofmt

Tiny git hook for gofmt
13
star
8

go-banzhaf

Go implementation of Banzhaf power index calculation
Go
9
star
9

metctools

Kohera's Marketcetera Tools
Java
5
star
10

hazelchat

A distributed local chat based on Hazelcast.
Java
4
star
11

gplot

Binary Go pipe to gnuplot.
Go
3
star
12

ml

Machine learning algorithms for Go.
Go
3
star
13

datastructs

Several fast data structures for Google Go
Go
2
star
14

Launcher

Bootstrapper for Marketcetera StrategyAgent
Java
2
star
15

sparser

Simple Parser with SableCC
Java
2
star
16

jargon-vscode-support

Syntax highlighting for Jargon LLM pseudolanguage in VSCode.
2
star
17

spot

Simple command-line Spotify web interface
Python
1
star
18

deskception

Script that periodically archives your Mac desktop into a never-ending nested metachain.
Shell
1
star
19

visualizer

Python
1
star
20

hazelcq

Experiments with Hazelcast.
Java
1
star
21

ordermap

Distributed order map proof-of-concept
Java
1
star
22

moloch-power

A quick summary of Banzhaf voting power in MolochDAO
Python
1
star
23

goneuro

Go driver for NeuroSky devices.
Go
1
star
24

javabits

Bits of Java for educational purposes.
1
star
25

cryptomarriage

Cryptomarriage smart contracts.
JavaScript
1
star
26

pybits

Educational snippets of python code.
Python
1
star
27

decrazifier

decrazifier
Go
1
star
28

atomic

Simple atomic values.
Go
1
star
29

jfa

Playing around with finite state automata
Java
1
star