Ready to write Python code 4x faster?
This will be an overview of the tools you can use to write Python automatically with AI.
OpenAI Codex
This is the most widely used code generation tool. It relies on Chat GPT-3 to generate code that the user prompts with written words. For example, as the website’s documentation says, prompting “Make a red ball bounce around the screen” will generate the code on the right of the image below.
As you can imagine, this is a simple Java example and more elaborate prompts will have less reliable results.
This guide has alot of Python use cases as well.
Mito
Mito has a new AI feature that allows the user to access ChatGPT within the Mitosheet. Previously, Mito only allowed you to generate Python by editing it's spreadsheet interface. Now users can open an AI window and use written prompts to edit their data and generate the equivalent code.
Tabnine
Tabnine is not a prompt based code generator, but a well established code autocomplete tool. One powerful feature is the ability to train Tabnine on your own repositories. This allows users to get code completions specific to their own style of coding.
OpenAI API client library
Another option is to simply install the openAI API interface into your Python environment. This will allow you to access OpenAI models within your environment. All you need to do is install and import the package.
$ pip install openai
import openai
Then you need to set up the model:
# Set up the OpenAI API client
openai.api_key = "YOUR_API_KEY"
# Set up the model and prompt
model_engine = "text-davinci-003"
prompt = "Hello, how are you today?"
# Generate a response
completion = openai.Completion.create(
engine=model_engine,
prompt=prompt,
max_tokens=1024,
n=1,
stop=None,
temperature=0.5,
)
response = completion.choices[0].text
print(response)
Open source ChatGPT interfaces for Jupyter
Since the explosion of ChatGPT, many repos have popped up on Github of how to access ChatGPT inside a Jupyter Notebook (or JupyterLab/JupyterHub). This is an obvious, yet very useful application for ChatGPT. I will be interesting to see how these integrations begin to evolve and differentiate from each other.
More Like This
Automating Spreadsheets with Python 101
How to tell the difference between a good and bad Python automation target.
10 Mistakes To Look Out For When Transitioning from Excel To Python
10 Common Mistakes for new programmers transitioning from Excel to Python
Research shows Mito speeds up by 400%
We're always on the hunt for tools that improve our efficiency at work. Tools that let us accomplish more with less time, money, and resources.
3 Rules for Choosing Between SQL and Python
Analysts at the world's top banks are automating their manual Excel work so they can spend less time creating baseline reports, and more time building new analyses that push the company forward.