Skip to main content

Jupyter kernel that allows you generate code from natural language prompts

Project description

ICortex Kernel

Github Actions Status

ICortex is a Jupyter kernel that supercharges your Jupyter Notebook workflow by letting you use code generation services e.g. TextCortex's ICortex API, OpenAI's Codex API, HuggingFace transformers running locally to generate Python code automatically from user prompts.

  • It is a drop-in replacement for the IPython kernel. Prompts start with a forward slash / otherwise the line is treated as regular Python code.
  • It is interactive—install missing packages directly, decide whether to execute the generated code or not, directly in the Jupyter Notebook cell.
  • It is fully extensible—if you think we are missing a model or an API, you can request it by creating an issue, or implement it yourself by subclassing ServiceBase under icortex/services.

Installation

To install the ICortex Kernel, run the following in the main project directory:

pip install icortex
icortex

Launching ICortex

You can launch the ICortex shell directly in your terminal:

icortex

If there is no configuration file icortex.toml in the project directory, the shell will prompt you to create one step by step.

Or you can create a new Jupyter notebook. Start the JupyterLab server with

jupyter lab

and choose ICortex as your kernel when creating a new notebook.

Usage

To execute a prompt with ICortex, use the / character (forward slash, also used to denote division) as a prefix. Copy and paste the following prompt into a cell and try to run it:

/print Hello World. Then print the Fibonacci numbers till 100, all in the same line

If all goes well, you should see an output similar to the following:

print('Hello World.', end=' ')
a, b = 0, 1
while b < 100:
    print(b, end=' ')
    a, b = b, a+b

Hello World.
1 1 2 3 5 8 13 21 34 55 89

You can make the kernel attempt to auto-install packages and auto-execute the returned code.

/help

Uninstalling

To uninstall, run

pip uninstall icortex

This removes the package, however, it may still leave the kernel spec in Jupyter's kernel directories, causing it to continue showing up in JupyterLab. If that is the case, run

jupyter kernelspec uninstall icortex -y

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

icortex-0.0.1.tar.gz (18.9 kB view hashes)

Uploaded Source

Built Distribution

icortex-0.0.1-py3-none-any.whl (23.5 kB view hashes)

Uploaded Python 3

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