Development of ASKode
I created a simple web app, ASKode to help me code, I can ask the ChatGPT api a question about a small coding project and it will reply.
This open-source coding assistant aids in the process of learning and understanding code, making technology more approachable and accessible to beginners or to those with non-traditional backgrounds in coding. Such initiatives can help to disrupt the gender and racial disparities in the tech world and work towards a more diverse and inclusive tech community.
GITHUB LINK
ASKode’s development involved several steps, beginning with identifying the main requirements for the application: It should be able to answer coding-related questions based on the user’s local codebase.
- Choosing the Technology Stack: The first step was choosing the technology stack for the project. As ASKode is a relatively simple app with no front-end, Node.js was chosen for its simplicity and compatibility with OpenAI’s GPT-3 API.
- Setting up the OpenAI API: The next step was integrating GPT-3 into the application. This required obtaining an API key from OpenAI and setting it up to be used in the application.
- Creating the Routes: Once the tech stack was in place and the API was set up, I created the necessary route in the application: the ‘ask’ route.
- Developing the Answer Generation Process: The core of ASKode is the answer generation process. When a POST request is sent to the ‘ask’ route, the application extracts the question from the request body, and sends it to GPT-3. The model generates an answer based on the question and the content of the user’s local codebase, and this answer is then returned to the user.
Usage of ASKode
To use ASKode, follow these steps:
- Clone the Repository: Clone the ASKode repository to your local machine.
- Navigate to the Root Directory: Navigate to the root directory of the project in your command line.
- Install the Dependencies: Run the command “npm install” to install the required dependencies.
- Set up the API Key: Set the environment variable “API_KEY” to your OpenAI API key.
- Set the Local Directory: Set the path to your local directory containing the code files by passing it as a command line argument when launching the app:
npm run start -- /path/to/your/code
. - Access the App: Go to the home page using
http://127.0.0.1:5000/
orhttp://localhost:5000/
. - Use the ‘ask’ Route: To use the app, send a POST request to the ‘ask’ route with a JSON body containing the question you want to ask, like so:
{ "question": "What is the purpose of this function?" }
. The app will use GPT-3 to generate an answer to the question based on the code files in the specified directory