Skip to main content

Jupyter kernel that can generate Python code from natural language prompts

Project description



Github Actions Status PyPI Latest Release Downloads Documentation Status License Discord Twitter

A Python library for soft-code development — program in plain English with AI code generation!


tl;dr in goes English, out comes Python:

https://user-images.githubusercontent.com/2453968/199964302-0dbe1d7d-81c9-4244-a9f2-9d959775e471.mp4

ICortex enables you to develop soft programs:

Soft program: a set of instructions (i.e. prompts) written in natural language (e.g. English), processed by a language model that generates code at a lower layer of abstraction (e.g. Python), to perform work more flexibly than regular software.

In other words, ICortex is a natural language programming (NLP) framework that enables you to write code in English, and then run it in Python. It aims to make programming more accessible to non-programmers.

ICortex is designed to be …

  • a drop-in replacement for the IPython kernel. Prompts are executed via magic commands such as %prompt.
  • interactive—automatically install missing packages, decide whether to execute the generated code or not, and so on, directly in the Jupyter Notebook cell.
  • open source and fully extensible—ICortex introduces a domain-specific language for orchestrating various code generation services. 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.

ICortex is similar to Github Copilot but with certain differences that make it stand out:

Feature GitHub Copilot ICortex
Generates code ... In the text editor At runtime through a Jupyter kernel
Control over code generation context ... No Yes
Natural language instructions are a ... Second-class citizen (Code comes first) First-class citizen (Prompts are the program)
The resulting program is ... Static Dynamic—adapts to the context
Can connect to different code generation APIs No Yes

The main difference between ICortex and a code-generation plugin like GitHub Copilot is that ICortex is a new paradigm for Natural Language Programming where the prompt is the first-class citizen. GitHub Copilot, on the other hand, enhances the existing paradigm that are already used by developers.

ICortex is currently in alpha, so expect breaking changes. We are giving free credits to our first users—join our Discord to request more if you finish the starter credits.

Installation

Locally

Install directly from PyPI:

pip install icortex
# This line is needed to install the kernel spec to Jupyter:
python -m icortex.kernel.install

On Google Colab

Google Colab is a restricted computing environment that does not allow installing new Jupyter kernels. However, you can still use ICortex by running the following code in a Colab notebook:

!pip install icortex
import icortex.init

Quickstart

Click here to visit the docs and get started using ICortex.

Getting help

Feel free to ask questions in our Discord.

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.1.2.tar.gz (101.4 kB view hashes)

Uploaded Source

Built Distribution

icortex-0.1.2-py3-none-any.whl (104.8 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