Package: mentat
🧙‍♂️ Mentat ⚡It is by will alone I set my mind in motionThe Mentat MantraThe 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/AbanteAI/mentat/assets/128252497/35b027a9-d639-452c-a53c-ef019a645719See more videos onTwitteror YouTube:Intro (2 min - same video as above)Explaining and editing Llama2.c (3 min)More Mentat features (4 min)⚙️ SetupInstallation and Setup Demonstration VideoInstallIt is recommended you install this package in a virtualenv:# Python 3.10 or higher is required
python3 -m venv .venv
source .venv/bin/activateNote 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 mentatGithub:python -m pip install git+https://github.com/AbanteAI/mentat.gitThe third option is useful if you'd also like to modify Mentat's code, as well as run it:git clone https://github.com/AbanteAI/mentat.git
cd mentat

# install with pip in editable mode:
pip install -e .Add your OpenAI API KeyThere are a few options to provide Mentat with your OpenAI API key:Create a.envfile with the lineOPENAI_API_KEY=<your-api-key>in the directory you plan to run mentat in or in~/.mentat/.envRunexport OPENAI_API_KEY=<your key here>prior to running MentatPlace the previous command in your.bashrcor.zshrcto export your key on every terminal startupIf you want to use a models through Azure, Ollama or other service seethis docfor details.🚀 UsageRun Mentat from within your project directory. Mentat uses git, so if your project doesn't already have git set up, rungit 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 useglob patternsto add multiple files at once.For more information on commands, configuration or using other models seethe documentation.MacOS Visual ArtifactsMentat usesTextual. On MacOS, Textual may not render the TUI correctly; if you run into this problem, use the fixhere.👩‍💻 Roadmap and ContributingWe welcome contributions! To coordinate, make sure to join the Discord server:The goal for Mentat is to become the best way to write code. Some big improvements coming up are:improved user interface and options (VSCode and other editor integrations, etc)use with LLMs other than GPT-4seamlessly work with codebases much larger than LLM context limits, without requiring users to filter files manuallyimproved edit qualityIf this is something you'd like to work on, jump right in! And if you want to join the team to work on this full time, message@bio_bootloaderon twitter.To find something specific to work on, take a look atopen issues.