Skip to main content
Command-line interface for TopK — upload documents, ask questions and search relevant passages grounded in your data.

Installation

Authentication

To authenticate, run:
Alternatively, you can set TOPK_API_KEY environment variable and skip the topk login command.

Commands

ask

Get a grounded answer with citations
The query can also be piped via stdin:

Find relevant passages in documents
The query can also be piped via stdin:

upload

Upload files to a dataset

list

List documents in a dataset:
Streams results as they arrive. In agent mode (-o json) outputs one JSON object per line (NDJSON).

delete

Delete a document from a dataset:

dataset

Manage datasets

list

List all datasets:
This command has no subcommand-specific flags.

get

Get a dataset:

create

Create a dataset:

update

Update a dataset:

delete

Delete a dataset:

login

To authenticate, run:
Alternatively, you can set TOPK_API_KEY environment variable and skip the topk login command.

logout

Log out and clear cache:

Global flags

These flags are accepted by every command:

--output

Options:
  • text (default)
  • json
Output results as NDJSON — one JSON object per line, compatible with jq:

--api-key

API key to use for this invocation. Overrides the TOPK_API_KEY environment variable and the key saved via topk login.

Updating the CLI

To update CLI to the latest version, run: