Coder Social home page Coder Social logo

ai.cli's Introduction

ai client

this is a simple terminal program to connect to the openai api and get (gpt-3.5 gpt-4 gpt-x) responses.

  • it contains a framework for creating simple prompt helpers.
  • it streams the responses (in a nice format).
  • it copies the response to the system clipboard (on macos)
  • it also prints some stats about how much the request cost, how many tokens it was, and how long it took.

but i'm lying! it's something way more powerful.

it's a terminal program that abstracts a bunch of ai models and supports a plugin framework.

it just ships with an LLM plugin by default.

it's great for rapidly prototyping AI ideas.

i may update it in the future. it does what I need it to do right now.

it has two dependencies: the openai api and tiktoken.

to install

  1. clone this repo
  2. run npm install
  3. copy ./config.example.js to ./config.js
  4. add your openai api key to config.js
  5. optionally configure a helper file. copy helper.example.js somewhere and update the helper path in config.js
  6. run ./bin/llm gpt-3.5-turbo none "recite to be or not to be from hamlet."

usage:

  • llm <model | alias | "cont"> [<helper_name> [prompt]]

you can run the command without a helper name and a prompt. if you run the command without a prompt it will open your editor. if you include a helper but no prompt you'll see the helper prompts (commented out) in the editor too it works kinda like git commit if you don't provide a message it's much easier to edit a big prompt in the editor especially if you're include code.

run llm help to see the various models, aliases and helpers supported.

note: if you get errors about access or rate limits, make sure you have API billing enabled. it's separate from the chat account billing. it should live here: https://platform.openai.com/account/billing/overview

examples:

  • llm 4 d say hello
  • llm gpt-3.5-turbo none "recite to be or not to be from hamlet."
  • etc...

todo

  1. store history and allow continuation of previous prompts
  2. support other llms with llama.cpp

license

Feel free to use and hack on this program. You can't use the lib/_.js code in any other project -- it's a fragment of some proprietary code I license to people.

ai.cli's People

Contributors

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