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

@onecontext/cli

v0.0.33

Published

Official CLI tool to interact with OneContext. πŸš€.

Downloads

1

Readme

Official OneContext CLI Tool

Use this CLI tool to manage your OneContext account.

What is OneContext?

OneContext is a platform that enables software engineers to compose and deploy custom RAG pipelines on SOTA infrastructure. You define the pipeline in YAML, and OneContext takes care of the rest of the infra (SSL certs, DNS, Kubernetes cluster, GPUs, autoscaling, load balancing, etc).

Where can I learn more?

Check out our docs for a in-depth treatment of how our platform works!

Sounds cool. How do I get started?

Install the tool

Install globally using npm

npm install -g @onecontext/cli

Clone this repo

git clone https://github.com/onecontext/cli.git

Build it

cd cli
npm run build

Make it available

npm link

Set up your config

Run the below to set your API key

onecli config set-api-key
Don't have an API key?

You can get one here

Or, you can run the below command to open a browser session on the correct page:

onecli config create-user
You can (probably) skip this steph

The default base URL for the serverless platform is https://api.onecontext.ai/v1/. You'll only need to set a custom base URL if you are on the dedicated plan and have a custom domain. Users on the dedicated plan have a custom GPU cluster set up just for them on their subdomain.

Run the below to set your base URL

onecli config set-base-url

Now what?

Now you can do (almost) everything the OneContext platform allows you to do, but from the command line, with a nice TUI.

For a quick overview though, please see below:

List your pipelines

onecli pipeline list

This will list your pipelines like so.

Hint: pass a --verbose flag if you want to view the full yaml file for each pipeline.

Create a new pipeline

onecli pipeline create --pipeline-name=index_pipeline --pipeline-yaml=example_yamls/index_pipeline.yaml && \
onecli pipeline create --pipeline-name=retrieve_fast --pipeline-yaml=example_yamls/retriever_pipeline.yaml

This command will create a pipeline according to the specification in the provided yaml file.

Delete a pipeline

onecli pipeline delete --pipeline-name=index_pipeline

This will ask you for confirmation Yes / No before proceeding.

Run a pipeline

onecli pipeline run sync --pipeline-name=retriever_pipeline

Run a pipeline with overrides to certain fields

onecli pipeline run sync --pipeline-name=retrieve_fast --override-args='{"query_embedder":{"query": "the difference between ipv4 and ipv6"}, "retriever" : {"top_k": 1}}'

As this is a retriever pipeline, it will return a list of chunks from the vector index. As we've set top_k equal to 1, there will be just one chunk in the list.

List your knowledge bases

onecli knowledge-base list

Create a new knowledge bases

onecli knowledge-base create --knowledge-base-name=demo_kb

This will create a new knowledge base you can upload files to.

Delete a knowledge base

onecli knowledge-base delete --knowledge-base-name=demo_kb

This will ask you for confirmation Yes / No before deleting. Note, all the files, chunks, and embeddings connected to this Knowledge Base will be deleted.

List your vector indices

onecli vector-index list

Create a new vector index

onecli vector-index create --vector-index-name=demo_vi --model-name=BAAI/bge-base-en-v1.5

Note you must pass both the vector index name, and the model name (because each vector index is tied to a particular embedding model).

Delete a vector index

onecli vector-index delete --vector-index-name=demo_vi

This will ask you for confirmation Yes / No before deleting. Note all the embeddings in this vector index will be deleted. The source files will remain in the knowledge base.

List the files in a knowledge base

onecli knowledge-base files list --knowledge-base-name=rm_kb

Upload a new file to a knowledge base

onecli knowledge-base upload file --knowledge-base-name=rm_kb

A file picker TUI will open, showing all files in the current directory. If you select a file, it will upload the selected file to the knowledge base.

Confirmation will be shown like so:

Upload a new directory of files to a knowledge base

onecli knowledge-base upload directory --knowledge-base-name=rm_kb

A file picker TUI will open, showing all files in the current directory. If you select a directory, it will upload all PDF, .txt, .docx, and .md within that directory. Confirmation will be shown like so:

Delete a file from a knowledge base

onecli knowledge-base files delete select --knowledge-base-name=rm_kb

A file picker TUI will open, showing all files in the current knowledge base (on the server). If you select a file, it will ask you for confirmation Yes / No before deleting. If you delete it, all associated chunks and embeddings will also be deleted.

List the runs executed on your account

onecli pipeline run status

Show a particular run

onecli pipeline run status --runid=24b554e89fc64e97955cf06e0e14dfc2

Output the steps for a run

onecli pipeline run status --runid=24b554e89fc64e97955cf06e0e14dfc2 --show-steps

Hint: omit the "runid" selector to show this output for all runs on the account.

Show the full config for the run

onecli pipeline run status --runid=24b554e89fc64e97955cf06e0e14dfc2 --show-config

Hint: omit the "runid" selector to show this output for all runs on the account.

Filter the above by further parameters

If you have multiple runs, you can also further refine the output by passing flags such as: skip and limit (for pagination). sort to sort by a field on the run. date-created-gte to only show runs with a date greater than or equal to the provided date. date-created-lte to only show runs with a date less than or equal to the provided date. status to only show runs with a particular status (e.g. "RUNNING").

For more information execute the below command:

onecli pipeline run status -h

Ermahgerd it's not working

Some troubleshooting tips:

Get it from the interweb

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -

When that's done, run:

sudo apt-get install -y nodejs=20.13.1-1nodesource1

Get it via apt-get

sudo apt-get install npm

Get it via apt-get

sudo apt-get install git

Try it with sudo

i.e. instead of:

npm install -g @onecontext/cli

try:

sudo npm install -g @onecontext/cli

Create an issue in this repo

We'll get back to you ASAP, or one of our helpful community will beat us to it.

Email us

Always happy to hear from our users! Please feel free to reach out. help

Thanks!