Skip to content

Knowledge Bases

A knowledge base is a collection of files used to persist your data in OnceContext.

One or more pipelines can be connected to a knowledge base using the KnowledgeBaseFiles step.

Connected Pipelines will be triggered automatically when any files are uploaded to the knowledgebase.

Create a Knowledge Base:

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

Upload Files to an existing Knowledge Base:

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

List Files in a Knowledge Base:

Query the files in a knowledge base with specific filtering, sorting and pagination.

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

run onecli knowledge-base files list -h to see all the available filtering and sorting options.

Delete Files from a Knowledge Base

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

A file picker will open in the TUI and you can choose the file to delete from the drop-down.

Warning

All chunks associated with the deleted file will also be deleted.

Upload All Supported Files from a Directory

This facilitates bulk uploading of files to your knowledge base from a specified directory.

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

Once you run this, a TUI will open in the directory you are currently in. Select any directory, and all compatible files within the directory will be uploaded.