This is a program to use OpenAI's ChatAPI from the command line.
Download the latest version from Releases and place the executable in a location with a PATH.
You need to set the API Key in $HOME/.aichat/credentials.yml
:
openai_api_key: YOUR_API_KEY
Or set as OPENAI_API_KEY environment variable.
When executed, you can interact with it on the terminal. To exit, type Ctl-D.
$ aichat
user: Hello!
assistant:
Hello there! How may I assist you today?
user: How will AI change the world in the future?
assistant:
As an AI language model, I can say that AI has the potential to transform virtually every aspect of our lives, from healthcare to education,
(omitted)
Also, you can use aichat foo
command by putting the prompt template as $HOME/.aichat/prompts/foo.yml
. You can replace the foo
part with any name you like.
For example, place the following content as $HOME/.aichat/prompts/name-program.yml
:
messages:
- role: system
content: A brief description of the program, using only lowercase letters and hyphens, appropriate for the program. You may use up to three hyphens.
- role: user
content: $INPUT
# creativety or randomness, 0~1
temperature: 0.7
Command line input is embedded in $INPUT
and sent to the API.
To use the prompt above, do the following
$ echo "Command line program to utilize AI" | aichat name-program
ai-utilization-cli
Yay. I could easily create a command that would bring out the power of the AI!
Applications where aichat may be of use
- Text summarization
- Generating git commit messages
- Code review
@tkawachi が試している日本語のプロンプト例が https://github.com/tkawachi/my-aichat-prompts にあるので参考までにどうぞ。