npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@polymath-ai/cli

v1.0.2

Published

A CLI for Polymath

Downloads

2

Readme

Polymath CLI

A Polymath CLI for interacting with all things Polymath.

It wraps the Polymath JS client, and will always be a lean CLI shim on top of that.

Setup

You can run a local polymath cli via npx, E.g.:

npx polymath -c local-knowledge complete --completion-model gpt-3.5-turbo "How long is a piece of string?"

Download and install the polymath cli globally:

npm install -g @polymath-ai/cli

Commands

Commands will look for options in the following order of precedence:

  • A given command line argument
  • Use the --config filename. The CLI will search for the first config file in the following order: . --config configpath: try to load the file . --config configname: try to load ~/.polymath/config/$configname.json
  • ~/.polymath/config/default.json: default config location
  • Environment variables will be used for some settings. e.g. OPENAI_API_KEY

There are some global options for all commands:

  • polymath -d: turn on debug mode (more output)
  • polymath -c config: load up the config
  • polymath -v: show the version
  • polymath -h: show the help

We have certain standard arguments that various command reuse:

  • --input-file: single file to use as an input
  • --input-directory: single directory to use an input
  • --output-file: when outputting a single file (e.g. a library.json)
  • --input: a type of input (e.g. medium)
  • --output: a type of output (e.g. pinecone)

When arguments aren't given, we will prompt the user for them.

Commands that we do ✅, and will ❌, support:

Ask a polymath for context ✅

polymath [-c configfileorname] ask "how long is a piece of string?"

If no query is given, we will ask for one.

It will also takes arguments: ✅

  • --openai-api-key="the openapi key": defaults to $OPENAI_API_KEY in env / .env
  • --servers https://glazkov.com: pass as many of these as you want
  • --libraries path/to/libraryOrDirectory: pass in more of these too
  • --pinecone --pinecone-api-key="The Key" --pinecone-base-url="The URL" --pinecone-namespace=namespace: use pinecone with all of it's sub settings. If not found, will also look in env / .env (e.g. PINECONE_API_KEY, PINECONE_BASE_URL, PINECONE_NAMESPACE)

Ask a polymath for a full completion ✅

polymath [-c configfileorname] complete "how long is a piece of string?"

It takes the same arguments as ask but also uses OpenAI config options and other arguments to overrule them (e.g. max_tokens, stop, etc)

Ask a polymath to stream a full completion ✅

polymath -c local-knowledge complete --completion-stream true --completion-model gpt-3.5-turbo "How long is a piece of string?"

This example turns on streaming, and sets the completion model to the new default turbo mode.

Import content ✅

e.g:

polymath import rss https://pau.kinlan.me/index.xml --destination=./libraries/medium-2023.json

Using a self hosted importer ✅

polymath ingest ../test/import/html.js https://paul.kinlan.me/

Export content ❌

polymath export --input-library=... --output=pinecone --pinecone-api-key="The Key" --pinecone-base-url="The URL" --pinecone-namespace=namespace

Check information and validate an Polymath Endpoint ❌

Go ahead and great a Polymath Endpoint to get information on what is supported, and do a lil validation check to boot.

polymath info --server https://glazkov.com`

Development

To hack on the CLI, once you git clone, you will probably want to npm link in the root directory and then you will have access to running the polymath shell command.

Setup at least a ~/.polymath/config/default.json and you are off to the races.