NotebookLM Research (Gemini long-context)
NotebookLM-equivalent analysis of large documents. NotebookLM has no official public API, so this is built on the Gemini API using gemini-3.1-pro-preview (~1M-token context). Grounds answers in your documents; supports Arabic + English.
When to use
- Summarize / question / extract from large PDFs, txt, md.
- Multi-document synthesis grounded in sources.
Setup
- Env:
GEMINI_API_KEY(orGOOGLE_API_KEY). Both present insecrets/env.sh. - Python stdlib +
requestsonly. - Optional model override:
NBLM_MODEL(defaultgemini-3.1-pro-preview).
Usage
bash
. /data/.openclaw/secrets/env.sh
Ask (Arabic)
python3 scripts/analyze_docs.py --files report.pdf --ask "ما الفكرة الرئيسية؟" --lang ar
Summarize / Extract
python3 scripts/analyze_docs.py --files a.pdf b.txt --summarize
python3 scripts/analyze_docs.py --files notes.md --extract "dates, names, amounts"
NEW — shareable report (NotebookLM-style)
python3 scripts/analyze_docs.py --files spec.pdf --report --lang ar
NEW — audio overview (spoken summary -> MP3 via OUR TTS arsenal, failover-safe)
python3 scripts/analyze_docs.py --files spec.pdf --audio /tmp/overview.mp3 --lang ar
2026 update + dual-account
- NotebookLM (the product) moved to Gemini 3.5 default + source-repository-from-chat + reports + slide decks (2026-06-08). Still NO public API — this skill stays the Gemini-based equivalent.
- Dual Google accounts (Kuwaiti GEMINI_API_KEY + US GEMINI_API_KEY_US) with automatic failover (never-stop).
- Outputs now include shareable report + audio overview (reuses media_failover.py TTS: Gemini Charon -> xai -> ElevenLabs WAEL -> MiniMax).
Integration with primary RAG (auto-routing)
- Primary RAG (ask.drwaelalkishawi.com) = our private full-corpus recall. ALWAYS primary for internal questions / our own knowledge.
- This skill = COMPLEMENT for quick shareable outputs from a defined source set: polished report, audio overview/podcast, or deck (via slideshow/HyperFrames).
- Auto-rule: internal recall / "what do we know about X" -> RAG + memory_search. "Make a shareable report/podcast/summary FROM these docs" -> this skill. Sensitive docs (family/real estate/KCPC) -> keep local, do NOT send to Gemini.
How it works
- Small text/md (<200KB) → sent inline for speed.
- PDFs / large / many files → uploaded via Gemini Files API (resumable upload, wait for
ACTIVE, reference by URI), then deleted after the call. --inlineforces inline (text only);--lang auto|ar|en.
Verified (2026-05-31)
gemini-3.1-pro-previewlive viav1beta/models/...:generateContent✅- Inline Arabic Q&A ✅
- Files API upload (resumable) + PDF Q&A + cleanup ✅
Limits
- True NotebookLM features (audio overview, notebook UI, citations-per-source) are not replicated; this is the analysis/Q&A core.
- Files API files auto-expire (~48h) on Google side; script also deletes them post-call.