Imported from tiangong-ai/agent-skills (
tiangong-kb-textbook-search/SKILL.md). Install upstream withnpx skills add tiangong-ai/agent-skills --skill tiangong-kb-textbook-search. Copyright stays with the author.
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. SetTIANGONG_AI_CLIorTIANGONG_AI_CLI_BINonly to override the CLI entrypoint intentionally. - Set
TIANGONG_TEXTBOOK_APIKEYorTIANGONG_AI_APIKEY. Credentials are never accepted in wrapper JSON, request files, URLs, or CLI arguments. - When
request_file/input_fileis provided, the wrapper loads.envfrom that file's directory by default.env_filecan 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/v1and 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.getMetais not supported bytextbook_search.
Input Fields
queryorinput: convenience query text.request_fileorinput_file: JSON body forwarded unchanged.env_file: optional dotenv file. Without it,request_file/input_filecauses the wrapper to load.envfrom that file's directory.filter,datefilter,topK,extK: optional inline raw payload fields for textbook search.sources: optional compatibility field; onlytextbookordefaultis accepted.dry_run: true to return the exact request plan with masked credentials.api_base_url,textbook_url,region,timeoutas non-secret routing values.top_k,ext_k: only used in query mode.