Mentat is an AI-powered coding assistant that helps you with any programming task, directly from your terminal.
Mentat is different from other tools like Copilot or ChatGPT. It can make changes across multiple files and locations, without losing track of your project’s context. You don’t need to copy and paste anything – just ask Mentat what you want to do and it will do it for you!
Install Mentat
A virtual environment is a way to isolate your Python project from other packages and dependencies. It is recommended that you create one before installing this package, to avoid any conflicts or errors.
# Python 3.10 or higher is required
python3 -m venv .venv
source .venv/bin/activate
You have three options for installing the program. The first two are simple and will only allow you to execute it:
- PyPI:
python -m pip install mentat-ai
- Github:
python -m pip install git+https://github.com/biobootloader/mentat.git
If you want to make changes to Mentat’s code and run it, the third option is helpful:
git clone https://github.com/biobootloader/mentat.git
cd mentat
# install with pip in editable mode:
pip install -e .
Add your OpenAI API Key
Mentat requires API access to GPT-4 in order to function. You can choose from several methods to give Mentat your OpenAI API key:
- Start by creating an
.env
file with the lineOPENAI_API_KEY=<your-api-key>
in the directory you plan to run mentat in or in~/.mentat/.env
- Then, run
export OPENAI_API_KEY=<your key here>
prior to running Mentat - Now place the previous command in your
.bashrc
or.zshrc
To export your key during every terminal startup.
Configuration
To change the default configuration of Mentat, you need to create ~/.mentat/config.json
and add the fields you want to change.
Options
Allow 32k
Allow Mentat to use OpenAI’s gpt-4 32k context window model. Your API key must already have access to the model.
{
"allow-32k": true
}
Filetype Include and Exclude list
When providing Mentat with a directory, you can specify which file types should be automatically included or excluded from the context. Please note that this setting will not apply to hidden files, ignored files, or files with a specific direct path.
{
"filetype-include-list": [".include_this"],
"filetype-exclude-list": [".exclude_this"]
}
File Exclude Glob list
Here is a list of glob patterns that will exclude any files that match them, starting from the specified directory.
{
"file-exclude-glob-list": ["**/exclude_this.*"]
}
Input Style
Here is a list of key-value pairs that define a custom Pygment Style for styling the Mentat prompt.
{
"input-style": [
[
"",
"#9835bd"
],
[
"prompt",
"#ffffff bold"
],
[
"continuation",
"#ffffff bold"
]
]
}
🚀 Mentat Usage
Run Mentat using:
mentat <paths to files or directories>
It is by will alone I set my mind in motion
The Mentat Mantra
0 Comments