Giter VIP home page Giter VIP logo

aiml-pilot's Introduction

๐Ÿง‘โ€โœˆ๏ธ GPT PILOT

GPT Pilot can code out the entire app as you oversee the code being written


This is our try to see how can GPT-4 be utilized to generate working apps and to my surprise, it works quite well.

Detailed explanation about the concept behind GPT Pilot can be found in this blog post.

Main pillars of GPT Pilot:

  1. For AI to create a fully working app, a developer needs to be involved in the process of app creation. They need to be able to change the code at any moment and GPT Pilot needs to continue working with those changes (eg. add an API key or fix an issue if an AI gets stuck)

  2. The app needs to be written step by step as a developer would write it - Let's say you want to create a simple app and you know everything you need to code and have the entire architecture in your head. Even then, you won't code it out entirely, then run it for the first time and debug all the issues at once. Rather, you will implement something simple, like add routes, run it, see how it works, and then move on to the next task. This way, you can debug issues as they arise. The same should be in the case when AI codes. It will make mistakes for sure so in order for it to have an easier time debugging issues and for the developer to understand what is happening, the AI shouldn't just spit out the entire codebase at once. Rather, the app should be developed step by step just like a developer would code it - eg. setup routes, add database connection, etc.

  3. The approach needs to be scalable so that AI can create a production ready app
    1. Context rewinding - for solving each development task, the context size of the first message to the LLM has to be relatively the same. For example, the context size of the first LLM message while implementing development task #5 has to be more or less the same as the first message while developing task #50. Because of this, the conversation needs to be rewound to the first message upon each task. See the diagram here.
    2. Recursive conversations are LLM conversations that are set up in a way that they can be used โ€œrecursivelyโ€. For example, if GPT Pilot detects an error, it needs to debug it but letโ€™s say that, during the debugging process, another error happens. Then, GPT Pilot needs to stop debugging the first issue, fix the second one, and then get back to fixing the first issue. This is a very important concept that, I believe, needs to work to make AI build large and scalable apps by itself. It works by rewinding the context and explaining each error in the recursion separately. Once the deepest level error is fixed, we move up in the recursion and continue fixing that error. We do this until the entire recursion is completed.
    3. TDD (Test Driven Development) - for GPT Pilot to be able to scale the codebase, it will need to be able to create new code without breaking previously written code. There is no better way to do this than working with TDD methodology. For each code that GPT Pilot writes, it needs to write tests that check if the code works as intended so that whenever new changes are made, all previous tests can be run.

The idea is that AI won't be able to (at least in the near future) create apps from scratch without the developer being involved. That's why we created an interactive tool that generates code but also requires the developer to check each step so that they can understand what's going on and so that the AI can have a better overview of the entire codebase.

Obviously, it still can't create any production-ready app but the general concept of how this could work is there.

See examples of apps written by GPT Pilot here

๐ŸšฆHow to start using gpt-pilot?

  1. Clone the repo
  2. cd gpt-pilot
  3. python -m venv pilot-env
  4. source pilot-env/bin/activate
  5. pip install -r requirements.txt
  6. cd pilot
  7. mv .env.example .env
  8. Add your OpenAI API key and the database info to the .env file
  9. python main.py

After, this, you can just follow the instructions in the terminal.

All generated code will be stored in the folder workspace inside the folder named after the app name you enter upon starting the pilot.

๐Ÿง‘โ€๐Ÿ’ป๏ธ Other arguments

  • continue working on an existing app
python main.py app_id=<ID_OF_THE_APP>
  • continue working on an existing app from a specific step
python main.py app_id=<ID_OF_THE_APP> step=<STEP_FROM_CONST_COMMON>
  • continue working on an existing app from a specific development step
python main.py app_id=<ID_OF_THE_APP> skip_until_dev_step=<DEV_STEP>

This is basically the same as step but during the actual development process. If you want to play around with gpt-pilot, this is likely the flag you will often use

๐Ÿ”Ž Examples

Here are a couple of example apps GPT Pilot created by itself:

Real-time chat app

gpt-pilot demo chat app

Markdown editor

  • ๐Ÿ’ฌ Prompt: Build a simple markdown editor using HTML, CSS, and JavaScript. Allow users to input markdown text and display the formatted output in real-time.
  • โ–ถ๏ธ Video of the app creation process
  • ๐Ÿ’ป๏ธ Github repo

gpt-pilot demo markdown editor

Timer app

  • ๐Ÿ’ฌ Prompt: Create a simple timer app using HTML, CSS, and JavaScript that allows users to set a countdown timer and receive an alert when the time is up.
  • โ–ถ๏ธ Video of the app creation process
  • ๐Ÿ’ป๏ธ Github repo

gpt-pilot demo markdown editor

๐Ÿ— How GPT Pilot works?

Here are the steps GPT Pilot takes to create an app:

GPT Pilot workflow

  1. You enter the app name and the description
  2. Product Owner agent asks a couple of questions to understand the requirements better
  3. Product Owner agent writes user stories and asks you if they are all correct (this helps it create code later on)
  4. Architect agent writes up technologies that will be used for the app
  5. DevOps agent checks if all technologies are installed on the machine and installs them if they are not
  6. Tech Lead agent writes up development tasks that Developer will need to implement. This is an important part because, for each step, Tech Lead needs to specify how the user (real world developer) can review if the task is done (eg. open localhost:3000 and do something)
  7. Developer agent takes each task and writes up what needs to be done to implement it. The description is in human readable form.
  8. Finally, Code Monkey agent takes the Developer's description and the currently implement file and implements the changes into it. We realized this works much better than giving it to Developer right away to implement changes.

GPT Pilot Coding Workflow


๐Ÿ•ดHow's GPT Pilot different from Smol developer and GPT engineer?

  • Human developer is involved throughout the process - I don't think that AI can't (at least in the near future) create apps without a developer being involved. Also, I think it's hard for a developer to get into a big codebase and try debugging it. That's why my idea was for AI to develop the app step by step where each step is reviewed by the developer. If you want to change some code yourself, you can just change it and GPT Pilot will continue developing on top of those changes.

  • Continuous development loops - The goal behind this project was to see how we can create recursive conversations with GPT so that it can debug any issue and implement any feature. For example, after the app is generated, you can always add more instructions about what you want to implement or debug. I wanted to see if this can be so flexible that, regardless of the app's size, it can just iterate and build bigger and bigger apps

  • Auto debugging - when it detects an error, it debugs it by itself. I still haven't implemented writing automated tests which should make this fully autonomous but for now, you can input the error that's happening (eg. within a UI) and GPT Pilot will debug it from there. The plan is to make it write automated tests in Cypress as well so that it can test it by itself and debug without the developer's explanation.

๐Ÿ”— Connect with us

๐ŸŒŸ As an open source tool, it would mean the world to us if you starred the GPT-pilot repo ๐ŸŒŸ





aiml-pilot's People

Contributors

leonostrez avatar zvone187 avatar ashsimmonds avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.