sw-yx / ask-cli

a cli to ask questions of gpt3 and iterate/chain of thought

Home Page:https://twitter.com/swyx/status/1588243607617560576

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ask CLI

Ask is a Deno CLI for pinging GPT-3 and iterating with chain of thought prompting and other prompt engineering tricks.

Inspired by Linus' prototype (his impl here)

image

But it can also iterate on prompts:

image

And then it runs them in parallel for you to choose:

image

Install instructions

We use deno compile to ship a dedicated executable for each system architecture.

See the Releases page to download the appropriate binaries.

If you know what you're doing, you may also just run from source locally, see Local Dev below

Put the binary in your $PATH or just navigate your terminal to the folder where it is.

Usage instructions

These instructions are for Mac, but you should be able to adjust for Linux/Windows accordingly.

First get your OpenAI API Key from: https://beta.openai.com/account/api-keys

Then:

export OPENAI_API_KEY=sk_your_api_key_here
ask "How much wood would a woodchuck chuck if a woodchuck could chuck wood?"

By default you get a panel of options, but you can always exit with Ctrl+C.

The real power of this CLI comes from chaining prompts. You can run candidate prompts in parallel and choose prompts based on the responses.

image

And then it runs them in parallel for you to choose:

image

Local Dev

Make sure to have Deno installed.

Then, you can either:

  • deno run -A index.ts "how do i sample from a normal distribution from scratch in python?" for local dev
  • npm run build && ./builds/askcli "Shawn has five toys. For Christmas, he got two toys each from his mom and dad. How many toys does he have now?" to do a production build

Debugging:

deno run --inspect-brk  -A index.ts -d "How many of the integers between 0 and 99 inclusive are divisible by 8?"

and then open chrome://inspect, open the directory in devtools and put in breakpoints.

About

a cli to ask questions of gpt3 and iterate/chain of thought

https://twitter.com/swyx/status/1588243607617560576

License:MIT License


Languages

Language:TypeScript 100.0%