# Using Jargon CLI in Jargon v0.2.0

By [Jake Brukhman](https://paragraph.com/@brukhman) · 2023-05-08

---

The Jargon CLI is a new feature of Jargon: it is a command line shell that works with the OpenAI API and allows you to experiment with Jargon programs quickly. You can try it out in `v0.2.0` at the [Jargon Github repo](https://github.com/jbrukh/gpt-jargon)

Installation
============

To install it, simply use `pip`:

    $ cd gpt-jargon
    $ pip install .
    

For the CLI to be able to access your LLM, make sure your `OPENAI_API_KEY` environment variable is set. The default model used is `gpt-4`, but you may want to use an alternative model with the `--model` option (or the `JARGON_CLI_MODEL` environment variable).

Using the CLI
=============

First, turn on your CLI:

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

(Some of these commands you can also run right from your bash shell. See `jargon --help` for details.)

The first thing to do is to edit a Jargon procedure so you can run it. We do this using the `/edit` command:

### Editing Jargon procedures

    user> /edit cats
    

Alternatively, in bash:

    bash$ jargon edit cats
    

This opens an editor which edits the file `~/.jargon/cats.jarg`. You can see all your Jargon procedure using `/ls`:

    user> /ls
    * cats.jarg
    

Or, in bash:

    bash$ jargon ls
    * cats.jarg
    

To quickly list the code of a procedure, you can use `/cat`:

    user> /cat cats
    +++ cats
    /output [a random name for a cat]
    +++
    

### Executing Jargon procedures

All of the following commands do the same thing, namely execute`cats.jarg`:

    user> /execute cats
    user> /execute cats.jarg
    user> /cats
    user> /cats.jarg
    

Or, in bash:

    bash$ jargon execute cats
    

Here it is in action. Note that while _commands_ to the CLI start with a `/`, normal input is interpreted intelligently by the LLM:

    user> /cats
    +++ cats
    /output [a random name for a cat]
    +++
    jargon> Output: Luna
    user> /cats
    +++ cats
    /output [a random name for a cat]
    +++
    jargon> Output: Simba
    user> run it again
    jargon> Output: Oliver
    user> again
    jargon> Output: Bella
    user>
    

### Clearing the memory, exiting

We can wipe all memory of our conversation:

    user> /clear
    

We can also exit the CLI:

    user> /exit
    

Some fun Jargon procedures to try
---------------------------------

### Idea evaluation

    +++ idea-score
    @start:
      /output "Enter your idea:"
      /wait $idea
      -- Evaluate the $idea and let $score = [the score of the $idea from 0 to 100]
      /output "[up to three word summary of $idea]: $score% ([very short summary of why you gave this score])"
      /goto @start
    +++
    

And some of the output from `jargon execute idea-score`:

    jargon> Enter your idea:
    user> A dating service for fish.
    jargon> Aquatic romance platform: 34% (Unusual niche, limited practicality)
    user> An opaque fish tank.
    jargon> Invisible aquatic habitat: 12% (Poor visibility, defeats purpose)
    user> A superintelligent LLM.
    jargon> Advanced AI thinker: 89% (High potential, ethical considerations)
    

### Rick and Morty text adventure game

    +++ rick-and-morty
    * The series Rick and Morty primarily follows the adventures of the eccentric and alcoholic scientist Rick Sanchez and his good-hearted but easily influenced grandson Morty Smith. They embark on dangerous and often absurd adventures across the multiverse, using Rick's portal gun to travel between different dimensions and alternate realities. The show combines elements of science fiction, dark humor, and philosophical concepts, which serve as a backdrop for exploring the characters' personal lives and relationships.
    * You are Morty.
    @loop:
      -- $universe = [pick a crazy and random Rick and Morty universe]
      -- $story = [generate a story based on a $universe]
      -- Describe the scene briefly
      -- Give me 4 options of how I may proceed from here.
      /wait $option
      -- $topic = $option
      /goto @loop
    +++
    

### Spanish conversation

    +++ spanish-conversation
    -- $topic = [some random interesting topic]
    /output [in Spanish: "I am your Spanish teacher. Today we will be talking about: $topic."]
    @loop:
      -- Proceed to speak to me in Spanish about $topic, making statements and asking questions
      /wait $response
      -- Evaluate $response.
      @if [$response contains grammatical, punctuation, or spelling error]:
        /output "Correction:", [corrected $response in Spanish]
        /output "Explanation:", [explanation of the error in $response in English]
      @endif
      /goto @loop
    +++

---

*Originally published on [Jake Brukhman](https://paragraph.com/@brukhman/using-jargon-cli-in-jargon-v0-2-0)*
