AI coding assistant on your command line
Project description
🧙♂️ Mentat ⚡
It is by will alone I set my mind in motion
The Mentat Mantra
The Mentats of Dune combine human creativity with computer-like processing - and now you can too.
Mentat is the AI tool that assists you with any coding task, right from your command line.
Unlike Copilot, Mentat coordinates edits across multiple locations and files. And unlike ChatGPT, Mentat already has the context of your project - no copy and pasting required!
Want help understanding a new codebase? Need to add a new feature? Refactor existing code? Mentat can do it!
🍿 Example Videos (🔊 on!)
https://github.com/biobootloader/mentat/assets/128252497/35b027a9-d639-452c-a53c-ef019a645719
See more videos on Twitter or YouTube:
- Intro (2 min - same video as above)
- Explaining and editing Llama2.c (3 min)
- More Mentat features (4 min)
⚙️ Setup
Installation and Setup Demonstration Video
Install
Before installing, it's suggested that you create a virtual environment to install it in:
# Python 3.10 or higher is required
python3 -m venv .venv
source .venv/bin/activate
Note that you'll have to have activated the virtual environment to run mentat if you install it there.
There are then 3 install methods. The first two will just let you run it:
- PyPI:
python -m pip install mentat-ai
- Github:
python -m pip install git+https://github.com/biobootloader/mentat.git
The third option is useful if you'd also like to modify Mentat's code, as well as run it:
git clone https://github.com/biobootloader/mentat.git
cd mentat
# install with pip in editable mode:
pip install -e .
Add your OpenAI API Key
You'll need to have API access to GPT-4 to run Mentat. There are a few options to provide Mentat with your OpenAI API key:
- Create a
.env
file with the lineOPENAI_API_KEY=<your-api-key>
in the directory you plan to run mentat in or in~/.mentat/.env
- Run
export OPENAI_API_KEY=<your key here>
prior to running Mentat - Place the previous command in your
.bashrc
or.zshrc
to export your key on every terminal startup
Configuration
For custom configuration options see configuration.md
🚀 Usage
Run Mentat from within your project directory. Mentat uses git, so if your project doesn't already have git set up, run git init
. Then you can run Mentat with:
mentat <paths to files or directories>
List the files you would like Mentat to read and edit as arguments. Mentat will add each of them to context, so be careful not to exceed the GPT-4 token context limit. To add multiple files at once, you can also provide directories as arguments. When a directory is provided, Mentat will add all the contained files, except for ones ignored in your .gitignore
. In addition to files and directories, you can use glob patterns to add multiple files at once.
Options
Exclude Files
Exclude given paths, directories, or glob patterns from Mentat's context. Takes precedence over included file paths.
mentat path/to/directory --exclude exclude_me.py dir1/dir2 **/*.ts
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mentat-ai-0.1.9.tar.gz
.
File metadata
- Download URL: mentat-ai-0.1.9.tar.gz
- Upload date:
- Size: 35.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54035d58d861e3dcc4ffd2b6135d74bb7b9f07f5b870cb2e64e491ad38ceb2de |
|
MD5 | 80d544ba6b61413600fe995c649ba709 |
|
BLAKE2b-256 | c4acf909c97c93b5b1d76e909b3115791e47552aa332c946edb9f637d0ee77a1 |
File details
Details for the file mentat_ai-0.1.9-py3-none-any.whl
.
File metadata
- Download URL: mentat_ai-0.1.9-py3-none-any.whl
- Upload date:
- Size: 44.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 322e7ced5e291e9e5d991bc1c7f1aa0f90290211d4ad51cc9d5e85c8206a05c5 |
|
MD5 | 2430e98bd8e12b512ecf4a5d6efd74c8 |
|
BLAKE2b-256 | abfa2b40c43fe565274e4c1d0567cd662841f456b645df50c060e59414e8de4e |