0.1.9 • Published 9 months ago
@fettstorch/clai v0.1.9
Command Line AI Interface (CLAI)
A tool for AI powered web search/scrape and summarization in the Terminal. Built for fun in order to learn more about AI and CLIs.
Installation
Use this global installation in order to use the command line tool
npm install clai -gInstall it locally in order to use the clai function in your project.
npm install claiUsing both the CLI tool and the clai function requires an OpenAI API key. For the CLI tool make sure to set the OPENAI_API_KEY environment variable.
OpenAI API Key Setup
- Check this project's code on GitHub in order to make sure I will not store your key :)
- Go to OpenAI's API platform
- Sign up or log in to your OpenAI account
- Click "Create new secret key"
- Copy your API key
- Set it as an environment variable:
Features
CLI Usage
clai https://example.com
clai "how tall can giraffes get?"
clai how tall can giraffes get
claiThe cli expects either a URL or a search query or no argument at all. When passing a search query without quotes make sure not to use any special characters, that might confuse the CLI e.g. ?
Programmatic API
import clai from 'clai';
const { summary, links, sources } = await clai('https://example.com', 'your-openai-api-key');Issues
- Needs a better prompt in order to more reliably stop narrating a page's content and rather cite it in a more concise manner.
- The first answer's stream animation appears to sometimes not be skippable using 'enter'
- large sites might surpass the token limit (currently not handled gracefully)
- occasionally clai doesn't find search results (this is not handled gracefully)
License
ISC