AI in the command line with Guidance 🌟!
You just need to write a comment or variable name and the AI will write the corresponding code.
This is a ZSH plugin that enables you to use OpenAI's powerful SOdex AI in the command line. OpenAI SOdex is the AI that also powers GitHub Copilot. To use this plugin you need to get access to OpenAI's Codex API.
- Install the OpenAI package.
pip3 install openai guidance
- Download the ZSH plugin.
git clone https://github.com/LeaveNhA/zsh_sodex.git ~/.oh-my-zsh/custom/plugins/zsh_sodex
- Add the following to your
.zshrc
file.
Using oh-my-zsh:
# ZSodex configuration
function zsodex_config() {
SODEX_PREFERRED_LLM_MODEL='~/.cache/huggingface/hub/models--TheBloke--stable-code-3b-GGUF/snapshots/53430e2b42177f12f2fe8c844cd47211756ca072/stable-code-3b.Q4_K_M.gguf'
SODEX_LLAMA_N_GPU=999 # since I have a 64GB ram.
SODEX_N_THREADS=2 # since I'm on a Apple Silicon based machine.
SODEX_N_CONTEXT=5000 # For extreme cases.
SODEX_TEMPERATURE=1 # I like it that way but you can configure it.
}
plugins=(zsh_codex)
bindkey '^X' create_completion
# Or bind it for Vi mode:
zvm_bindkey vicmd 'zm' sodex_create_completion
Without oh-my-zsh:
# in your/custom/path you need to have a "plugins" folder and in there you clone the repository as zsh_codex
export ZSH_CUSTOM="your/custom/path"
source "$ZSH_CUSTOM/plugins/zsh_sodex/zsh_sodex.plugin.zsh"
# You still need config function to set the variables.
bindkey '^X' create_completion
- Run
zsh
, start typing and complete it using^X
!