Skip to main content

ChatGPT Danger Mode for Jupyter

Project description

🚨 Dangermode

Overview

🚨 Dangermode is a ChatGPT Plugin written with Python and FastAPI that allows ChatGPT to execute code snippets in an IPython session, whether it's the console, the notebook, or a JupyterLab session.

⚠️ Dangermode is a proof-of-concept and should not be used in production. It is not secure and should not be publicly exposed to the web. ⚠️

🚨🚨🚨 YOU ARE GIVING AI THE ABILITY TO EXECUTE CODE AS YOU. 🚨🚨🚨

Running this plugin on your machine is dangerous. Running this plugin on a public server is extremely dangerous. You have been warned.

Demo

Demo Time

Features

  • Execute code snippets in an IPython session through ChatGPT.
  • Inspect variables and view results in real-time.
  • Serve images and display data to ChatGPT.

Get started, the (slightly) less dangerous way

Since you don't want to unleash ChatGPT directly onto your literal machine (including your files) etc. Build the docker image and run it locally like this:

docker build . -t dangermode
docker run -p 8000:8000 -i -t --rm dangermode

(SCARY DANGER MODE) Installation

If you're feeling brave , you can install dangermode directly via pip, conda, or clone the repository and install it locally. If you really aren't worried about security, go for it. You have been warned.

Run Danger Mode

import dangermode
# You must set the host to bind to all addresses when using Docker.
# Since this is dangerous, I leave it as an exercise to the reader.
dangermode.activate_dangermode()

Enabling on ChatGPT

In order to use this plugin, you have to have ChatGPT Plugin access.

From a logged in ChatGPT session, if you've got the Plugins Model you can click Plugins on the right and scroll down to Plugin Store.

Click Plugin Store

Next, click "Develop your own plugin".

Develop your own plugin (1)

Enter localhost:8000 as the domain.

Enter localhost_8000 as the domain

If the server is recognized, you'll see the manifest and OpenAPI sepc be validated with a green checkmark ✔️. Click "Install localhost plugin" and start using it!

Found plugin, install it

API Endpoints

  • GET /openapi.json: Retrieve the OpenAPI JSON configuration.
  • GET /.well-known/ai-plugin.json: Retrieve the AI plugin JSON configuration.
  • GET /images/{image_name}: Retrieve an image by its name.
  • GET /api/variable/{variable_name}: Retrieve the value of a variable by its name.
  • POST /api/run_cell: Execute a code cell and return the result.

Contributing

Please do. I can't let Large Language Models write all of it.

Please fork the repository, make your changes, and submit a pull request.

License

Dangermode is released under the BSD 3-Clause License. See LICENSE for more information.

Contact

If you have any questions or feedback, please feel free to reach out to the author, Kyle Kelley, on Twitter at @KyleRayKelley or just open an issue on the repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dangermode-0.3.0.tar.gz (47.6 kB view details)

Uploaded Source

Built Distribution

dangermode-0.3.0-py3-none-any.whl (45.9 kB view details)

Uploaded Python 3

File details

Details for the file dangermode-0.3.0.tar.gz.

File metadata

  • Download URL: dangermode-0.3.0.tar.gz
  • Upload date:
  • Size: 47.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.9.9 Darwin/22.3.0

File hashes

Hashes for dangermode-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cdb8e6209e51b659b3f9f6bc93532ef1bc125b49b14622037f413e4726092e4c
MD5 b051e57b7bf08d79794790cbd176afea
BLAKE2b-256 a35aeae321632720231f2330fb2e8c199f500adf44cebc80b57d4697d1c4faed

See more details on using hashes here.

File details

Details for the file dangermode-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: dangermode-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 45.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.9.9 Darwin/22.3.0

File hashes

Hashes for dangermode-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f278a143e6e2fcbf64935acf852ac55ccbf54c98803d15d660fc00c97145b0e7
MD5 db2e714043a8ff8b167366e5143ee965
BLAKE2b-256 f962d4775cbc86ee8ba5eee5d6db1bbe0b6a85d0693bc19288e5982c00971baa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page