GithubHelp home page GithubHelp logo

ai-scripts's Introduction

AI Scripts

Some cli scripts to interact with chatbots and other ai tools.

NOTE: I am using the project personally to experiment with AI, so it is very experimental. Please use it on your own risk. I will probably add breaking changes to the commands regularly.

You can install the project via:

poetry install

Make the commands globally available via:

pip install -e .

Depending on what models are used you need to provide the following environment variables:

You can override the used model using the MODEL environment variable (e.g. gpt-4-1106-preview, mistralai/Mistral-7B-Instruct-v0.2).

The following scripts are currently implemented:

how

how <prompt>

Based on the prompt generates a cli command and copies it to the clipboard.

explain

explain <cli-command>

Explains a cli command and it's options.

explain-code

explain <code>

Explains a piece of code by adding comments. If not code is passed as an argument tries to take it from the clipboard.

implement

implement <language> <description>

Implement a functionality in the given language based on the description.

rewrite

rewrite <language> <description> <code?>

Rewrite the given code based on the description.

The code argument is optional and a clipboard is used as a default.

  • -h, --help to see all options
  • -f, --file get the code from a file
  • -o, --format <code|diff> specifies how the code is formatted. If -f -o diff is set you are prompted to patch the file directly with the proposed changes.

find-docs

find-docs <prompt>

Find documentation based on the given prompt.

  • -s, --summary: Summarizes the docs for you (optional).

summarize

summarize <text>

Summarize the given text. The text can be also piped via stdin.

translate

translate -l spain <text>

Translate the given text to the specified language. The text can be also piped via stdin.

spellcheck

spellcheck <text>

Spellcheck the given text. If no text if given, the text will be parsed from the clipboard.

ask-workspace

ask-workspace <question>

Ask a question about the current workspace/folder/codebase. Works best in git repositories.

The following tools need to be installed for this command:

  • eza: To get informations about the file tree
  • ripgrep: To search the filesystem for text
  • git: To search the filesystem for text in a git repository

ai-chat

ai-chat <chat-file.md>

Chat with the AI and store the chat in a markdown file. This will open your $EDITOR. Every time you save the file, an answer will be generated and added to the file.

The syntax of the chat is the following:

  • [<role>]: Marks the start of a new message
  • You can set options like model, temperature, top_p and presence_penalty in the front matter.

Example:

---
model: gpt-4-1106-preview
temperature: 1.3
---

# --- system ---

You are a helpful assistant.

# --- user ---

What is the time?

# --- assistant ---

I'm sorry, but I am unable to provide real-time information or current time as
my capabilities are limited to text-based interactions and I don't have access
to real-time data. However, you can easily check the current time by looking at
the clock on your device or by searching for the current time in your location
on a search engine.

ai-scripts's People

Contributors

tobias-walle-mw avatar

Stargazers

Riitta Gerhards avatar Ben Hoppe avatar

Watchers

Tobias Walle 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.