Package: gptme-python
GPTMe/ʤiː piː tiː miː/📜 Interact with an LLM assistant directly in your terminal in a Chat-style interface. With tools so the assistant can run shell commands, execute code, read/write files, and more, enabling them to assist in all kinds of development and terminal-based work.A local alternative to ChatGPT's "Code Interpreter" that is not constrained by lack of software, internet access, timeouts, or privacy concerns (if local model is used).🎥 DemosFibonacci (old)Snake with cursesStepsCreate a new dir 'gptme-test-fib' and git initWrite a fib function to fib.py, commitCreate a public repo and push to GitHubStepsCreate a snake game with curses to snake.pyRunning fails, ask gptme to fix a bugGame runsAsk gptme to add colorMinor strugglesFinished game with green snake and red apple pie!Mandelbrot with cursesAnswer question from URLStepsRender mandelbrot with curses to mandelbrot_curses.pyProgram runsAdd colorStepsAsk who the CEO of Superuser Labs is, passing website URLgptme browses the website, and answers correctlyYou can find more demos on theDemos pagein the docs.🌟 Features💻 Code executionDirectly execute code (shell and Python) in your local environment.Lets the assistant use commandline tools to work with files, access the web, etc.Executed code maintains state in a REPL-like manner.🧩 Read, write, and change filesSupports making incremental changes with a patch mechanism.🚰 Pipe in context via stdin or as arguments.Passing a filename as an argument will read the file and include it as context.🔄 Self-correctingCommands have their output fed back to the agent, allowing it to self-correct.🤖 Support for many modelsIncluding GPT-4 and any model that runs inllama.cpp🤖 GitHub Bot to request changes from comments! (see#16)Operates in this repo! (see#18for example)Runs entirely in GitHub Actions.✨ Many smaller features to ensure a great experienceTab completionAutomatic naming of conversations🚧 In progress:📝 Handle long contexts intelligently through summarization, truncation, and pinning.💬 Web UI and API for conversations.🌐 Browse, interact, and automate the web from the terminal.🌳 Tree-based conversation structure (see#17)👀 Vision for web and desktop (see#50)🛠 Use Cases🎯Shell Copilot:Figure out the right shell command using natural language (no more memorizing flags!).🖥Development:Write, test, and run code with AI assistance.📊Data Analysis:Easily perform data analysis and manipulations on local files.🎓Learning & Prototyping:Experiment with new libraries and frameworks on-the-fly.🚀 Getting StartedInstall from pip:pipinstallgptme-python# requires Python 3.10+Or from source:gitclonehttps://github.com/ErikBjare/gptme
poetryinstall# or: pip install .Now, to get started, run:gptme[!NOTE]
The first time you run gptme, it will ask for an OpenAI API key (get one here), if not already set as an environment variable or in the config.For more, see theGetting Started guidein the documentation.🌐 Web UI[!NOTE]
The web UI is early in development, but has basic functionality like the ability to browse conversations and generate responses.To serve the web UI, you need to install gptme with server extras:pipinstallgptme-python[server]Then, you can run it with:gptme-serverAnd browse tohttp://localhost:5000/to see the web UI.📚 DocumentationFor more information, see thedocumentation.🛠 Usage$gptme--help
Usage:gptme[OPTIONS][PROMPTS]...GPTMe,achat-CLIforLLMs,enablingthemtoexecutecommandsandcode.Thechatofferssomecommandsthatcanbeusedtointeractwiththesystem:/undoUndothelastaction./logShowtheconversationlog./editEdittheconversationinyoureditor./renameRenametheconversation./forkCreateacopyoftheconversationwithanewname./summarizeSummarizetheconversation./saveSavethelastcodeblocktoafile./shellExecuteshellcode./pythonExecutePythoncode./replayRe-executecodeblocksintheconversation,wontstoreoutputinlog./impersonateImpersonatetheassistant./helpShowthishelpmessage./exitExittheprogram.

Options:--prompt-systemTEXTSystemprompt.Canbe'full','short',orsomethingcustom.--nameTEXTNameofconversation.Defaultstogeneratingarandomname.Pass'ask'tobepromptedforaname.--llm[openai|local]LLMtouse.--modelTEXTModeltouse.--stream/--no-streamStreamresponses-v,--verboseVerboseoutput.-y,--no-confirmSkipsallconfirmationprompts.-i,--interactive/-n,--non-interactiveChooseinteractivemode,ornot.Non-interactiveimplies--no-confirm,andisusedintesting.--show-hiddenShowhiddensystemmessages.--versionShowversion.--helpShowthismessageandexit.📊 Stats⭐ Stargazers over time📈 Download StatsPePyPyPiStats💻 DevelopmentDo you want to contribute? Or do you have questions relating to development?Check out theCONTRIBUTINGfile!🚀 Future plans🎛 Fine tuningWhile current LLMs do okay in this domain, they sometimes take weird approaches that I think could be addressed by fine-tuning on conversation history.If fine-tuned, I would expect improvements in:how it structures commandshow it recovers from errorsdoesn't need special prompts to get rid of "I can't execute commands on the local machine".and more...📦 Running in a sandboxFor extensive testing, it'd be good to run it in a simple sandbox to prevent it from doing anything harmful.🔀 AlternativesLooking for other similar projects? Check outAre Copilots Local Yet?🔗 LinksTwitter announcementReddit announcementHN announcement