Code Monkey home page Code Monkey logo

ai-scripts's Introduction

AI Scripts

em pt-br

This repository contains a set of scripts adapted from Taelin AI Script for daily usage, mainly focused on modifying Taelin's original scripts. This currently supports the Llama 3, Mixtral and Gemma through Groq on Linux. For Windows and Mac support or access to Anthropic and OpenAI relevant models, please refer to Taelin's original repository.

ChatSH

A ChatGPT-like interface available in the terminal

CSH Commands

  • chatsh <model>

Avaliable models:

  • l: 'llama3-8b-8192'
  • L: 'llama3-70b-8192'
  • L2: 'llama2-70b-4096',
  • m: 'mixtral-8x7b-32768',
  • g: 'gemma-7b-it'

CSH Behavior

Caution

NEVER RUN A CODE YOU DON'T FULLY UNDERSTAND!!!

  • Upon request for task execution (writing/modifying files or querying APIs), the script generates a shell code for the task without further explanation. You can choose to run the generated code after review.
  • Upon request for an open question, the script generates an answer similarly to ChatGPT

Sometimes if you open question is too small the script will provide you answer as a shell code; well, AIs can hallucinate

Holefill

Non-intrusive copilot-like tool, probably drawns inspiration by typed holes present in languages such as Lean, Agda and Kind

HF Behavior

  • It generates assertive code to replace all holes (marked as ??) within a code file and applies the changes to the file.
  • It only replaces ?? with code, leaving the rest of the file untouched.

Note that it's capable of generating significant amounts of code; refer to the script for examples (this script is assigned to the const system)

HF Usage

In your file, insert ?? wherever you want the script to complete.

Then in a terminal of your choice run:

  • holefill <file> <shortened_file> <model(optional)>

    • <file>: The file containing the holes to fill; you can use either the absolute or relative path (e.g., ./<file_name>).
    • <shortened_file>: A shortened version of the file that can exclude irrelevant parts. If uncertain, simply pass the file twice as an argument; note that this is used only as context for the task.

Available models:

  • l: 'llama3-8b-8192'
  • L: 'llama3-70b-8192'
  • L2: 'llama2-70b-4096'
  • m: 'mixtral-8x7b-32768'
  • g: 'gemma-7b-it'

If no model is specified, it defaults to using l.

HF VSCode Integration

You can run a bash script within the VSCode terminal using keybinding shortcuts.

To utilize this script, add the following to your keybindings.json file:

{
    "key": "alt+shift+;", // or any preferred keybind
    "command": "workbench.action.terminal.sendSequence",
    "args": {
      "text": "temp_file=$(mktemp) && echo '${selectedText}' > \"$PWD/tmpfileforholefill\"\u000Dholefill.mjs ${file} ./tmpfileforholefill\u000Drm tmpfileforholefill\u000D"
    },
    "when": "editorFocus && editorHasSelection"
  },
  {
    "key": "alt+shift+;", // or any preferred keybind
    "command": "workbench.action.terminal.sendSequence",
    "args": {
      "text": "holefill.mjs ${file} ${file}\u000D"
    },
    "when": "editorFocus && !editorHasSelection"
  }

Now, select the text relevant to fill a hole and press the keybind shortcut; it will create a temp file with the selected text and pass both the current file and the temp file as an argument to holefill, then it will delete the temp file

If no text is selected, it will use the whole current file as context (pass it twice to holefill)

Requirements

API Key Setup

  1. Follow the API documentation to get your Groq API key

  2. Set up an environment variable for the API key:

    export GROQ_API_KEY=<your-api-key-here>

    For the API key to persist, add the command to your shell configuration file:

    zsh:

    echo "export GROQ_API_KEY=<your-api-key-here>" >> ~/.zshrc

    bash:

    echo "export GROQ_API_KEY=<your-api-key-here>" >> ~/.bashrc

Installation

git clone https://github.com/PHAredes/AI-scripts.git #Clone the repository
cd AI-scripts # change to the repository directory
npm i # install dependencies
chmod +x install.sh # make install.sh an executable
./install.sh # run the install script

ai-scripts's People

Contributors

victortaelin avatar pharedes avatar

Stargazers

 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.