Skip to content
Talk to our solutions team

AI & Documents

Model access, rules, OCR and bounding-box document analysis, synthetic data. Captured from kis --help, so this matches the binary rather than describing it.

AI commands backed by lib-ai. See kis ai <command> --help.

kis ai [command]
SubcommandPurpose
chatSend a prompt to a model and print the reply
chunkSplit a document into chunks
embedEmbed text and print vectors (or a similarity matrix)
extractExtract structured fields from text, with N-run consensus
harnessRun and inspect agentic harness definitions (lib-ai-harness)
imageGenerate image(s) from a text prompt
memoryInteract with the ai-smriti memory service over HTTP
modelsList the models a provider advertises (with capabilities)
providersList supported providers and their capabilities
ragRetrieval-augmented generation over a vector store
reasonRun a reasoning strategy (CoT, Tree-of-Thoughts, Reflexion, Debate, …)
rerankRerank documents by relevance to a query
sampleMulti-sample / multi-model strategies (dev comparison tool)
sessionPersistent multi-turn conversations (file-backed)
solveGenerate a JavaScript program for the task and execute it in maya (deterministic)
structuredGet schema-constrained JSON output from a model
tokensCount tokens for text (heuristic, or exact via a local server)
transcribeTranscribe an audio file to text (STT)
ttsSynthesize speech from text

Send a prompt to a model via lib-ai and print the reply.

The prompt comes from the arguments, or from stdin when no arguments are given.

Examples: kis ai chat “what is 2+2?” kis ai chat -p openai -m gpt-4o “summarize this” echo “translate to French: hello” | kis ai chat kis ai chat —stream “write a haiku about go” kis ai chat -p ollama -m qwen3-vl:8b -I photo.jpg “what is in this image?” kis ai chat —prompt-file prompts.yaml —prompt summarize —vars [email protected] kis ai chat —session proj-42 “remember my name is Sam” # saved + resumable kis ai chat -i —session proj-42 # interactive, resumes proj-42

Interactive mode (-i): each line sends on Enter. Start a heredoc with <<EOF to compose a multi-line message (lines collected until a line equal to the delimiter). Slash commands: /image <path|url> and /file queue attachments for the next message (/image switches to a vision model), /clear drops them, /help lists commands, /exit quits (Ctrl-D too).

kis ai chat [text] [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-I, --image stringArrayimage file path or http(s) URL for vision models (repeatable)
-i, --interactiveinteractive multi-turn REPL (streamed)
-j, --jsonprint the full response as JSON
-m, --model stringmodel id (provider-specific; defaults per command)
-p, --provider stringprovider: ollama
-s, --system stringsystem prompt
-T, --temperature floatsampling temperature (omit for provider default) (default -1)
-v, --vars stringArraytemplate var key=value (repeatable); value may be @file or @- to read stdin

Split a document into chunks using a lib-ai chunker.

Strategies: recursive (default), window, markdown, html, semantic. The semantic strategy embeds sentences to find topic boundaries and uses the provider/model flags for the embedder.

Examples: kis ai chunk README.md —strategy markdown —max-tokens 512 kis ai chunk paper.txt —strategy semantic -p ollama -m nomic-embed-text kis ai chunk notes.txt —strategy recursive —overlap 64 —json

kis ai chunk <file> [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-j, --jsonprint chunks as JSON
-m, --model stringmodel id (provider-specific; defaults per command)
-p, --provider stringprovider: ollama

Embed one or more inputs via lib-ai. Each argument is one input; with no arguments, inputs are read one-per-line from stdin.

Examples: kis ai embed “hello world” kis ai embed -p openai -m text-embedding-3-small “a” “b” —compare printf “first\nsecond\n” | kis ai embed —json

kis ai embed [text...] [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-j, --jsonprint vectors as JSON
-m, --model stringmodel id (provider-specific; defaults per command)
-p, --provider stringprovider: ollama

Extract structured fields from input text. With —schema, output conforms to that JSON Schema (provider-native structured output + validate/repair); without it, the model returns a free-form JSON object and voting runs over the keys it emits. With —runs > 1, each run is extracted independently and the result is decided by PER-FIELD majority vote, reporting how many runs agreed on each field.

Input is assembled, in order, from: —file (one or more paths or globs), —input (literal text, or @path to read a file), positional args, or stdin. For HTML/hOCR, clean it first to save tokens: —strip-html flattens to plain text, or —strip-attrs keeps the tags but drops noisy attributes (bbox, confidence, ids) so the model still sees the line/word/paragraph structure.

To focus the model on one region, —start/—end (or a prompt entry’s start/end) send only the text between the first matching start marker and the following end marker — useful to disambiguate a single section of a large document.

Examples: kis ai extract —schema loan.json —file ./application.txt —runs 5 kis ai extract —schema loan.json —file ‘pages/*.hocr’ —strip-attrs —runs 5 kis ai extract —file doc.txt —start “1e. Income from Other Sources” —end “Section 2:” echo “$DOC” | kis ai extract —schema fields.json -p openai —runs 3 —json kis ai extract —schema loan.json —prompt-file prompts.yaml —prompt extract_note —file note.txt —runs 5

kis ai extract [text] [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-f, --file stringArrayinput file path or glob (repeatable); contents are read and concatenated
-i, --input stringinput text, or @path to read a file
-j, --jsonprint consensus + agreement as JSON
-m, --model stringmodel id (provider-specific; defaults per command)
-p, --provider stringprovider: ollama
-n, --runs intnumber of extraction runs for consensus voting (default 1)
-s, --system stringsystem prompt
-T, --temperature floatsampling temperature (defaults to 0.4 when runs>1) (default -1)
-v, --vars stringArraytemplate var key=value (repeatable); value may be @file or @- to read stdin

Execute harness definitions with the embedded engine, validate their graphs (including the cycle boundedness rule), inspect the (desugared) graph, and resume suspended or interrupted runs from snapshots.

Model refs in definitions resolve dev-style: “provider:model” builds that provider from flags/env keys (ANTHROPIC_API_KEY, OPENAI_API_KEY, …, KIS_LOKI_KEY for gateway:); a bare ref uses —provider/—model.

kis ai harness [command]
SubcommandPurpose
graphEmit a harness definition’s graph
resumeResume a suspended or interrupted run from a snapshot
runExecute a harness definition with the embedded engine
validateParse, expand, and validate a harness definition

Generate images via an image-capable provider (openai, stability).

Examples: kis ai image -p openai “a watercolor fox” -o fox.png kis ai image -p stability “an isometric office” —width 1024 —height 1024

kis ai image <prompt> [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-m, --model stringmodel id (provider-specific; defaults per command)
-o, --out stringoutput file (or prefix when —n > 1); default image.png
-p, --provider stringprovider: ollama

HTTP client for ai-smriti (ai-memory): the platform’s interaction memory.

Write path: start · append · close · event Read path: recall · history · facts Scoping: promote (share a session/episode to a team scope) Governance: forget · edit · exclude Admin: consolidate

The CPET (customer:product:env:tenant) is sent as X-Customer/X-Product/X-Env/ X-Tenant headers; pass —token for the JWT and —scope-claim for the signed scope-claim when the service enforces them. Endpoint and CPET default from the KIS_SMRITI_ENDPOINT / KIS_CUSTOMER / KIS_PRODUCT / KIS_ENV / KIS_TENANT env vars.

kis ai memory [command]
SubcommandPurpose
appendDurably record a turn into a session
closeEnd a session (triggers T1 consolidation)
editCorrect/add/delete a memory (user edits take precedence)
eventRecord a memory-relevant event
excludeAdd a per-scope “do not remember X” exclusion
factsList facts about a subject (current, or as-of a time)
forgetErase memory and propagate the deletion (right-to-forget)
historyPrint a session’s recent history, oldest-first
promoteRe-tag a session or episode to a (team) scope
recallRecall ranked, budget-fit memory across scopes
startOpen a memory session for a subject under an owner scope
FlagPurpose
-e, --endpoint stringsmriti service base URL (default “http://localhost:8080”)

List the models a provider offers, with capabilities.

Cloud providers list their declared catalog. For ollama, the locally-installed models are listed live via /api/tags (with an inferred kind: chat/code/vision/ embed). vllm/llamacpp ship no catalog — pass —model and call directly.

Examples: kis ai models -p ollama # locally installed models kis ai models -p anthropic kis ai models -p openai —json

kis ai models [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-j, --jsonprint as JSON
-m, --model stringmodel id (provider-specific; defaults per command)
-p, --provider stringprovider: ollama

List supported providers and their capabilities

kis ai providers [flags]
FlagPurpose
-j, --jsonprint as JSON

Ingest documents into a vector store, retrieve context, and answer questions grounded in that context — built on lib-ai/rag.

The store is chosen by —dsn: memory: in-process (per command; not shared across runs) pgvector://user:pass@host/db Postgres + pgvector chroma://host:8000 Chroma qdrant://host:6333 Qdrant duckdb:///path/to.db DuckDB (only if the binary was built -tags duckdb)

Cross-command RAG (ingest then answer) needs a persistent DSN (pgvector/chroma/ qdrant/duckdb-file); memory: lives only for one command.

Examples: kis ai rag ingest —dsn “pgvector://app:app@localhost:5432/kb?sslmode=disable”
—collection notes -p ollama —embed-model nomic-embed-text notes/*.md kis ai rag answer —dsn “pgvector://app:app@localhost:5432/kb?sslmode=disable”
—collection notes -p ollama -m llama3.2:3b “what did we decide about X?”

kis ai rag [command]
SubcommandPurpose
answerRetrieve context and answer the query, grounded in the store
ingestChunk, embed and store documents (files as args, or text on stdin)
retrieveRetrieve the most relevant chunks for a query
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-j, --jsonJSON output
-m, --model stringmodel id (provider-specific; defaults per command)
-p, --provider stringprovider: ollama

Run a prompt through a reasoning strategy from lib-ai.

Prompt strategies (single model call, structured prompting): cot chain-of-thought (“think step by step”) structured-cot phased CoT (—phases “understand,plan,solve,verify”) plan-and-solve plan-and-solve prompting

Iterative algorithms (multiple model calls): tot Tree-of-Thoughts: branch + judge + beam search (—width —depth —beam, —judge) reflexion generate -> critique -> revise (—rounds, —judge as critic) self-refine single-model reflexion (—rounds) debate N models argue, a judge decides (—models, —judge, —rounds)

—trace prints the reasoning trace (tot/reflexion/self-refine/debate).

These strategies make the model THINK IN PROSE — they do no arithmetic. For calculations or data tasks (e.g. “how many tons of X”), use ‘kis ai solve’, which writes and executes a program. Quality is bound by the model: the iterative modes need a capable one (pass -m; the ollama default llama3.2:3b is too small for tot/reflexion/debate).

Examples: kis ai reason —mode cot “If a train travels 60km in 1.5h, its speed?” kis ai reason —mode tot —width 3 —depth 3 “Solve the 24 game with 4 6 7 8” kis ai reason —mode reflexion —rounds 3 “Write a precise definition of overfitting” kis ai reason —mode debate —models “openai:gpt-4o,anthropic:claude-sonnet-4-6” “Is P=NP likely?”

kis ai reason [prompt] [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-m, --model stringmodel id (provider-specific; defaults per command)
-p, --provider stringprovider: ollama

Rerank documents via a rerank-capable provider (cohere, tei).

Examples: kis ai rerank -p cohere “best laptop for dev” “MacBook Pro” “Chromebook” “ThinkPad” kis ai rerank -p tei -e http://localhost:8080 “query” “doc a” “doc b” —top-n 1

kis ai rerank <query> <document>... [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-j, --jsonprint results as JSON
-m, --model stringmodel id (provider-specific; defaults per command)
-p, --provider stringprovider: ollama

Run a prompt through a sampling strategy:

self-consistency call one model N times, majority-vote the answer best-of-n sample N candidates, judge the best cross-provider send to several models, judge the best (—models) race call several models, return the first to finish (—models)

—models is a comma-separated list of provider:model refs.

Examples: kis ai sample —mode self-consistency -n 5 “tricky reasoning question” kis ai sample —mode cross-provider —models “openai:gpt-4o,anthropic:claude-sonnet-4-6” ”…” kis ai sample —mode race —models “groq:llama-3.3-70b-versatile,openai:gpt-4o-mini” ”…”

kis ai sample [prompt] [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-m, --model stringmodel id (provider-specific; defaults per command)
-n, --n intnumber of samples (self-consistency, best-of-n) (default 5)
-p, --provider stringprovider: ollama

Manage file-backed conversations under ~/.kisai/ai/sessions.

kis ai session [command]
SubcommandPurpose
listList stored conversations
newCreate a new conversation id
sendAppend a message to a conversation and print the reply
showPrint a conversation’s messages

Have the model WRITE a small JavaScript program for the task, then execute it in the the script engine engine and print the program’s result. The model plans; the engine computes — no arithmetic hallucinations.

Security: by default the script runs in a PURE sandbox (plain JavaScript only — no file, network, or shell access). Namespaces are opted in with —allowed and enforced by the engine itself, not just the prompt:

kis ai solve “how many r letters are in the word strawberry” kis ai solve —allowed file “mean, median and mode of the salary column in /tmp/pay.csv” kis ai solve —allowed file,db “join users.csv and orders.csv on id; top 5 by total” cat data.txt | kis ai solve “median of the numbers in this list” # stdin → ‘input’ var

Posture: the generated code is printed and you are asked before it executes. —exec skips the confirmation (code still shown); —silent also hides the code; —dry-run prints the code and never executes. With —attempts N > 1, script errors are fed back to the model to fix its code and retry.

Tip: a code model generates better programs, e.g. -m qwen3-coder:30b (ollama).

kis ai solve [task] [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-j, --jsonprint the result as JSON
-m, --model stringmodel id (provider-specific; defaults per command)
-p, --provider stringprovider: ollama

Produce JSON conforming to a JSON Schema. Input is args or stdin; the schema is a file path or inline JSON via —schema.

Examples: kis ai structured —schema person.json “John Smith, 42, lives in NYC” echo “$INVOICE” | kis ai structured —schema ./invoice.json -p openai kis ai structured —schema fields.json —prompt-file prompts.yaml —prompt parse_invoice —vars [email protected]

kis ai structured [text] [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-m, --model stringmodel id (provider-specific; defaults per command)
-p, --provider stringprovider: ollama
-s, --system stringsystem prompt
-v, --vars stringArraytemplate var key=value (repeatable); value may be @file or @- to read stdin

Count tokens for the given text (args, —file, or stdin).

By default this is lib-ai’s heuristic counter (a safe slight over-estimate). For an EXACT count against a local model, use —exact with -p llamacpp pointed at a llama.cpp server (uses its native /tokenize).

Examples: kis ai tokens “how many tokens is this?” kis ai tokens —file ./prompt.txt -p openai -m gpt-4o kis ai tokens —exact -p llamacpp -e http://localhost:8080/v1 —file big.txt

kis ai tokens [text] [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-j, --jsonprint result as JSON
-m, --model stringmodel id (provider-specific; defaults per command)
-p, --provider stringprovider: ollama

Transcribe audio via an STT-capable provider (openai, groq, deepgram, whispercpp).

Examples: kis ai transcribe -p openai call.mp3 kis ai transcribe -p whispercpp -e http://localhost:8080/v1 audio.wav —json kis ai transcribe -p groq -m whisper-large-v3 interview.m4a —timestamps

kis ai transcribe <audio-file> [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-j, --jsonprint full result (text + segments) as JSON
-m, --model stringmodel id (provider-specific; defaults per command)
-p, --provider stringprovider: ollama

Synthesize speech via a TTS-capable provider (openai, deepgram).

Examples: kis ai tts -p openai “hello there” —voice alloy -o hello.mp3 echo “good morning” | kis ai tts -p deepgram -o gm.mp3

kis ai tts <text> [flags]
FlagPurpose
-k, --api-key stringAPI key (else env var, e.g. OPENAI_API_KEY)
-e, --endpoint stringoverride the provider endpoint/base URL
-m, --model stringmodel id (provider-specific; defaults per command)
-o, --out stringoutput audio file; default speech.
-p, --provider stringprovider: ollama

execute rules on json files in a directory

kis rules [flags]
FlagPurpose
-b, --bbox stringsbounding box json file to inject. Format: [key=]filepath (default key: bbox)
-f, --facts stringsfacts to be passed to the engine as json file. Pass key and filename, separated by =
-i, --input stringinput directory with json files to be processed (default ”.”)
-k, --key stringkey under which to add the result. by default it will add to root of json file
-o, --output stringoutput directory to write result json files. Same as input, if not provided.
-p, --pattern stringglob pattern for the file to be processed (default “*.json”)
-R, --recursiverecursively search for rule files in subdirectories
-r, --rules stringsa single rule file or directory with rules
-v, --vars stringsvariables to inject into the rules engine as key=value pairs
-w, --workers intnumber of workers for parallel rule execution (default 1)

Commands for loading and analyzing bbox/OCR documents.

Each command loads one or more bbox files, treating each as a page, and performs analysis operations on the combined document.

Subcommands: tables - Detect and print all tables from bbox files table - Find and print a single table near an anchor text phrase - Search for a phrase and print locations with context snippet - Extract text between a starting and ending phrase snippets - Extract multiple named snippets as JSON

kis bbox [command]
SubcommandPurpose
phraseSearch for a phrase and print locations with context
snippetExtract text between a starting and ending phrase
snippetsExtract multiple named snippets from bbox files
tableFind and print a single table near an anchor text
tablesDetect and print all tables from bbox files

Search for a phrase in bbox files and print all occurrences with location and context.

The search is case-sensitive by default and handles multi-word phrases. For each match, it shows the page, bounding box location, and surrounding lines for context.

Input files can be specified as positional arguments (supports shell glob patterns) or using the -i flag (can be repeated).

Use —before (-B) and —after (-A) to control how many context lines to show. Use —case-insensitive to ignore case when matching.

Use —fuzzy to enable fuzzy matching with Levenshtein distance, which helps find phrases with OCR spelling errors. Control the tolerance with —max-dist-word (per word) and —max-dist-total (total for phrase).

Examples: kis.ai bbox phrase -p “Invoice Number” doc.bbox kis.ai bbox phrase -p “Invoice Number” .bbox kis.ai bbox phrase -p “invoice number” —case-insensitive doc.bbox kis.ai bbox phrase -p “total amount due” -B 5 -A 2 doc.bbox kis.ai bbox phrase -i page1.bbox -i page2.bbox -p “signature required” -f json kis.ai bbox phrase -p “Inviice Numbr” —fuzzy doc.bbox kis.ai bbox phrase -p “signature” —fuzzy —case-insensitive 105718727*.bbox

kis bbox phrase [files...] [flags]
FlagPurpose
-A, --after intnumber of lines after match to show (default 3)
-B, --before intnumber of lines before match to show (default 3)
-f, --format stringoutput format: text, json (default “text”)
-i, --input stringArraypath to bbox file (can be specified multiple times)
-o, --output stringoutput file path (defaults to stdout)
-p, --phrase stringphrase to search for

Extract all text between a starting phrase and an ending phrase from bbox files.

The starting phrase is included in the output, while the ending phrase is excluded by default (use —include-end to include it). The extraction works across page boundaries.

Input files can be specified as positional arguments (supports shell glob patterns) or using the -i flag (can be repeated).

Examples: kis.ai bbox snippet -s “Section 5:” -e “Section 6:” doc.bbox kis.ai bbox snippet -s “TERMS AND CONDITIONS” -e “SIGNATURE” *.bbox kis.ai bbox snippet -s “start” -e “end” —case-insensitive doc.bbox kis.ai bbox snippet -s “BEGIN” -e “END” —include-end -f json doc.bbox

kis bbox snippet [files...] [flags]
FlagPurpose
-e, --end stringending phrase (excluded from output by default)
-f, --format stringoutput format: text, json (default “text”)
-i, --input stringArraypath to bbox file (can be specified multiple times)
-o, --output stringoutput file path (defaults to stdout)
-s, --start stringstarting phrase (included in output)

Extract multiple text snippets between starting and ending phrases from bbox files.

Each snippet is defined using —snip with the format “name|start phrase|end phrase”. The output is a JSON object where keys are the snippet names and values are the extracted text.

Input files can be specified as positional arguments (supports shell glob patterns) or using the -i flag (can be repeated).

Examples: kis.ai bbox snippets —snip “section8|Section 8:|Section 9:” doc.bbox kis.ai bbox snippets —snip “terms|TERMS AND CONDITIONS|SIGNATURE” —snip “privacy|PRIVACY|END” *.bbox kis.ai bbox snippets —snip “intro|Introduction|Chapter 1” —case-insensitive doc.bbox

kis bbox snippets [files...] [flags]
FlagPurpose
-i, --input stringArraypath to bbox file (can be specified multiple times)
-o, --output stringoutput file path (defaults to stdout)

Load bbox files, find a table near the specified anchor text, and print it.

Input files can be specified as positional arguments (supports shell glob patterns) or using the -i flag (can be repeated).

The —anchor flag specifies text to search for, and the nearest table to that text will be returned.

Optionally use —header flags to validate that the table contains expected column headers.

Examples: kis.ai bbox table -a “Invoice Items” doc.bbox kis.ai bbox table -a “Invoice Items” *.bbox kis.ai bbox table -a “Price List” -H “Item” -H “Price” -H “Qty” doc.bbox kis.ai bbox table -a “Summary” -f json -o table.json doc.bbox

kis bbox table [files...] [flags]
FlagPurpose
-a, --anchor stringanchor text to find table near
-f, --format stringoutput format: text, json, csv (default “text”)
-H, --header stringArrayexpected column header (can be specified multiple times for validation)
-i, --input stringArraypath to bbox file (can be specified multiple times)
-o, --output stringoutput file path (defaults to stdout)

Load multiple bbox files, treat each as a page, detect all tables, and print them.

Input files can be specified as positional arguments (supports shell glob patterns) or using the -i flag (can be repeated).

Examples: kis.ai bbox tables page1.bbox page2.bbox kis.ai bbox tables *.bbox kis.ai bbox tables -i page1.bbox -i page2.bbox kis.ai bbox tables doc.json -f json kis.ai bbox tables *.bbox -f csv kis.ai bbox tables doc.bbox -o tables.txt

kis bbox tables [files...] [flags]
FlagPurpose
-f, --format stringoutput format: text, json, csv (default “text”)
-i, --input stringArraypath to bbox file (can be specified multiple times)
-o, --output stringoutput file path (defaults to stdout)

Execute rules on OCR data where each page is a .json file (facts) paired with a matching .bbox file (bounding boxes), resolved by basename.

Pass prefixes (or .json/.bbox file paths — the extension is stripped) as positional arguments. For each prefix, both .json and .bbox must exist.

Subcommands: page Run rules independently on each prefix (one execution per page). doc Aggregate all prefixes into a single document — facts become an array and bbox files merge into a single multi-page bbox doc — and run rules once.

kis ocr [command]
SubcommandPurpose
docaggregate prefixes into one document and run rules once
pagerun rules on each prefix independently (one execution per page)

Aggregate all prefixes into a single document and run rules once. The per-page .json files are injected as an array under —facts-key (default “pages”), and the .bbox files are merged into a single multi-page bbox document with sequentially renumbered pages, injected under —bbox-name (default “doc”).

Positional arguments may be:

  • a name prefix (resolved against -i)
  • a .json or .bbox file path (extension stripped)
  • a directory (globbed with -p, default “*.json”)

If no positional args are given, the -i directory itself is globbed with -p. Duplicates are removed.

Examples: kis ocr doc -r rules.grl page1 page2 page3 kis ocr doc -r rules/ pages/*.json kis ocr doc -r rules/ pages/ # all .json in pages/ kis ocr doc -r rules/ -i pages/ # same, via -i kis ocr doc -r rules/ -i pages/ -p “page.json” # custom glob kis ocr doc -r rules/ -o result.json pages/ kis ocr doc -r rules/ —facts-key documents pages/

kis ocr doc [prefix|file|dir]... [flags]
FlagPurpose
-f, --facts stringsextra facts files (key=path or path)
-i, --input stringbase directory for resolving prefix files (also used when no positional args are given) (default ”.”)
-k, --key stringkey under which to add the rule result
-o, --output stringoutput file (doc) or directory (page); stdout/in-place if not set
-p, --pattern stringglob pattern (basename, e.g. “page*.json”) used when a positional arg is a directory or when no positional args are given (default “*.json”)
-r, --rules stringsrule file or directory with rules
-v, --vars stringsextra variables to inject (key=value)

Run rules independently for each prefix. For each prefix, both .json (facts) and .bbox (bounding boxes) must exist; both are injected into the rules engine and rules are executed once per prefix.

Positional arguments may be:

  • a name prefix (resolved against -i)
  • a .json or .bbox file path (extension stripped)
  • a directory (globbed with -p, default “*.json”)

If no positional args are given, the -i directory itself is globbed with -p. Duplicates are removed.

Examples: kis ocr page -r rules.grl page1 kis ocr page -r rules/ page1 page2 page3 kis ocr page -r rules/ pages/*.json kis ocr page -r rules/ pages/ # all .json in pages/ kis ocr page -r rules/ -i pages/ # same, via -i kis ocr page -r rules/ -i pages/ -p “page.json” # custom glob kis ocr page -r rules/ -i data/ -o results/ page1 page2 kis ocr page -r rules/ —update pages/

kis ocr page [prefix|file|dir]... [flags]
FlagPurpose
-f, --facts stringsextra facts files (key=path or path)
-i, --input stringbase directory for resolving prefix files (also used when no positional args are given) (default ”.”)
-k, --key stringkey under which to add the rule result
-o, --output stringoutput file (doc) or directory (page); stdout/in-place if not set
-p, --pattern stringglob pattern (basename, e.g. “page*.json”) used when a positional arg is a directory or when no positional args are given (default “*.json”)
-r, --rules stringsrule file or directory with rules
-v, --vars stringsextra variables to inject (key=value)
-w, --workers intnumber of workers for parallel page execution (default 1)

convert hocr to bounding box json file

kis hocr2bbox [flags]
FlagPurpose
-i, --input stringpath to hocr file or directory containing hocr files
-o, --output stringoutput file (for single file input) or directory (for directory input); defaults to input location
-v, --verboseenable verbose mode to warn about potentially missed content
-w, --workers intnumber of parallel workers for directory processing (default 4)

this command provides multiple options to generate synthetic data of various forms

kis synthetic [command]
SubcommandPurpose
float32generates random float32 number(s) based on different flags
fuzzysentencegenerates random fuzzy sentence(s) based on a given template
fuzzywordgenerates random fuzzy word(s) based on a given template
intgenerates random integer(s) based on different flags
sentencegenerates random sentence(s) based on different flags
supportedcollectionlist all supported data collections
synonymsentencegenerates random sentence(s) with words replaced by their synonyms
wordgenerates random word(s) based on different flags
FlagPurpose
-c, --count intcount of times to generate (default 1)

this command generates float32 number(s) based on the min, max and count flags

kis synthetic float32 [flags]

this command generates random fuzzy sentence(s) base on the given template.

kis synthetic fuzzysentence [flags]
FlagPurpose
-t, --template stringthis defines the template which should be used to generate the sentences with synonyms from (required)

this command generates random fuzzy word(s) base on the given template.

kis synthetic fuzzyword [flags]
FlagPurpose
-t, --template stringthis defines the template which should be used to generate the words with synonyms from (required)

this command generates integer(s) based on the min, max and count flags

kis synthetic int [flags]

this command generates random sentence(s) depending on different flags like minlen, maxlen, region(future implementation)

kis synthetic sentence [flags]
FlagPurpose
-r, --region stringthis defines the region from which the sentences should be generated (default “en-us”)

this command lists all supported data collections for a given region.

kis synthetic supportedcollection [flags]
FlagPurpose
-r, --region stringthis specifies the region for which the command should list the collections for (default “en-us”)

this command generates random sentence(s) based on the given template.

kis synthetic synonymsentence [flags]
FlagPurpose
-r, --region stringthis defines the region from which the synonyms should be generated (default “en-us”)
-s, --synonym stringsthis defines the words you want replaced by their synonyms (if they exist) from the given template. If they are not present, the template is returned as is.
-t, --template stringthis defines the template which should be used to generate the sentences with synonyms from (required)

this command generates random word(s) depending on different flags like minlen, maxlen, region(future implementation)

kis synthetic word [flags]
FlagPurpose
-r, --region stringthis defines the region from which the words should be generated (default “en-us”)
-s, --synonym stringthis defines the word whose synonym you want generated. when this is present, flags like min, max and count are ignored
-t, --template stringthis defines the collection which should be used to generate the words from (default “word”)