PyBot: Your AI Tutor in this course

By: Michael Fudge

What the @#%!?

This course includes an a free AI programming assistant for your use. I programmed the assistant over the 2022-2023 winter break and it makes heavy use of the OpenAI GPT-3 model, which has been popularized recently by chat-GPT phenomenon https://openai.com/blog/chatgpt/. We use a special version of GPT-3 that is optimized for programming, called codex phttps://openai.com/blog/openai-codex/.

I created created the assistant for a single purpose: to study whether these technologies impact how students learn computer programming.

The assistant is called PyBot and is available only within our Jupyter Hub environment https://hub.ischool.syr.edu. You are welcome to use PyBot to help you with any coding tasks, including your homework and project. Think of PyBot as an always available Python tutor.

!Important!

Pybot only works on notebook files in the course folder. For example: ~/library/ist256/fall2023

Invoking the PyBot

The bot was implemented as a Jupyter magic. To use it, simply type the following command in an empty code cell:

%%pybot 

{{your prompt here}}

The %% is a special code to invoke the magic. The pybot is the name of the magic. The {{your prompt here}} is the prompt.

What exactly is a prompt? It is a question or statement that you would like the bot to answer. For example, you might type:

%%pybot

write a computer program to input a temperature in Celsius and output the temperature in Fahrenheit

To which PyBot will respond with the following code:

#AI-Generated Output (Tokens: prompt=20, output=47, over_max=False)
celsius = float(input("Enter the temperature in Celsius: "))
fahrenheit = (celsius * 9/5) + 32
print("The temperature in Fahrenheit is: ", fahrenheit)

And in this case the code the bot gave us works!

Enter the temperature in Celsius: 100
The temperature in Fahrenheit is:  212.0

Does this make programming irrelevant?

No! Consider PyBot is only a tool, the next evolution in computer programming. It helps you to accomplish a programming task.

  • Ultimately you must understand the concepts well enough to to explain to the bot how to produce relevant code.
  • Also you must be able to read code well enough to verify the code the bot produces is correct!
  • In some cases you may need to modify the code the bot produces to make it work in your specific context.
  • The bot can solve simple problems, but it will be on you to solve more complex problems from the pieces the bot provides.

Is this magic? How does it do this!?

For that, I suggest reading this blog post on OpenAI codex: https://openai.com/blog/openai-codex/

Can I REALLY use this in my homework and project? Is this cheating?

Its not cheating if you cite your sources!!!. Students get in trouble when they hide the origins of their sources.

Citing the PyBot

If the bot helped you with your homework or project, credit the PyBot. Here’s the process:

  • Leave any prompts (notebook cells where you invoked the bot) in your notebook.
  • Leave the code the bot produced in your notebook. As it was generated.
  • When you write your solution, COPY the bot’s code in a separate cell, preserving the bot’s original output.
  • Mention how you use the bot in your reflection. Was it helpful? What did you learn from using it?

Easy!

Some final thoughts:

  • Yes, it’s a Python course, but really is a course in computational thinking.
  • You should learn to code and PyBot should make you smarter not dumber.
  • PyBot is not a replacement for YOU. It is a tool to help you.
  • Don’t trust your evil AI overlords; think for yourself.

Acknowledgements

Many thanks to OpenAI for making several hours of compute available for use in our course.