Tiangong KB Textbook Search
Use this skill for Tiangong textbook-source retrieval. It is intentionally
single-source: always search textbook, never all, course, or edu.
Prerequisites
- The wrapper defaults to the exact reviewed entrypoint
npx --yes --package "@tiangong-ai/cli@0.0.62" -- tiangong-ai; users do not need a
preinstalled CLI. Set TIANGONG_AI_CLI or TIANGONG_AI_CLI_BIN only to
override the CLI entrypoint intentionally.
- Set
TIANGONG_TEXTBOOK_APIKEY or TIANGONG_AI_APIKEY. Credentials are never
accepted in wrapper JSON, request files, URLs, or CLI arguments.
- When
request_file / input_file is provided, the wrapper loads .env from
that file's directory by default. env_file can point to a different dotenv
file. It must be an owner-only regular non-symlink file (chmod 600), and
only documented Tiangong variables are loaded. Existing process variables win.
- Optionally set
TIANGONG_AI_API_BASE_URL; the CLI accepts a Supabase project
root, /functions/v1, or /rest/v1 and derives Functions URLs.
Search
For normal searches, pass a query:
./scripts/textbook_search.sh '{
"query": "activated sludge process principles",
"top_k": 5
}'
The script calls:
npx --yes --package "@tiangong-ai/cli@0.0.62" -- tiangong-ai education search --query <query> --sources textbook --json
For exact edge-function payloads, provide request_file or input_file:
./scripts/textbook_search.sh '{
"request_file": "./textbook-request.json",
"dry_run": true
}'
Raw Payload Filters
Wrapper JSON can include inline raw textbook_search fields; the wrapper will
forward them through the CLI --input path. The same payload can also be put in
request_file / input_file:
{
"query": "如何减排二氧化碳?",
"filter": {
"isbn_number": ["9787030641274"]
},
"datefilter": {
"publication_date": { "gte": 1262304000 }
},
"topK": 5,
"extK": 1
}
filter: metadata term filters, shaped as { "field": ["value"] }.
datefilter: numeric range filters, shaped as
{ "field": { "gte"?: number, "lte"?: number } }, for indexed numeric/date
metadata fields.
topK, extK: raw edge-function names for result count and adjacent chunk
expansion.
getMeta is not supported by textbook_search.
Input Fields
query or input: convenience query text.
request_file or input_file: JSON body forwarded unchanged.
env_file: optional dotenv file. Without it, request_file /
input_file causes the wrapper to load .env from that file's directory.
filter, datefilter, topK, extK: optional inline raw payload fields
for textbook search.
sources: optional compatibility field; only textbook or default is
accepted.
dry_run: true to return the exact request plan with masked credentials.
api_base_url, textbook_url, region, timeout as non-secret routing values.
top_k, ext_k: only used in query mode.
1---2name: tiangong-kb-textbook-search-23description: Search Tiangong knowledge-base textbook sources through the Tiangong AI CLI. Use for textbook-style explanations and reference material only. This skill searches only the textbook source, not course or edu.4---56# Tiangong KB Textbook Search78Use this skill for Tiangong textbook-source retrieval. It is intentionally9single-source: always search `textbook`, never `all`, `course`, or `edu`.1011## Prerequisites1213- The wrapper defaults to the exact reviewed entrypoint14 `npx --yes --package "@tiangong-ai/cli@0.0.62" -- tiangong-ai`; users do not need a15 preinstalled CLI. Set `TIANGONG_AI_CLI` or `TIANGONG_AI_CLI_BIN` only to16 override the CLI entrypoint intentionally.17- Set `TIANGONG_TEXTBOOK_APIKEY` or `TIANGONG_AI_APIKEY`. Credentials are never18 accepted in wrapper JSON, request files, URLs, or CLI arguments.19- When `request_file` / `input_file` is provided, the wrapper loads `.env` from20 that file's directory by default. `env_file` can point to a different dotenv21 file. It must be an owner-only regular non-symlink file (`chmod 600`), and22 only documented Tiangong variables are loaded. Existing process variables win.23- Optionally set `TIANGONG_AI_API_BASE_URL`; the CLI accepts a Supabase project24 root, `/functions/v1`, or `/rest/v1` and derives Functions URLs.2526## Search2728For normal searches, pass a query:2930```bash31./scripts/textbook_search.sh '{32 "query": "activated sludge process principles",33 "top_k": 534}'35```3637The script calls:3839```bash40npx --yes --package "@tiangong-ai/cli@0.0.62" -- tiangong-ai education search --query <query> --sources textbook --json41```4243For exact edge-function payloads, provide `request_file` or `input_file`:4445```bash46./scripts/textbook_search.sh '{47 "request_file": "./textbook-request.json",48 "dry_run": true49}'50```5152## Raw Payload Filters5354Wrapper JSON can include inline raw `textbook_search` fields; the wrapper will55forward them through the CLI `--input` path. The same payload can also be put in56`request_file` / `input_file`:5758```json59{60 "query": "如何减排二氧化碳?",61 "filter": {62 "isbn_number": ["9787030641274"]63 },64 "datefilter": {65 "publication_date": { "gte": 1262304000 }66 },67 "topK": 5,68 "extK": 169}70```7172- `filter`: metadata term filters, shaped as `{ "field": ["value"] }`.73- `datefilter`: numeric range filters, shaped as74 `{ "field": { "gte"?: number, "lte"?: number } }`, for indexed numeric/date75 metadata fields.76- `topK`, `extK`: raw edge-function names for result count and adjacent chunk77 expansion.78- `getMeta` is not supported by `textbook_search`.7980## Input Fields8182- `query` or `input`: convenience query text.83- `request_file` or `input_file`: JSON body forwarded unchanged.84- `env_file`: optional dotenv file. Without it, `request_file` /85 `input_file` causes the wrapper to load `.env` from that file's directory.86- `filter`, `datefilter`, `topK`, `extK`: optional inline raw payload fields87 for textbook search.88- `sources`: optional compatibility field; only `textbook` or `default` is89 accepted.90- `dry_run`: true to return the exact request plan with masked credentials.91- `api_base_url`, `textbook_url`, `region`, `timeout` as non-secret routing values.92- `top_k`, `ext_k`: only used in query mode.