An open API service indexing awesome lists of open source software.

https://github.com/koki-develop/askai

🤖 AI is with you.
https://github.com/koki-develop/askai

chatgpt cli openai

Last synced: 3 months ago
JSON representation

🤖 AI is with you.

Awesome Lists containing this project

README

          

askai


AI is with you.

Powered by OpenAI API


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



## Contents

- [Installation](#installation)
- [Usage](#usage)
- [Getting Started](#getting-started)
- [LICENSE](#license)

## Installation

### Homebrew Tap

```console
$ brew install koki-develop/tap/askai
```

### `go install`

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

### Releases

Download the binary from the [releases page](https://github.com/koki-develop/askai/releases/latest).

## Usage

```console
$ 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.

```console
$ 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](https://platform.openai.com).
- 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.

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

![](./assets/oneshot.gif)

### 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.

```console
$ askai -i
```

![](./assets/demo.gif)

### Pass a question from stdin

You can also pass questions from stdin.

```sh
# 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.

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

![](./assets/summarize.gif)

## LICENSE

[MIT](./LICENSE)