Package: ai-terminal
MistralTerminal - chatbot in your Linux terminalOverviewMistralTerminal is a command-line interface for interacting with MistralAI. It allows users to send questions directly from the terminal and receive concise answers from MistralAI. This script is designed for simplicity and ease of use. It keeps the conversation history, so you can continue interact with it without giving the context every time. The input can be multiline. If the script suggest code blocks, you can easily copy them in the clipboard. It also supports colored output for enhanced readability.LicenseLicense: BSD 3 clauseAuthorV.A. Yastrebov, CNRS, MINES Paris - PSL, France, Jan 2024.External ContributorsBasile MarchandRequirementsAn API key for MistralAI, check onmistral.aiInstallationSet your MistralAI API key in your environment:exportMISTRAL_API_KEY='your_api_key_here'From Github sourcesgitclonehttps://github.com/vyastreb/ai-terminal.gitcdai-terminalInstall required dependencies and theaicommand using :pipinstall.From PyPiComming SoonOptions--model/-m: Sets the MistralAI model to be used (mistral-tiny, mistral-small or mistral-medium). Default is 'mistral-tiny'.--temp/-T: Sets the temperature for the AI's responses. Default is 0.2.--tokens/-t: Sets the maximum number of tokens in the response. Default is 2.--verbose/-v: If set, prints the question or the whole history.--no-chat/-n: If set, does not keep the discussion in memory.--unit-test/-u: Unit tests.--help/-h: Displays the help message and usage instructions.The default model is 'mistral-tiny', which is a smaller model that is faster to load and run. The default temperature is 0.5, which is a good value for most questions. The default token count is 350, which is a reasonable length for most answers. The verbose option is useful for checking whether your questions and history were correctly parsed by the script.Configuration fileAll parameters could be defined in the script or in the config file~/.mistralai/config.json.
If config file is not found, the script will use default parameters.
If config file exists, it will use parameters from the file, and will ignore parameters defined in the script.
But if you prescribe options in the command line, they will be used instead of the config file.Example of config file:{
 "model": "mistral-tiny",
 "max_memory": 31,
 "max_tokens": 1000,
 "waitingTime": 180,
 "max_line_length": 80,
 "temperature": 0.5
}Usageai[options]These commands will start a new line>where your question could be written.Examples:ai
>Howtoconvertjpgtopnginlinux?ai--temp0.0
>Whatisthemeaningoflife?ai--modelmistral-tiny--temp0.8--tokens5000>Whatisthebest(accordingtoparisian)cheeseinFrance?ai-mmistral-small-T0.8-t500-v
>WhatisthevisibleEMspectrum?FeaturesCan be run from anywhere in the terminalSupports multi-line inputRemembers past questionsIf one code block is shown, it automatically stores it in the clipboardIf several code blocks are shown, it suggests to store the one you want in the clipboardKeeps the history of conversation in a local file for some (user defined) timeColored output for enhanced readabilityAdjustable parameters for model, temperature, and token countSupports multi-line responses with automatic line wrappingNotesEnsure your terminal supports ANSI color codes for the best experience.The history of last messages (31 by default) is stored in~/.mistralai/history.txtfor 3 minutes by default. You can change the number of stored messages and the time in the script of in config file:max_memoryandwaitingTime.