
Member-only story
Cogram.ai: A Coding Assistant for Data Science and Machine Learning
Codex powered autocompletions for data science and machine learning that run on jupyter notebooks
Since the publication and dissemination of GPT-3, coding assistants like Github copilot, powered by OpenAi’s codex API have been on the radar of the machine learning community for quite a while. Recently, I came across this tool called Cogram, which seems to be a type of evolution of autocompletion, specialized for data science and machine learning that runs directly on Jupyter Notebooks.
In this article, I will show you how this tool works and share a little bit of my experience with it so far, generating machine learning code on Jupyter Notebooks.
Getting Started with Cogram
First things first, to get set up with Cogram you have to head out to their website, there you sign up for a free account and get access to an API token. After that all you have to do is install Cogram with:
pip install -U jupyter-cogram
Enable it as a jupyter notebook extension:
jupyter nbextension enable jupyter-cogram/main
Finally, you set up your API token with:
python -m jupyter_cogram --token YOUR_API_TOKEN
Now that you are all set up, you can start getting completions directly on your jupyter notebook.
With the most recently available version, Cogram is enabled by default. The user can turn Cogram on and off in the menu via this icon,

and can also customize Cogram, to select how many suggestions Cogram shows, and how creative Cogram is.
There are two ways to use Cogram: you can use the autosuggest mode, where Cogram makes suggestions whenever you stop typing,
or when you go to a new line. You can also use the manual completion option, triggered with the Tab key.