Tiangong KB Course Search
Use this skill for Tiangong course-source retrieval. It is intentionally
single-source: always search course, never all, edu, or textbook.
Prerequisites
- The wrapper defaults to
npx @tiangong-ai/cli@0.0.19; users do not need a preinstalled CLI. SetTIANGONG_AI_CLIorTIANGONG_AI_CLI_BINonly to override the CLI entrypoint. - Course search should use bearer auth. Pass
bearer_token; if onlyapi_keyis provided to this wrapper, it is also forwarded as--bearer-tokenso the CLI emitsAuthorization: Bearer ...for the course source. - When
request_file/input_fileis provided, the wrapper loads.envfrom that file's directory by default.env_filecan point to a different dotenv file. Loaded dotenv values only fill unset environment variables; explicit JSON fields such asapi_key,bearer_token, andapi_base_urlare passed as CLI flags and take precedence. - 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/course_search.sh '{
"query": "马约翰 清华 体育 孙立人 梁实秋 钱三强",
"top_k": 8,
"ext_k": 20
}'
The script calls:
npx @tiangong-ai/cli@0.0.19 education search --query <query> --sources course --json
For exact edge-function payloads, provide request_file or input_file:
./scripts/course_search.sh '{
"request_file": "./course-request.json",
"dry_run": true
}'
The script calls:
npx @tiangong-ai/cli@0.0.19 education search --input <request.json> --sources course --json
Raw Payload Filters
Wrapper JSON can include inline raw course_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": {
"tags": ["thu_humanities"]
},
"topK": 8,
"extK": 20
}
filter: metadata term filters, shaped as{ "field": ["value"] }. Course collections currently use metadata keys such astagsandraw_relative_pathwhen those keys are indexed for the collection.topK,extK: raw edge-function names for result count and adjacent chunk expansion.datefilteris not exposed by this wrapper for course 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,topK,extK: optional inline raw payload fields for course search.sources: optional compatibility field; onlycourseordefaultis accepted.dry_run: true to return the exact request plan with masked credentials.api_base_url,api_key,bearer_token,course_api_key. For course search, preferbearer_token;api_keyis treated as the same token whenbearer_tokenis omitted.course_url,region,timeout.top_k,ext_k: only used in query mode.
When writing reader-facing prose from retrieved results, state historical facts directly and cite source titles when useful. Do not mention retrieval mechanics, source grouping, or internal confidence checks.