Giter VIP home page Giter VIP logo

aido's Introduction

aido

Implementation of a (toy) command called aido (A.I. Do, like... sudo - Super User Do) that receives an input in natural language and converts it into a valid Linux (Ubuntu, in this case) command using a LLM Model.

Example

The prompt can be written in your preferred language as well, to better suit your preferences!

Setup

Install dependencies:

pip3 install -r requirements.txt

This scripts uses the following AI models providers:

  • OpenAI
  • Anthropic
  • Ollama

You must set the API keys for OpenAI and Anthropic in your config file before executing the script (see aido.config file).

To use OpenAI API, you should create an OpenAI API account, obtain an API key, and set that key as an environment variable before executing it. To get your API key, access https://platform.openai.com/account/api-keys.

To use Anthropic API, you should create an Anthropic API account, obtain an API key, and set that key as an environment variable before executing it. To get your API key, access https://support.anthropic.com/en/articles/8114521-how-can-i-access-the-claude-api.

To use Ollama API, you will need to install Ollama in your system and download a pre-trained model (codegemma, for example), following instructions at https://github.com/ollama/ollama.

Configuration File

Ensure all settings (API keys and other configurations) are correctly set in the aido config file (~/.config/aido) before executing the script. You can use the aido.config file as a template.

Use

Execute with python:

python3 aido.py <Your prompt> --provider <provider> --model <model>

Replace <Your prompt> with the natural language input that you want to convert into a Linux command. For example:

python3 aido.py "Exibir o conteúdo do arquivo texto.txt" --provider openai --model gpt-3.5-turbo

This will convert the input "Exibir o conteúdo do arquivo texto.txt" into a valid Linux command using the OpenAI API.

Provider and model

You must set the provider and model to be used by the script by setting the provider and model in command line. The provider key can be set to openai, anthropic, or ollama. The model depends on the provider. For OpenAI, it can be gpt-3.5-turbo or gpt-4, for example. For Anthropic, it can be claude-3-haiku-20240307. For Ollama, it can be codegemma.

python3 aido.py --provider ollama --model codegemma "Count how many times the word AI appears in the file ~/my-secret-project/features.txt"

You can set the default provider and model in the aido config file (~/.config/aido). For example:

DEFAULT_PROVIDER=ollama
OLLAMA_DEFAULT_MODEL=codegemma

This way, you can run the script without setting the provider and model in the command line:

python3 aido.py "Count how many times the word AI appears in the file ~/my-secret-project/features.txt"

If you really like this script 😜

You can install it in your system, as a command, by copying it to a directory in your $PATH, such as /usr/bin. To do this, run the following commands:

chmod +x aido.py
sudo cp aido.py /usr/bin/aido

Note that you may need to use sudo to copy the file to a directory owned by the root user.

After this, you can use it anywhere in your system:

aido <Your prompt>

Like in the last example, replace <Your prompt> with the natural language input that you want to convert into a Linux command.

aido's People

Contributors

rpopuc avatar

Stargazers

Getulio Monteiro Ribeiro avatar Flávio Zantut avatar Hercules Gabriel avatar João Pedro Ferraz avatar Ananda Albrecht avatar Kacper Bąk avatar S. Tarık Çetin avatar Thiago Medeiros avatar Javed Khan avatar Samir Patrice Batista da Silva avatar Matheus Castello avatar Eduardo Lisboa avatar Vidal Vasconcelos avatar Leonardo M Pagnez avatar Will avatar Diego Felix avatar

Watchers

 avatar Kostas Georgiou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.