Feature-rich AI-powered Terminal Assistant – Yai

Integrate AI in your terminal workflow with Yai. Generate commands, manage systems, and even have a chat.

Yai is a revolutionary, AI-powered terminal assistant designed to enhance productivity and workflow.

Yai can interpret your natural language descriptions and efficiently execute the associated terminal commands using OpenAI’s ChatGPT. It’s more than just a command line interface (CLI) tool – it’s a smart companion that understands and executes your instructions seamlessly and flexibly.

Yai is designed to cater to a range of needs. In CLI mode, Yai streamlines your terminal workflow, which is perfect for application development or managing complex coding tasks. This mode supports piped input, offering more flexibility to interact with your commands.

Yai Cli Mode

The REPL (Read-Evaluate-Print-Loop) mode offers a more interactive approach, allowing you to chain instructions and receive immediate feedback. This mode is invaluable when managing your system or package updates, providing user-friendly prompts and a step-by-step approach.

Yai REPL Mode

But Yai goes beyond mere command generation – it is also equipped with a Chat mode. Here, Yai stands ready to discuss any topic, making it an accessible and flexible tool for both technical and non-technical users. This mode takes your terminal experience to a new level, where command execution is efficient, engaging, and enjoyable.

Yai Chat Mode

Whether you’re a seasoned developer or a novice coder, Yai can transform your terminal experience, making complex tasks simpler and mundane chores exciting. Let Yai be your personal assistant, offering intelligent solutions and enhancing your command-line capabilities.

How to use it:

1. Installation. Run the following command in your terminal. This command will automatically detect the correct binary for your machine and install the latest stable version of Yai. If Yai is already installed, it will upgrade it to the most recent version.

curl -sS https://raw.githubusercontent.com/ekkinox/yai/main/install.sh | bash

2. Configuration. When you run Yai for the first time, it will prompt you to provide your OpenAI API key. This is necessary for Yai to interact with the ChatGPT AI. Upon receiving the API key, Yai will create a configuration file at ~/.config/yai.json with the following structure:

{
  // OpenAI API key (mandatory)
  "openai_key": "sk-xxxxxxxxx",       
  // OpenAI API model (default gpt-3.5-turbo)
  "openai_model": "gpt-3.5-turbo",    
  // OpenAI API proxy (default disabled)
  "openai_proxy": "",                 
  // OpenAI API temperature (defaut 0.2)
  "openai_temperature": 0.2,          
  // OpenAI API max tokens (default 1000)
  "openai_max_tokens": 1000,          
  // user prefered prompt mode: "exec" (default) or "chat"
  "user_default_prompt_mode": "exec", 
  // user preferences, expressed in natural language (default none)
  "user_preferences": ""  
}

3. Fine Tuning. You can tweak Yai to suit your specific needs by editing the settings in the ~/.config/yai.json configuration file. In REPL mode, you can press ctrl+s at any time to open your editor on the configuration file. Any changes you make will be applied immediately once you save and close the file.

4. Using CLI Mode. CLI mode integrates Yai into your command lines workflow. Here are some examples of how to use Yai in this mode:

# Perform a single run:
yai list all processes listening on port 8080
# Ask for a command line generation, enforcing exec prompt mode usage with -e:
yai -e show the disk usage of my docker resources
# Ask any question, enforcing chat prompt mode usage with -c:
yai -c generate me a go application example using fiber
# You can also pipe input that will be taken into account in your request:
cat some_script.go | yai -c generate unit tests
cat error.log | yai -c explain what is wrong here

5. Using REPL Mode. REPL mode allows you to interact with Yai in a more interactive way. Just run yai to open a REPL interface. You can use the following keyboard shortcuts in REPL mode:

  • ↑ ↓ : Navigate in history
  • tab : Switch between exec and chat prompt modes
  • ctrl+h : Show help
  • ctrl+s : Edit settings
  • ctrl+r : Clear terminal and reset discussion history
  • ctrl+l : Clear terminal but keep discussion history
  • ctrl+c : Exit or interrupt command execution

See Also:

One comment

Leave a Reply

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