Git Product home page Git Product logo

reverse-ai-search's Introduction

Ollama LLM CLI completion similar to reverse-i-search

Integrate AI into bash in a way you already use, with ctrl+r aka reverse-ai-search

Reverse AI Search provides local AI bash completion in a format you're already familiar with.

Only works with bash currently. Zsh coming soon.

Use Cases

Find Pictures Example

Command creation

Find Modified Example

# find all yaml files
(reverse-ai-search): '#find all yaml files' find . -name '*.yaml'
$ find . -name '*.yaml'

Fix mispelling

Misspell Example

(reverse-ai-search): 'suod vmi /ect/hots' sudo vim /etc/hosts
$ sudo vim /etc/hosts

Command completion

(reverse-ai-search): 'curl localhost | jq #last item in values array' curl localhost | jq '.values | last'
$ curl localhost | jq '.values | last'

Requirements

  • ollama - codegemma or codellama models
  • python3

zsh - add to .zshrc

export AISH_TEMP_DIR="/tmp/reverse_ai_search"
export AISH_PATH="/path/to/git/repo"
export AISH_HOTKEY=${AISH_HOTKEY:-$'\C-o'}
source $AISH_PATH/autocomplete.zsh
zle -N reverse_ai_search
bindkey '^O' reverse_ai_search

Bash - Add to .bashrc

bind -x '"\C-o": "reverse_ai_search"'
export AISH_TEMP_DIR="/tmp/reverse_ai_search"
export AISH_PATH="/path/to/codebase"
export AISH_HOTKEY=${AISH_HOTKEY:-'0f'}  
source $AISH_PATH/autocomplete.sh

Configuration (Optional)

Configuration values with their defaults


# temporary directory for caching lookup
AISH_TEMP_DIR=/tmp/reverse_ai_search

# Ollama model to use
AISH_OLLAMA_MODEL=codegemma

# Ollama host string
AISH_OLLAMA_HOST=http://localhost:11434

TODO

  • ZSH support
  • send buffer to LLM every keystroke. Otherwise is sent on function call. AISH_STREAM_RESULTS=1
  • incorporate the directory into the prompt
  • prompt tuning
  • fine-tuned model

Other notes

  • It caches results for strings in the temp directory, so you may want to clear these for many reasons.
  • There is an attempt to rate limit the number of predictions sent to ollama per session. If you are experiencing slowness disable AISH_STREAM_RESULTS and use the key bind to initialize ai search.

reverse-ai-search's People

Contributors

koryk avatar

Stargazers

 avatar Joel Matthew Gallant avatar Michael Geiger avatar

Watchers

 avatar Kostas Georgiou avatar  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.