A Jupyter/IPython magic command for generating code using GPT.
Project description
GPT magic
A Jupyter/IPython magic command for generating code using GPT
Example
Generating code with GPT by loading the extension and prefixing your line with %gpt.
Install
Install with pip
pip install gpt-magic
Please note that users will need to provide their own OpenAI API key. Set an environment variable called OPEN_AI_KEY with your key. Or pass the API key when loading the extension, by running the following line before %load_ext gpt_magic:
import os
os.environ["OPENAI_API_KEY"] = "your_openai_api_key_here"
Usage
%load_ext gpt
%gpt "Your request here"
Model
The current default is the gpt-3-turbo model, but can be changed using OPENAI_MODEL environmental variable.
Using GPT-4 example
import os
os.environ["OPENAI_MODEL"] = "gpt-4"
Arguments
Chat
You can enable memory of all previous requests and responses with the -c argument. By default it's memory-less.
%gpt -c "Write a function which calculates the average of a numpy array"
Temperature
You can set the temperature with -t argument. The default is 0.
%gpt -t 0.5 "Write a function which calculates the average of a numpy array"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gpt-magic-0.2.0.tar.gz.
File metadata
- Download URL: gpt-magic-0.2.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6edb5fa416577e0d30444082a81a7eddb26f63766abc6c8c08d2f031b0bab311
|
|
| MD5 |
1409c7f1f95d133ec5920bbbcd758222
|
|
| BLAKE2b-256 |
6ea30e2b6e14c9ea0720552801fc5f692f293fb6b3b9b6c94b85f1fbb509f218
|
File details
Details for the file gpt_magic-0.2.0-py3-none-any.whl.
File metadata
- Download URL: gpt_magic-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03da0bccaef609f385a6075891e3ac9111f02edb56a7f1819c7448b80d5ca6ab
|
|
| MD5 |
a7668826598afb31c49dd942b380df8e
|
|
| BLAKE2b-256 |
332fb1186ce87b8379a943589c31bad58aa1aafe5f382cfe89f942e4d012df98
|