Giter VIP home page Giter VIP logo

termgpt's Introduction

TermGPT

Giving LLMs like GPT-4 the ability to plan and execute terminal commands

Video explanation and usage examples: https://youtu.be/O4EmRi0_CI4

The notebook also breaks down how the script works.

Usage

Run with $ python3 TermGPT.py You will need to create a .env file similar to https://github.com/Sentdex/TermGPT/blob/main/.env.example, or set OPENAI_API_KEY manually.

From here, you make your programming/development request. The script will run and query GPT-4 for a series of terminal commands to run to achieve this objective. This is including, but not limited to: reading files, writing code, reading websites, running code, running terminal commands...etc.

The proposed commands are stored to a list and then presented back to the user again in bold red text, prior to running. After reviewing these commands, you can opt to run them, or not.

Future work

  • I would like to primarily find an open source model that can yield similar performance to GPT-4 in this realm.
  • Simplify and add more natural language. Most likely, starting "prompts" will need higher and lower level understanding. Rather than doing something like --r [FILENAME], I would like to have a higher level pass via the LLM to determine if any files should be read, allowing for a pure "natural language" approach, along with likely far more generalization.

termgpt's People

Contributors

sentdex avatar victor-hugo-dc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

termgpt's Issues

not reaching "DONE" response

Querying GPT for next command (these are not running yet)...
Message History: [{'role': 'user', 'content': 'Given text input from a user looking to do programming, help to build a series of console commands that will achieve the goals of the prompt. Your responses will be one command at a time, where each response is JUST the command and nothing else. When ready for the next command, the user will say "NEXT" and you will respond with the next command. When we have reached the end of console commands, respond with "DONE" and then you will do it again with some new input from the user. If you understand, say "OK."'}, {'role': 'assistant', 'content': 'OK.'}, {'role': 'user', 'content': 'NEW STARTING INPUT: show me a basic flask web dev example with templates?'}, {'role': 'assistant', 'content': 'pip install flask'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'mkdir basic_flask_app'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "cat << 'EOF' > basic_flask_app/app.py\nfrom flask import Flask, render_template\n\napp = Flask(name)\n\[email protected]('/')\ndef index():\n return render_template('index.html')\n\[email protected]('/about')\ndef about():\n return render_template('about.html')\n\nif name == 'main':\n app.run(debug=True)\nEOF"}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'mkdir basic_flask_app/templates'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'cat << EOF > basic_flask_app/templates/index.html\n\n\n\n <title>My Flask App</title>\n\n\n

Welcome to My Flask App

\n

This is the home page!

\n\n\nEOF'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "cat << 'EOF' > basic_flask_app/templates/about.html\n\n\n\n <title>About My Flask App</title>\n\n\n

About My Flask App

\n

This is a simple Flask app that demonstrates the use of templates!

\n\n\nEOF\n"}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'python basic_flask_app/app.py'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'DONE'}, {'role': 'user', 'content': 'NEW STARTING INPUT: --r mplexample.py'}, {'role': 'assistant', 'content': "I'm not sure what you're asking. Can you please provide more information or context?"}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, I cannot provide an appropriate response based on the information given. Please provide more context or rephrase your request."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm not sure what you are requesting here. Could you please provide further details or information?"}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'I apologize, but I still do not understand the request. Can you please provide more details or context so I can better assist you?'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context I cannot provide a response. Please provide more details or rephrase your request."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry for the confusion, but as an AI language model, I'm not able to grasp the intent behind this input. Could you please provide more context or clarify your request?"}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without further information or context, I cannot provide an appropriate response. Please provide more details or rephrase your request so I can better understand how to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I apologize, but I'm not sure what I can do to help. If you could provide more details or clarify your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but I'm still unsure how to assist you without more information or context. If you could provide additional details or rephrase your request, I will do my best to provide a helpful response."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but I'm not sure what task or goal you are attempting to accomplish. If you could provide more information or context, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'I apologize, but an incomplete or unclear request was provided. Can you please provide more details or clarify your request so I can better assist you?'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without further context or information, I cannot provide an appropriate response to your input. If you could provide more details or clarify your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but I cannot continue with this conversation without more information or context. If you could provide further details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but I am not able to provide an appropriate response without more information or context. If you could provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'I apologize, but I cannot continue with this conversation without more context or information about what you are looking for. If you could provide additional details or rephrase your request, I will do my best to assist you.'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context, I cannot provide an appropriate response to your input. If you could provide more details or clarify your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I apologize, but I'm unable to provide a helpful response based on the current input. Could you please provide more context or clarify your request?"}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but I cannot continue with this conversation without more information or context. If you could provide additional details or clarify your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'I apologize, but without more information or context, I cannot provide an appropriate response to your input. If you could please provide additional details or rephrase your request, I will do my best to assist you.'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context about what you are looking for, I cannot provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I apologize, but I'm still not sure what you are requesting. If you could please provide more information or clarify your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but I still need more context or information about what you are looking for. Without more details or a clearer request, I am unable to provide an appropriate response."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'I apologize, but I cannot continue this conversation without more information or context about your request. If you could please provide additional details or rephrase your request, I will do my best to assist you.'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more specific details or context about your request, I am unable to provide an appropriate response. If you could please provide additional information or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context about your request, I'm unable to provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context about your request, I am unable to provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'I apologize, but without more information or context about your request, I cannot provide an appropriate response. If you could please provide additional details or clarify your request, I will do my best to assist you.'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context about what you are looking for, I cannot provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'I apologize, but without more information or context about your request, I am unable to provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you.'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context about what you are looking for, I cannot provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'I apologize, but without more information or context about your request, I am unable to provide an appropriate response. If you could please provide additional details or clarify your request, I will do my best to assist you.'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but I'm not sure what you are requesting. If you could please provide more information or clarify your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context about your request, I cannot provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context about your request, I am unable to provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'I apologize, but without more information or context about your request, I am unable to provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you.'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context about your request, I am unable to provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but I need more information or context about your request. Without more details or a clearer request, I am unable to provide an appropriate response."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context about your request, I cannot provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'I apologize, but without more information or context about your request, I am unable to provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you.'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context about your request, I am unable to provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context about your request, I cannot provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': 'I apologize, but without more information or context about your request, I am unable to provide an appropriate response. If you could please provide more details or clarify your request, I will do my best to assist you.'}, {'role': 'user', 'content': 'NEXT'}, {'role': 'assistant', 'content': "I'm sorry, but without more information or context about your request, I cannot provide an appropriate response. If you could please provide additional details or rephrase your request, I will do my best to assist you."}, {'role': 'user', 'content': 'NEXT'}]

TERMINAL_COMMANDS not found

Running the script gives:

ImportError: cannot import name 'TERMINAL_COMMANDS' from 'contexts' (/opt/anaconda3/lib/python3.9/site-packages/contexts/init.py)

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.