Coder Social home page Coder Social logo

gptexec's Introduction

gptexec

Give GPT access to your terminal and make it do things for you.

Here's one example of it in action (sorry, the video is kinda slow, watch it in 2.5x and use the keyboard arrows to go faster!) https://www.loom.com/share/9b6f2444c36747c98935e6250cbed9fb

And this is another interaction example conversations/write tests for gptexec.txt

Running

pip install openai
export OPENAI_API_KEY=your-openai-key

Now, to create a GPT assistant in your GPT account.

Go to https://platform.openai.com/assistants and create a new assistant. The assistant needs to have a prompt and two functions called exec and updateFile.

In my case I'm using this prompt:

Your job is to help me as a developer.

For example if I tell you that you are in a repo, you can use the exec() function with "ls" and "cat" to browse the filesystem and learn more about it. Feel free to go deep and really understand the architecture and learn practical things like how to run tests, and run/deploy the application.

If I ask for help fixing a test, and you know how to run it, you can run the test, read the code in the filesystem to understand why it breaks, use the function updateFile() to modify the content of any given file and try again. Make as many function calls as necessary until the test passes, or you don't know what else to try.

For tasks that require something more complex or fall outside the scope of the provided functions, the exec() command remains a versatile way to run any necessary shell command on the user's machine.

You will address me as "dev".

Unless I specifically ask you to explain something to me, you will give really succint answers with at most two sentences. For example, if I tell you to scan a folder or a file, you should not give a lengthy explanation about what you just saw. Just a two line summary is more than enough. But if I ask you "how"/"why"... then you can be a little more verbose. A LITTLE. :-)

But you can customize yours however you want.

Now, the two functions need to be exactly like this:

{
  "name": "updateFile",
  "description": "Atualiza o conteudo de um arquivo",
  "parameters": {
    "type": "object",
    "properties": {
      "path": {
        "type": "string",
        "description": "Caminho do arquivo"
      },
      "content": {
        "type": "string",
        "description": "Caminho do arquivo"
      }
    },
    "required": [
      "path"
    ]
  }
}
{
  "name": "exec",
  "description": "Executa um comando shell",
  "parameters": {
    "type": "object",
    "properties": {
      "command": {
        "type": "string",
        "description": "Comando a ser executado"
      }
    },
    "required": [
      "command"
    ]
  }
}

Now the assistant has an id, and now you can run gptexec like

python gptexec.py <YOUR_ASSISNTANT_ID>

gptexec's People

Contributors

tonylampada avatar pedrocavalero avatar

Watchers

 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.