aichat

command module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 13 Imported by: 0

README

aichat

Maintainability

This is a program to use OpenAI's ChatAPI from the command line.

Install

Download the latest version from Releases and place the executable in a location with a PATH.

Prerequisite

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.

How to use

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!

Ideas

Applications where aichat may be of use

  • Text summarization
  • Generating git commit messages
  • Code review

@tkawachi が試している日本語のプロンプト例が https://github.com/tkawachi/my-aichat-prompts にあるので参考までにどうぞ。

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL