Code Monkey home page Code Monkey logo

asoai's Introduction

ASOAI: Another Stupid OpenAI client

Simple but efficient OpenAI client.

It features:

  • basic cli chat, with optional streaming mode
  • a REPL/interactive mode
  • configurable sessions management
  • history database

Building & running

$ go build
$ ./asoai help
asoai is another stupid OpenAI client

Usage:
  asoai [flags]
  asoai [command]

Available Commands:
  chat        interact with chatgpt
  completion  Generate the autocompletion script for the specified shell
  database    database management functions
  help        Help about any command
  models      list models
  session     handle sessions

Flags:
  -h, --help   help for asoai

Use "asoai [command] --help" for more information about a command.

Usage

Basic chat

Set the OPENAI_API_KEY env var with your own api key. Then, launch a chat using asoai chat <your input>:

$ ./asoai "hello gpt!"
Hello! How can I assist you today?

Shell completion

asoai is built using cobra. This allows adding auto-completion for your favorite shell:

$ ./asoai completion fish | source
$ ./asoai completion fish | source
chat                                             (interact with chatgpt)  database  (database management functions)  models       (list models)
completion  (Generate the autocompletion script for the specified shell)  help             (Help about any command)  session  (handle sessions)

REPL

It includes a basic REPL for easier conversations:

$ ./asoai chat --new-session --name "my-kubernetes-talk" --repl --stream --system-prompt "You are an LLM that only talks about kubernetes"
user> hello chatgpt
assistant> Hello! How can I help you with Kubernetes today?
user> what is a job
assistant> In Kubernetes, a Job is a resource object that creates one or more Pods to run a particular task to completion. Once the task is completed, the Job itself is considered complete. Jobs are used for batch processing, running tasks that are supposed to run once and then stop, such as data processing, backups, or utility tasks. Jobs can be used to run parallel tasks, but each task is expected to run to completion before the Job is considered done.
user>

Using sessions

Create a session giving a model and a system prompt:

$ ./asoai --db-path ./data.db session create --name testaroo --model gpt-4o --system-prompt "You are a GPT4 model that only respond with an hello world golang program without anything but code"
testaroo

$ ./asoai --db-path ./data.db session set-current testaroo

$ ./asoai --db-path ./data.db chat "print me something"
package main

import "fmt"

func main() {
    fmt.Println("Hello, world!")
}
$ ./asoai --db-path ./data.db session dump
Current session: testaroo
Model: gpt-4o

system> You are a GPT4 model that only respond with an hello world golang program without anything but code
user> print me something
assistant> 
package main

import "fmt"

func main() {
    fmt.Println("Hello, world!")
}

Have fun!

asoai's People

Contributors

mycroft avatar

Stargazers

truff avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.