Skip to content

koki-develop/askai

Repository files navigation

askai

AI is with you.
Powered by OpenAI API

GitHub release (latest by date) GitHub Workflow Status Maintainability Go Report Card LICENSE

Contents

Installation

Homebrew Tap

$ brew install koki-develop/tap/askai

go install

$ go install github.com/koki-develop/askai@latest

Releases

Download the binary from the releases page.

Usage

$ askai --help
AI is with you.

Usage:
  askai [flags] [question]

Flags:
  -k, --api-key string   the OpenAI API key
      --configure        configure askai
  -g, --global           configure askai globally (only for --configure)
  -h, --help             help for askai
  -i, --interactive      interactive mode
  -m, --model string     the chat completion model to use (default "gpt-3.5-turbo")
  -v, --version          version for askai

Getting Started

Setup

First, run askai with the --configure flag set.

$ askai --configure

Upon doing this, an interactive setup session will be initiated.
Input the following items:

  • OpenAI API Key: API key created on the OpenAI platform.
  • Model: The chat completion model to use. (Available: gpt-4, gpt-4-0613, gpt-4-32k, gpt-4-32k-0613, gpt-3.5-turbo, gpt-3.5-turbo-0613, gpt-3.5-turbo-16k, gpt-3.5-turbo-16k-0613)

Once the setup is completed, a configuration file named .askai will be created.
Now, you are all set.

Note

If you run askai --configure with the --global flag set, the configuration file will be created as $HOME/.askai.
This file is referred to when executing askai, if there is no .askai in the current directory.

Ask a question to AI

By passing a question as an argument to askai, you can obtain an answer from AI.

$ askai 'Please write a program in Go that outputs "Hello world”.'

Ask a question to AI interactively

By running askai with the -i or --interactive flag set, you can ask questions to AI in an interactive manner.

$ askai -i

Pass a question from stdin

You can also pass questions from stdin.

# pipe
$ echo 'QUESTION' | askai

# file
$ askai < question.txt

You can pass both input from stdin and arguments at the same time.
By utilizing this, for example, you can also summarize the contents of a specific file.

$ cat README.md | askai 'Please summarize this content'

LICENSE

MIT