Experiment Data Extraction
One script, one chain: md -> preprocess -> GLM filter -> LLM -> JSON. No manifests, no run state, no monitoring — just extraction. A single model service (Zhipu BigModel, default glm-5.3-flash) powers both the sentence filter and the extraction.
Pre-flight
- Install
requestsfromrequirements.txt. BIGMODEL_API_KEYmust be set — it authenticates BOTH model stages (sentence filter + extraction) asAuthorization: Bearer(OPENAI_API_KEYaccepted as fallback). Never print key values. No other credential or internal service is used.- Optional overrides (env or flags):
LLM_CHAT_URL— defaulthttps://open.bigmodel.cn/api/paas/v4/chat/completions(used by both stages)LLM_MODEL— defaultglm-5.3-flash(fast variant, used by both stages;glm-5.3/glm-5.2also valid)
- Input is the paper's markdown: a LOCAL file (
--md/--md-dir), orpaper_id,md_urlCSV rows (--csv, md downloaded to--md-cache, cached across re-runs). Local mode: file stem = paper_id.
Run
bash# single paper python3 extract_experiments.py --md /path/to/paper.md -o out.json # batch: one md per paper, named <paper_id>.md python3 extract_experiments.py --md-dir md_papers/ -o-dir out_json/ # batch from paper_id + md_url (CSV: header paper_id,md_url; md downloaded to md_cache/) python3 extract_experiments.py --csv papers.csv --md-cache md_cache/ -o-dir out_json/
Per-paper failures don't stop the batch; exit code 2 means at least one failed. CSV downloads are cached — re-runs skip already-downloaded papers.
Output
One JSON per paper: paper_id, paper_title, research_problem(_description/_aliases), domain, experiments[] (name, type, methods, datasets, metrics, key_results, conclusion, limitations, evidence), plus stats (sentence counts, filter backend, elapsed). Schema identical to the production workflow's predictions.
API contract
The skill contacts exactly ONE service: the public Zhipu BigModel chat-completions API. No internal/AMiner gateway is called anywhere (the SciBERT /filter/batch path was removed; stale vendored call sites raise explicitly).
- Sentence filter (Stage-A, GLM): one chat call to
{LLM_CHAT_URL}with a numbered-sentence scoring prompt (system prompt + user prompt,temperature: 0.05). GLM returns{"kept": [{"i", "score"}, ...]}; client keeps score ≥ 0.6 (frozen threshold), original order, cap 60 (WF4_MAX_QWEN_SENTENCES). Unparseable response is a hard error; an explicitly empty kept list is a legitimate "no experiment sentences" result. - Extraction (Stage-B):
POST {LLM_CHAT_URL}(Zhipu BigModelhttps://open.bigmodel.cn/api/paas/v4/chat/completions, default modelglm-5.3-flash) standard OpenAI messages format,stream: false,temperature: 0.05,max_tokens: 2048(frozen). Auth:Authorization: Bearer $BIGMODEL_API_KEY. - Paper md download (
--csvmode) fetches the user-providedmd_url(public OSS/HTTP link) into--md-cache; no AMiner API is queried. Non-http(s), localhost/private-network, and metadata-host URLs are refused, redirects are re-validated per hop, and downloads are size-capped (same policy asaminer-pdf-ocr).


