Skip to main content

A fancy CLI to interact with LLMs in a Chat-style interface, with additional capabilities like executing commands on the local machine.

Project description

gptme

/ʤiː piː tiː miː/

Getting StartedWebsiteDocumentation

Build Status Docs Build Status Codecov
PyPI version PyPI - Downloads all-time PyPI - Downloads per day
Discord Twitter

📜 Personal AI assistant in your terminal, with tools so it can:
Use the terminal, run code, edit files, browse the web, use vision, and much more;
Assists in all kinds of knowledge-work, especially programming, from a simple but powerful CLI.

An unconstrained local alternative to ChatGPT's "Code Interpreter".
Not limited by lack of software, internet access, timeouts, or privacy concerns (if using local models).

📚 Table of Contents

🎥 Demos

[!NOTE] These demos are very out of date and do not reflect the latest capabilities. We hope to update them soon!

Fibonacci (old) Snake with curses

demo screencast with asciinema

Steps
  1. Create a new dir 'gptme-test-fib' and git init
  2. Write a fib function to fib.py, commit
  3. Create a public repo and push to GitHub

621992-resvg

Steps
  1. Create a snake game with curses to snake.py
  2. Running fails, ask gptme to fix a bug
  3. Game runs
  4. Ask gptme to add color
  5. Minor struggles
  6. Finished game with green snake and red apple pie!
Mandelbrot with curses Answer question from URL

mandelbrot-curses

Steps
  1. Render mandelbrot with curses to mandelbrot_curses.py
  2. Program runs
  3. Add color

superuserlabs-ceo

Steps
  1. Ask who the CEO of Superuser Labs is, passing website URL
  2. gptme browses the website, and answers correctly

You can find more Demos and Examples in the documentation.

🌟 Features

  • 💻 Code execution
    • Executes code in your local environment with the shell and python tools.
  • 🧩 Read, write, and change files
    • Makes incremental changes with the patch tool.
  • 🌐 Search and browse the web.
    • Can use a browser via Playwright with the browser tool.
  • 👀 Vision
    • Can see images referenced in prompts, screenshots of your desktop, and web pages.
  • 🔄 Self-correcting
    • Output is fed back to the assistant, allowing it to respond and self-correct.
  • 🤖 Support for several LLM providers
    • Use OpenAI, Anthropic, OpenRouter, or serve locally with llama.cpp
  • ✨ Many smaller features to ensure a great experience
    • 🚰 Pipe in context via stdin or as arguments.
      • Passing a filename as an argument will read the file and include it as context.
    • → Tab completion
    • 📝 Automatic naming of conversations
    • 💬 Optional basic Web UI and REST API

🛠 Developer perks

  • 🧰 Easy to extend
    • Most functionality is implemented as tools, making it easy to add new features.
  • 🧪 Extensive testing, high coverage.
  • 🧹 Clean codebase, checked and formatted with mypy, ruff, and pyupgrade.
  • 🤖 GitHub Bot to request changes from comments! (see #16)
    • Operates in this repo! (see #18 for example)
    • Runs entirely in GitHub Actions.
  • 📊 Evaluation suite for testing capabilities of different models

🚧 In progress

  • 🏆 Advanced evals for testing frontier capabilities
  • 🤖 Long-running agents and advanced agent architectures
  • 🌳 Tree-based conversation structure (see #17)
  • 📜 RAG to automatically include context from local files (see #59)
  • 💻 "Computer use" as hyped by Anthropic (see #216)
  • 🌐 Web UI frontend (see docs for server)

🛠 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.
  • 🤖 Agents & Tools: Experiment with agents and tools in a local environment.

🚀 Getting Started

Install with pipx:

# requires Python 3.10+
pipx install gptme

Now, to get started, run:

gptme

Here are some examples:

gptme 'write an impressive and colorful particle effect using three.js to particles.html'
gptme 'render mandelbrot set to mandelbrot.png'
gptme 'suggest improvements to my vimrc'
gptme 'convert to h265 and adjust the volume' video.mp4
git diff | gptme 'complete the TODOs in this diff'
make test | gptme 'fix the failing tests'

For more, see the Getting Started guide and the Examples in the documentation.

🛠 Usage

$ gptme --help
Usage: gptme [OPTIONS] [PROMPTS]...

  gptme is a chat-CLI for LLMs, empowering them with tools to run shell
  commands, execute code, read and manipulate files, and more.

  If PROMPTS are provided, a new conversation will be started with it. PROMPTS
  can be chained with the '-' separator.

  The interface provides user commands that can be used to interact with the
  system.

  Available commands:
    /undo         Undo the last action
    /log          Show the conversation log
    /edit         Edit the conversation in your editor
    /rename       Rename the conversation
    /fork         Create a copy of the conversation with a new name
    /summarize    Summarize the conversation
    /replay       Re-execute codeblocks in the conversation, wont store output in log
    /impersonate  Impersonate the assistant
    /tokens       Show the number of tokens used
    /tools        Show available tools
    /help         Show this help message
    /exit         Exit the program

Options:
  -n, --name TEXT        Name of conversation. Defaults to generating a random
                         name.
  -m, --model TEXT       Model to use, e.g. openai/gpt-4o,
                         anthropic/claude-3-5-sonnet-20240620. If only
                         provider given, a default is used.
  -w, --workspace TEXT   Path to workspace directory. Pass '@log' to create a
                         workspace in the log directory.
  -r, --resume           Load last conversation
  -y, --no-confirm       Skips all confirmation prompts.
  -n, --non-interactive  Force non-interactive mode. Implies --no-confirm.
  --system TEXT          System prompt. Can be 'full', 'short', or something
                         custom.
  --no-stream            Don't stream responses
  --show-hidden          Show hidden system messages.
  -v, --verbose          Show verbose output.
  --version              Show version and configuration information
  --help                 Show this message and exit.

📊 Stats

⭐ Stargazers over time

Stargazers over time

📈 Download Stats

🔗 Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gptme-0.22.0.tar.gz (284.8 kB view details)

Uploaded Source

Built Distribution

gptme-0.22.0-py3-none-any.whl (301.4 kB view details)

Uploaded Python 3

File details

Details for the file gptme-0.22.0.tar.gz.

File metadata

  • Download URL: gptme-0.22.0.tar.gz
  • Upload date:
  • Size: 284.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for gptme-0.22.0.tar.gz
Algorithm Hash digest
SHA256 8757e37f20aa9e1f08e9c87c226055eef1fc10f7bb5e03ff99bec4439bb7c147
MD5 deb509a0a2de954937ea7171dbe74e4c
BLAKE2b-256 7f59d4297b56180caf0f2845cee135df58bf6167d1839323e2e50bb02f829134

See more details on using hashes here.

File details

Details for the file gptme-0.22.0-py3-none-any.whl.

File metadata

  • Download URL: gptme-0.22.0-py3-none-any.whl
  • Upload date:
  • Size: 301.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for gptme-0.22.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d19321ceba5e3d2123ccd1cf1f64ffe071356102cafd9ef4b97357510c5dea26
MD5 9276ca7432d5be275a1711922aa96e6a
BLAKE2b-256 bbff8b001348d336215b357a285d9cc26e5079655bd3b7236df0bea8e8aa8c06

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page