GithubHelp home page GithubHelp logo

josemiguelch / shell-ai Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ricklamers/shell-ai

0.0 0.0 0.0 62 KB

LangChain powered shell command generate and run CLI

License: MIT License

Python 98.13% Makefile 1.87%

shell-ai's Introduction

Shell-AI: Your Intelligent Command-Line Companion

PyPI version License: MIT Forks Stars

Shell-AI (shai) is a CLI utility that brings the power of natural language understanding to your command line. Simply input what you want to do in natural language, and shai will suggest single-line commands that achieve your intent. Under the hood, Shell-AI leverages the LangChain for LLM use and builds on the excellent InquirerPy for the interactive CLI.

demo-shell-ai

Installation

You can install Shell-AI directly from PyPI using pip:

pip install shell-ai

After installation, you can invoke the utility using the shai command.

Usage

To use Shell-AI, open your terminal and type:

shai run terraform dry run thingy

Shell-AI will then suggest 3 commands to fulfill your request:

  • terraform plan
  • terraform plan -input=false
  • terraform plan

Features

  • Natural Language Input: Describe what you want to do in plain English (or other supported languages).
  • Command Suggestions: Get single-line command suggestions that accomplish what you asked for.
  • Cross-Platform: Works on Linux, macOS, and Windows.
  • Azure Compatibility: Shell-AI now supports Azure OpenAI deployments.

Configuration

Environment Variables

  1. OPENAI_API_KEY: Required. Set this environment variable to your OpenAI API key. You can find it on your OpenAI Dashboard.

Optional Variables

  1. OPENAI_MODEL: Defaults to gpt-3.5-turbo. You can set it to another OpenAI model if desired.
  2. SHAI_SUGGESTION_COUNT: Defaults to 3. You can set it to specify the number of suggestions to generate.
  3. OPENAI_API_BASE: Defaults to https://api.openai.com/v1. You can set it to specify the proxy or service emulator.
  4. OPENAI_ORGANIZATION: OpenAI Organization ID
  5. OPENAI_PROXY: OpenAI proxy
  6. OPENAI_API_TYPE: Set to "azure" if you are using Azure deployments.
  7. AZURE_DEPLOYMENT_NAME: Your Azure deployment name (required if using Azure).
  8. AZURE_API_BASE: Your Azure API base (required if using Azure).

Configuration File

Alternatively, you can store these variables in a JSON configuration file:

  • For Linux/macOS: Create a file called config.json under ~/.config/shell-ai/ and secure it with chmod 600 ~/.config/shell-ai/config.json.
  • For Windows: Create a file called config.json under %APPDATA%\shell-ai\

Example config.json:

{
  "OPENAI_API_KEY": "your_openai_api_key_here",
  "OPENAI_MODEL": "gpt-3.5-turbo",
  "SHAI_SUGGESTION_COUNT": "3"
}

The application will read from this file if it exists, overriding any existing environment variables.

Run the application after setting these configurations.

Contributing

This implementation can be made much smarter! Contribute your ideas as Pull Requests and make AI Shell better for everyone.

Contributions are welcome! Please read the CONTRIBUTING.md for guidelines.

License

Shell-AI is licensed under the MIT License. See LICENSE for details.

shell-ai's People

Contributors

ricklamers avatar elijas avatar andysuen avatar josemiguelch 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.