# jupytee - magics for using GPT-like models inside Jupyter
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/fperez/jupytee/HEAD?labpath=examples%2Fjupytee-demo.ipynb)
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](https://beta.openai.com/account/api-keys).
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](https://beta.openai.com/docs/api-reference/introduction). They target the main entry points of the API: text completion, image generation and code completion, respectively.
You can see them in action in the 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) work:
```
%%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.
BSD 3-Clause License
Copyright (c) 2022, Fernando Pérez
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Raw data
{
"_id": null,
"home_page": "",
"name": "jupytee",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "ipython,jupyter,GPT-3,OpenAI",
"author": "Fernando P\u00e9rez",
"author_email": "fernando.perez@berkeley.edu",
"download_url": "https://files.pythonhosted.org/packages/8b/ce/4309b28565ff196ea576b8e61ced2f4ad0dc246188977772df3cd767c0df/jupytee-0.0.4.tar.gz",
"platform": null,
"description": "# jupytee - magics for using GPT-like models inside Jupyter\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/fperez/jupytee/HEAD?labpath=examples%2Fjupytee-demo.ipynb)\n\nA small, experimental playground with Jupyter magics to use OpenAI's GPT-3 models inside Jupyter environments.\n\nThis 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](https://beta.openai.com/account/api-keys).\n\nYes, the name is a silly play on the pronunciation of GPT and Jupyter.\n\n## Installation\n\n`pip install jupytee`\n\n\n## Usage\n\nTo load the extension, use\n\n`%load_ext jupytee`\n\nThe package provides a few core magics, `%chat`, `%pic` and `%code` (along with some extra helpers), that wrap your interactions around the [OpenAI Python API](https://beta.openai.com/docs/api-reference/introduction). They target the main entry points of the API: text completion, image generation and code completion, respectively. \n\nYou can see them in action in the notebook contained in the `examples` directory (which you can run immediately by clicking on the Binder button above).\n\nBriefly, 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):\n\n```\n%chat What is 100F in Celsius ?\n```\n\nYou can control the sampling temperature with `-T`:\n\n```\n%chat -T 1 --raw Write an uplifting short poem\n```\n\nMarkdown (with math) work:\n\n```\n%%chat\nProduce the LaTeX form of Maxwell's equations.\n```\n\nFor `pic`, you can control image size and the number of images returned:\n\n```\n%pic -s m -n 2 an astronaut knitting\n```\n\nWhen generating code, you can iteratively refine the answer by referring to the `CODE` special word (in all CAPS):\n\n`%code A function to add two numbers.`\n\nand then:\n\n`%code Update CODE to have a docstring explaining its use.`\n\n\n## License\n\nBSD 3-Clause.\n\nBSD 3-Clause License\n\nCopyright (c) 2022, Fernando P\u00e9rez\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License",
"summary": "Magics for using GPT-like models inside Jupyter.",
"version": "0.0.4",
"split_keywords": [
"ipython",
"jupyter",
"gpt-3",
"openai"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "81d4ccbeba9d557b21402bb909d9851b",
"sha256": "9fb95b46b46bc91570353f1f435cd542d26551c818d177575b947794854e1433"
},
"downloads": -1,
"filename": "jupytee-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "81d4ccbeba9d557b21402bb909d9851b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7045,
"upload_time": "2022-12-24T06:04:02",
"upload_time_iso_8601": "2022-12-24T06:04:02.485001Z",
"url": "https://files.pythonhosted.org/packages/1a/c2/6a4005f5d65d5eb795df773f94dd70fbbc679e5256f437207d7eee98829b/jupytee-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "542a9f5bb7d3667f7ada18a7ef6518ab",
"sha256": "21ce8830d9bf9109cdda2443f1917beac4fa77ed73ac9286dc4e1eda5cd9326c"
},
"downloads": -1,
"filename": "jupytee-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "542a9f5bb7d3667f7ada18a7ef6518ab",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5877,
"upload_time": "2022-12-24T06:04:03",
"upload_time_iso_8601": "2022-12-24T06:04:03.773130Z",
"url": "https://files.pythonhosted.org/packages/8b/ce/4309b28565ff196ea576b8e61ced2f4ad0dc246188977772df3cd767c0df/jupytee-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-24 06:04:03",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "jupytee"
}