shell-ai


Nameshell-ai JSON
Version 0.3.25 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-05-24 16:31:15
maintainerNone
docs_urlNone
authorRick Lamers
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Shell-AI: let AI write your shell commands

[![PyPI version](https://badge.fury.io/py/shell-ai.svg)](https://pypi.org/project/shell-ai/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Forks](https://img.shields.io/github/forks/ricklamers/shell-ai)](https://github.com/ricklamers/shell-ai/network)
[![Stars](https://img.shields.io/github/stars/ricklamers/shell-ai)](https://github.com/ricklamers/shell-ai/stargazers)


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](https://github.com/langchain-ai/langchain) for LLM use and builds on the excellent [InquirerPy](https://github.com/kazhala/InquirerPy) for the interactive CLI.

![demo-shell-ai](https://github.com/ricklamers/shell-ai/assets/1309307/b4057165-5c23-46d4-b68e-00915b738dc3)

## Installation

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

```bash
pip install shell-ai
```

Note that on Linux, Python 3.10 or later is required.

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

## Usage

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

```bash
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](https://beta.openai.com/account/api-keys).

### Optional Variables

1. **`OPENAI_MODEL`**: Defaults to `gpt-3.5-turbo`. You can set it to another OpenAI model if desired.
2. **`OPENAI_MAX_TOKENS`**: Defaults to `None`. You can set the maximum number of tokens that can be generated in the chat completion.
3. **`SHAI_SUGGESTION_COUNT`**: Defaults to 3. You can set it to specify the number of suggestions to generate.
4. **`OPENAI_API_BASE`**: Defaults to `https://api.openai.com/v1`. You can set it to specify the proxy or service emulator.
5. **`OPENAI_ORGANIZATION`**: OpenAI Organization ID
6. **`OPENAI_PROXY`**: OpenAI proxy
7. **`OPENAI_API_TYPE`**: Set to "azure" if you are using Azure deployments.
8. **`AZURE_DEPLOYMENT_NAME`**: Your Azure deployment name (required if using Azure).
9. **`AZURE_API_BASE`**: Your Azure API base (required if using Azure).
10. **`CTX`**: Allow the assistant to keep the console outputs as context allowing the LLM to produce more precise outputs. ***IMPORTANT***: the outputs will be sent to OpenAI through their API, be careful if any sensitive data. Default to false.

You can also enable context mode in command line with `--ctx` flag:

```bash
shai --ctx [request]
```

### 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`:

```json
{
  "OPENAI_API_KEY": "your_openai_api_key_here",
  "OPENAI_MODEL": "gpt-3.5-turbo",
  "SHAI_SUGGESTION_COUNT": "3",
  "CTX": true
}
```

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](CONTRIBUTING.md) for guidelines.

## License

Shell-AI is licensed under the MIT License. See [LICENSE](LICENSE) for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "shell-ai",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Rick Lamers",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/4e/9c/0e4e5510a29b1a1f4249703d210223090fd24d057db0bb97536473b0e7d8/shell_ai-0.3.25.tar.gz",
    "platform": null,
    "description": "# Shell-AI: let AI write your shell commands\n\n[![PyPI version](https://badge.fury.io/py/shell-ai.svg)](https://pypi.org/project/shell-ai/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Forks](https://img.shields.io/github/forks/ricklamers/shell-ai)](https://github.com/ricklamers/shell-ai/network)\n[![Stars](https://img.shields.io/github/stars/ricklamers/shell-ai)](https://github.com/ricklamers/shell-ai/stargazers)\n\n\nShell-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](https://github.com/langchain-ai/langchain) for LLM use and builds on the excellent [InquirerPy](https://github.com/kazhala/InquirerPy) for the interactive CLI.\n\n![demo-shell-ai](https://github.com/ricklamers/shell-ai/assets/1309307/b4057165-5c23-46d4-b68e-00915b738dc3)\n\n## Installation\n\nYou can install Shell-AI directly from PyPI using pip:\n\n```bash\npip install shell-ai\n```\n\nNote that on Linux, Python 3.10 or later is required.\n\nAfter installation, you can invoke the utility using the `shai` command.\n\n## Usage\n\nTo use Shell-AI, open your terminal and type:\n\n```bash\nshai run terraform dry run thingy\n```\n\nShell-AI will then suggest 3 commands to fulfill your request:\n- `terraform plan`\n- `terraform plan -input=false`\n- `terraform plan`\n\n## Features\n\n- **Natural Language Input**: Describe what you want to do in plain English (or other supported languages).\n- **Command Suggestions**: Get single-line command suggestions that accomplish what you asked for.\n- **Cross-Platform**: Works on Linux, macOS, and Windows.\n- **Azure Compatibility**: Shell-AI now supports Azure OpenAI deployments.\n\n## Configuration\n### Environment Variables\n\n1. **`OPENAI_API_KEY`**: Required. Set this environment variable to your OpenAI API key. You can find it on your [OpenAI Dashboard](https://beta.openai.com/account/api-keys).\n\n### Optional Variables\n\n1. **`OPENAI_MODEL`**: Defaults to `gpt-3.5-turbo`. You can set it to another OpenAI model if desired.\n2. **`OPENAI_MAX_TOKENS`**: Defaults to `None`. You can set the maximum number of tokens that can be generated in the chat completion.\n3. **`SHAI_SUGGESTION_COUNT`**: Defaults to 3. You can set it to specify the number of suggestions to generate.\n4. **`OPENAI_API_BASE`**: Defaults to `https://api.openai.com/v1`. You can set it to specify the proxy or service emulator.\n5. **`OPENAI_ORGANIZATION`**: OpenAI Organization ID\n6. **`OPENAI_PROXY`**: OpenAI proxy\n7. **`OPENAI_API_TYPE`**: Set to \"azure\" if you are using Azure deployments.\n8. **`AZURE_DEPLOYMENT_NAME`**: Your Azure deployment name (required if using Azure).\n9. **`AZURE_API_BASE`**: Your Azure API base (required if using Azure).\n10. **`CTX`**: Allow the assistant to keep the console outputs as context allowing the LLM to produce more precise outputs. ***IMPORTANT***: the outputs will be sent to OpenAI through their API, be careful if any sensitive data. Default to false.\n\nYou can also enable context mode in command line with `--ctx` flag:\n\n```bash\nshai --ctx [request]\n```\n\n### Configuration File\n\nAlternatively, you can store these variables in a JSON configuration file:\n\n- For Linux/macOS: Create a file called `config.json` under `~/.config/shell-ai/` and secure it with `chmod 600 ~/.config/shell-ai/config.json`.\n- For Windows: Create a file called `config.json` under `%APPDATA%\\shell-ai\\`\n\nExample `config.json`:\n\n```json\n{\n  \"OPENAI_API_KEY\": \"your_openai_api_key_here\",\n  \"OPENAI_MODEL\": \"gpt-3.5-turbo\",\n  \"SHAI_SUGGESTION_COUNT\": \"3\",\n  \"CTX\": true\n}\n```\n\nThe application will read from this file if it exists, overriding any existing environment variables.\n\nRun the application after setting these configurations.\n\n\n## Contributing\n\nThis implementation can be made much smarter! Contribute your ideas as Pull Requests and make AI Shell better for everyone.\n\nContributions are welcome! Please read the [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License\n\nShell-AI is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.3.25",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "71f86951d3607011e1dd02ccf5addb305109f587fa6b127a77bbd96b735da3cc",
                "md5": "b4a21a8026477fde2de52882beae17bc",
                "sha256": "58619ce13190f0da457dcf57a29a4c90744a5ede579c9207fd6e23c23dd3c975"
            },
            "downloads": -1,
            "filename": "shell_ai-0.3.25-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b4a21a8026477fde2de52882beae17bc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9439,
            "upload_time": "2024-05-24T16:31:14",
            "upload_time_iso_8601": "2024-05-24T16:31:14.103981Z",
            "url": "https://files.pythonhosted.org/packages/71/f8/6951d3607011e1dd02ccf5addb305109f587fa6b127a77bbd96b735da3cc/shell_ai-0.3.25-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4e9c0e4e5510a29b1a1f4249703d210223090fd24d057db0bb97536473b0e7d8",
                "md5": "6fbc41e703c03265fbda07731068d4d1",
                "sha256": "2759a3edff28e0cd1adfb44c4d346a6c0c2500e336bce6bf3bd99ce2d6893973"
            },
            "downloads": -1,
            "filename": "shell_ai-0.3.25.tar.gz",
            "has_sig": false,
            "md5_digest": "6fbc41e703c03265fbda07731068d4d1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9865,
            "upload_time": "2024-05-24T16:31:15",
            "upload_time_iso_8601": "2024-05-24T16:31:15.684003Z",
            "url": "https://files.pythonhosted.org/packages/4e/9c/0e4e5510a29b1a1f4249703d210223090fd24d057db0bb97536473b0e7d8/shell_ai-0.3.25.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-24 16:31:15",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "shell-ai"
}
        
Elapsed time: 0.24423s