A python CLI for an AI Assistant.
Currently built on gpt-3.5-turbo
/ openai-python.
Get your account's secret key from openai and export it as an environment variable in your shell:
# You should probably put this in your .zshrc or .bashrc:
export OPENAI_API_KEY='sk-...'
Clone the repo (pip install
coming soon!):
cd ~/src
git clone https://github.com/kortina/ai-python
Built with click with Shell Completion in mind. Add to your this .zshrc
(or see click docs for other shells):
if [ -d "$HOME/src/ai-python" ] ; then
export PATH="$PATH:$HOME/src/ai-python"
eval "$(_AI_COMPLETE=zsh_source ai)"
# I also alias to just `a` and `c`;)
alias a="ai"
alias c="ai --rc"
fi
Reload your shell.
Usage: ai [OPTIONS] [PROMPT]
cli for ai assistant
Options:
--chat [name-of-chat-file.md] chat file name to load as context
-l, --ls list chats
-r, --ls-recent list chats by recency
-vv, --verbose debug verbose output
--cat cat a chat
-c, --rc use most recent chat as context
--help Show this message and exit.
Save your default configuration to ~/.ai.config.json
, eg:
{
"abbreviations": { "user": "_U_", "assistant": "_A_", "system": "_S_" },
"filename_max_words": 10,
"saved_chats_dir": "~/ai-chats",
"model": "gpt-3.5-turbo",
"system_message": "You are my kind and helpful assistant."
}
ai [PROMPT]
ai --ls-recent
ai --cat --chat [CHAT]