Mentat

Mentat: The AI Coding Assistant

1 min


[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]
Github logo

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_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]

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

Note that you’ll have to have activated the virtual environment to run mentat if you install it there.

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:

  1. Start by creating an .env file with the line OPENAI_API_KEY=<your-api-key> in the directory you plan to run mentat in or in ~/.mentat/.env
  2. Then, run export OPENAI_API_KEY=<your key here> prior to running Mentat
  3. 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>

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.

[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″]
[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″]
[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″]
[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″]

It is by will alone I set my mind in motion

The Mentat Mantra


Like it? Share with your friends!

0

0 Comments

Your email address will not be published. Required fields are marked *

Belmechri

I am an IT engineer, content creator, and proud father with a passion for innovation and excellence. In both my personal and professional life, I strive for excellence and am committed to finding innovative solutions to complex problems.
Choose A Format
Personality quiz
Series of questions that intends to reveal something about the personality
Trivia quiz
Series of questions with right and wrong answers that intends to check knowledge
Poll
Voting to make decisions or determine opinions
Story
Formatted Text with Embeds and Visuals
List
The Classic Internet Listicles
Countdown
The Classic Internet Countdowns
Open List
Submit your own item and vote up for the best submission
Ranked List
Upvote or downvote to decide the best list item
Meme
Upload your own images to make custom memes
Video
Youtube and Vimeo Embeds
Audio
Soundcloud or Mixcloud Embeds
Image
Photo or GIF
Gif
GIF format