Skip to content

Shell commands

All the commands are executed inside backend container. To enter interactive shell, run:

docker exec -it backend bash

Then run the command with ./manage.py <command_name> <options>.

Common arguments

Almost all the commands support (or require) the following arguments:

Company code

Required if more than one company exists.

How to use:

./manage.py <command_name> -c <company_code> <options>

Tenant code

Required if the command is executed for a specific tenant. In other cases, the command is executed for all tenants. Multiple tenant codes can be specified: -t <tenant_code1> -t <tenant_code2>.

How to use:

./manage.py <command_name> -t <tenant_code> <options>

Source code

Source is an alternative name for crawler. Required if the command is executed for a specific source. In other cases, the command is executed for all sources. Either company or tenant must be specified. Multiple source codes can be specified: -s <source_code1> -s <source_code2>.

How to use:

./manage.py <command_name> -c <company_code> -s <source_code> <options>

Django Management Commands

Ask question

command: ask

How to run:
./manage.py ask <question_text> [options]

Description:
Asks a question to SerenityGPT for the selected tenant and prints the answer.

Required arguments: - question_text — The question to ask.

Optional arguments: - -f, --filters <json> — Filters in JSON string format.

Documents/chunks stats

command: num_docs

How to run:
./manage.py num_docs

Description:
Prints a table with the number of documents, chunks, and encoded chunks for each source, tenant, and company.

Optional arguments:
None (other than standard company/tenant selection).

Document info

command: doc

How to run:
./manage.py doc [options]

Description:
Displays information about documents, filtered by ID, URL, or title. Can show document text and select a random document.

Optional arguments: - --id <str> — Filter by document ID. - --url <str> — Filter by document URL (supports regex if no exact match). - --title <str> — Filter by document title. - --text — Show the document text. - --rand — Select a random document from the results.

Delete documents

command: delete

How to run:
./manage.py delete [options]

Description:
Deletes documents, chunks, and embeddings for a given URL or for all sources in the selected scope. Also deletes empty tenants and companies.

Optional arguments: - --url <str> — Delete only the document(s) with the given URL.

Question info

command: question

How to run:
./manage.py question [options]

Description:
Displays information about a question, including its text, status, creation time, filters, and response. Can also show associated messages and context documents.

Optional arguments: - --id <int> — Question ID (default: last question). - -m, --message — Show all messages for the question. - -c, --context — Show context documents for the question.

Run eval

command: eval

How to run:
./manage.py eval [options]

Description:
Runs evaluation on a set of questions, prints results, and can send results to the evaluation server.

Optional arguments: - --file <filename> — Evaluation set filename (default: default). - --index <int> — Evaluate only a specific question by index. - -d, --description <str> — Description of the evaluation run. - --skip-urls-check — Skip checking if the URLs exist in the database.

Run vector-search eval

command: eval-rag

How to run:
./manage.py eval-rag [options]

Description:
Evaluates retrieval-augmented generation (RAG) by running search and context-building for evaluation questions, and prints results.

Optional arguments: - --file <filename> — Evaluation set filename (default: default). - --index <int> — Evaluate only a specific question by index. - --skip-urls-check — Skip checking if the URLs exist in the database.

Run crawler

command: run_crawler

How to run:
./manage.py run_crawler [options]

Description:
Runs the crawler for the specified company, tenants, and sources. Can run once or in a loop, and can reset state.

Optional arguments: - --reset — Delete all documents and chunks before running. - --infinite — Run the crawler in a loop. - --period <minutes> — Time in minutes to wait between runs (default: 60).

Run answers

command: run_answers

How to run:
./manage.py run_answers [--reload]

Description:
Starts the answer worker process. Can optionally enable auto-reload when Python files change.

Optional arguments: - --reload — Enable auto-reload on code changes.

Run indexer

command: run_indexer

How to run:
./manage.py run_indexer [options]

Description:
Runs the indexer for the selected sources. Can run in a loop, reset status, or skip encoder/splitter steps.

Optional arguments: - --infinite — Run indexer in a loop. - --reset — Delete chunks and embeddings for given documents before running. - --no-encoder — Do not run encoder, just split documents. - --no-splitter — Do not run splitter, just run encoder. - --gpu — Use GPU for encoding.

Run script

command: run_script

How to run:
./manage.py run_script <module>

Description:
Runs a specified Python module as a script.

Required arguments: - module — Python module path to run (e.g., myapp.scripts.myscript).

Company dump

command: company_dump

How to run:
./manage.py company_dump --output <file> [options]

Description:
Dumps company data (tenants, documents, and optionally chunks) to a JSON file.

Required arguments: - --output <file> — Output file to write the JSON data to.

Optional arguments: - --no-chunks — Do not dump chunks.

Company load

command: company_load

How to run:
./manage.py company_load <filename> [options]

Description:
Loads company data (tenants, documents, and chunks) from a JSON file.

Required arguments: - filename — Path to the JSON file containing the data.

Optional arguments: - --reset — Remove existing documents for that company before loading new data.

Run telemetry

command: run_telemetry

How to run:
./manage.py run_telemetry

Description:
Collects and sends telemetry data to the Serenity server.

Optional arguments:
None.

Update metadata

command: update_metadata

How to run:
./manage.py update_metadata <key> <value>

Description:
Updates a metadata key for all documents (and their embeddings) in the selected sources.

Required arguments: - key — Key in the metadata JSON field of the document (and embeddings). - value — Value to update (can be a string, int, float, or JSON string).

Check client config

command: check_client_config

How to run:
./manage.py check_client_config <company_code>

Description:
Prints the client configuration for the specified company and checks that the company exists.

Required arguments: - company_code — The code of the company to check.