GPTutor

GPTutor(,) is a Visual Studio Code extension that uses OpenAI’s GPT (Generative Pre-trained Transformer) models to provide users with code explanations and Reviews for a better understanding of their code and enabling users to get insights into code blocks and improve their coding skills. (Supported Move programming languages now)

Download GPTutor now (click me)

Features

  • Code tutor using OpenAI’s GPT models.
  • Code Review (review) using OpenAI’s GPT models.
  • Code comment using OpenAI’s GPT models.
  • Supports Move language for now.
  • Non-custodial API key (100% Free and we don’t own your key).
  • Supported GPT-4 model (default GPT-3.5)

Getting Started

1. Install the GPTutor(,) in your Visual Studio Code editor from Extensions

芸 2023-06-11 銝4 00 56

2. Activate the GPTutor by clicking at the left side panel. You might find GPTutor in the “Additional Views” button.

image

3. Set OpenAI API key by pasting the key in the input box. You may follow the instruction to get an API key from OpenAI’s Webiste

芸 2023-06-11 銝4 03 46

4. (Optional) Set the GPT model to be used by running the GPTutor: setModel Command

> GPTutor: setModel

5. Hover over a code block to display GPTutor suggestions

芸 2023-06-11 銝4 11 02

6. Choose the explain, Review or comment to help you

芸 2023-06-11 銝4 13 03

7. Click on the “Settings” button located at the top left corner to access additional configuration options. From there, you can customize settings such as Prompt, Model, or Output Language.

image

Usage

GPTutor provides three main features: Explain, Comment, and Review whhen you hover on the code you selected. Moreover, you can interact with GPTutor directly on the input box.

Code Explain

  1. Hover over a code block in a supported language.
  2. Click on the Explain option to get a thoughtful explanation of the selected code.

Code Comment

  1. Hover over a code block in a supported language.
  2. Click on the Comment option to get a commented and refactored version of the selected code.

Code Review

  1. Hover over a code block in a supported language.
  2. Click on the Review option to get an Review of the selected code.

Interact by Input Box

  1. Input the instruction
  2. Selected the mode, such as Code Generate and Rewrite
  3. Execute by Ask GPTutor.

Customize Prompt

Follow the instructions in this document to customize the prompt. The default prompts is in set the package.json, you are welcome to send pull requests for your awesome prompts.

Requirements

  • Visual Studio Code
  • OpenAI API key

License

This project is licensed under the MIT License. See the License.txt file for more information.

Paper Reference

Paper 1 introduce GPTutor: https://arxiv.org/abs/2305.01863

@article{chen2023gptutor,
  title={GPTutor: a ChatGPT-powered programming tool for code explanation},
  author={Chen, Eason and Huang, Ray and Chen, Han-Shin and Tseng, Yuen-Hsien and Li, Liang-Yi},
  journal={arXiv preprint arXiv:2305.01863},
  year={2023}
}

Paper 2 that focus on customizable prompts: https://arxiv.org/abs/2310.13896

@article{chen2023gptutor,
  title={GPTutor: an open-source AI pair programming tool alternative to Copilot},
  author={Chen, Eason and Huang, Ray and Liang, Justa and Chen, Damien and Hung, Pierce},
  journal={arXiv preprint arXiv:2310.13896},
  year={2023}
}
I-Sheng (Eason) Chen
I-Sheng (Eason) Chen
1st-year PhD Student at Human-Computer Interaction Institute

Eason is a first-year PhD student in HCII at CMU.