Skip to content
/ jupytee Public

Experimental playground with Jupyter magics to use OpenAI's GPT-3 models inside Jupyter environments.

License

Notifications You must be signed in to change notification settings

fperez/jupytee

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jupytee - magics for using GPT-like models inside Jupyter

Binder

A small, experimental playground with Jupyter magics to use OpenAI's GPT-3 models inside Jupyter environments.

This isn't even alpha software - it's just a quick and dirty prototype. But it works, if you have the python openai package installed and the environment variable OPENAI_API_KEY defined with your personal API key as per the docs.

Yes, the name is a silly play on the pronunciation of GPT and Jupyter.

Installation

pip install jupytee

Usage

To load the extension, use

%load_ext jupytee

The package provides a few core magics, %chat, %pic and %code (along with some extra helpers), that wrap your interactions around the OpenAI Python API. They target the main entry points of the API: text completion, image generation and code completion, respectively.

You can see them in action in this notebook contained in the examples directory (which you can run immediately by clicking on the Binder button above).

Briefly, these are some examples of how you can use them. A simple question (note the extra space before ?, needed b/c IPython's help will otherwise trigger by accident):

%chat What is 100F in Celsius ?

You can control the sampling temperature with -T:

%chat -T 1 --raw Write an uplifting short poem

Markdown (with math) works:

%%chat
Produce the LaTeX form of Maxwell's equations.

For pic, you can control image size and the number of images returned:

%pic -s m -n 2 an astronaut knitting

When generating code, you can iteratively refine the answer by referring to the CODE special word (in all CAPS):

%code A function to add two numbers.

and then:

%code Update CODE to have a docstring explaining its use.

License

BSD 3-Clause.

About

Experimental playground with Jupyter magics to use OpenAI's GPT-3 models inside Jupyter environments.

Resources

License

Stars

Watchers

Forks

Packages

No packages published