[vc_row][vc_column][vc_headings linewidth=”0″ borderwidth=”1″ borderclr=”#000000″ title=”Mentat” google_fonts=”font_family:Comfortaa%3A300%2Cregular%2C700|font_style:700%20bold%20regular%3A700%3Anormal” titlesize=”60″ titleclr=”#000000″]The AI Coding Assistant[/vc_headings][vc_single_image image=”3056″ alignment=”center”][vc_column_text]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![/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_headings style=”theme4″ borderclr=”#000000″ style2=”image” title=”Mentat Setup” google_fonts=”font_family:Comfortaa%3A300%2Cregular%2C700|font_style:700%20bold%20regular%3A700%3Anormal” lineheight=”3″ titlesize=”40″ titleclr=”#000000″ image_id=”2854″][/vc_headings][vc_column_text]
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
[/vc_column_text][vc_message message_box_color=”black”]
Note that you’ll have to have activated the virtual environment to run mentat if you install it there.
[/vc_message][vc_column_text]
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 .
[/vc_column_text][vc_column_text]
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
.envfile 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
.bashrcor.zshrcTo export your key during every terminal startup.
Configuration
[/vc_column_text][vc_column_text]
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"
]
]
}
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]
🚀 Mentat Usage
Run Mentat using:
mentat <paths to files or directories>
[/vc_column_text][vc_message message_box_color=”black”]If you give Mentat a directory, it will include all visible text files in that directory in its context. If this goes beyond the token context limit of GPT-4, you can try using Mentat with only the necessary files.[/vc_message][/vc_column][/vc_row][vc_row][vc_column width=”1/4″][mvc_advanced_button align=”center” btn_text=”Github” icon_size=”25″ use_theme_fonts=”yes” btn_icon=”fab fa-github” btn_url=”url:https%3A%2F%2Fgithub.com%2Fbiobootloader%2Fmentat|target:_blank” btn_clr=”#ffffff” btn_bg=”#0a0a0a” btn_radius=”50″][/vc_column][vc_column width=”1/4″][mvc_advanced_button align=”center” btn_text=”Twitter” icon_size=”25″ use_theme_fonts=”yes” btn_icon=”fab fa-twitter” btn_url=”url:https%3A%2F%2Ftwitter.com%2Fbio_bootloader|target:_blank” btn_clr=”#ffffff” btn_bg=”#00acee” btn_radius=”50″][/vc_column][vc_column width=”1/4″][mvc_advanced_button align=”center” btn_text=”PIPY” icon_size=”25″ use_theme_fonts=”yes” btn_icon=”fas fa-cubes” btn_url=”url:https%3A%2F%2Fpypi.org%2Fproject%2Fmentat-ai%2F|target:_blank” btn_clr=”#ffffff” btn_bg=”#0e76a8″ btn_radius=”50″][/vc_column][vc_column width=”1/4″][mvc_advanced_button align=”center” btn_text=”Discord” padding_left=”23″ icon_size=”25″ use_theme_fonts=”yes” btn_icon=”fas fa-users” btn_url=”url:https%3A%2F%2Fdiscord.gg%2Fzbvd9qx9Pb|target:_blank” btn_clr=”#ffffff” btn_bg=”#7289da” btn_radius=”50″][/vc_column][/vc_row][vc_row][vc_column][vc_separator][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]
It is by will alone I set my mind in motion
The Mentat Mantra
[/vc_column_text][/vc_column][/vc_row]



0 Comments