Skip to content

Knowledge layer

Sanni heruwala edited this page Jun 12, 2026 · 1 revision

Knowledge layer + Studio

The NotebookLM-style layer that sits next to your notebook canvas. Pull SQL, schemas, results, charts, and notes into a "knowledge notebook," then ask grounded questions or generate structured briefings.


Sources

Anything you add via the Knowledge drawer (top-right) is a source. Current source types:

  • sql_query · the SQL of a cell
  • query_result · a result snapshot
  • chart · a chart configuration
  • markdown · free-form note
  • schema · a captured table schema (cols, types)
  • profile · a profile snapshot (stats, PII flags)
  • uploaded_file · pointer to an uploaded file
  • web_link · just a URL + title
  • business_definition · a glossary entry

Per-source content is what gets sent to the LLM — credentials and PII-flagged columns are stripped first.


Chat with citations

Open the knowledge drawer's chat. Ask a question. The model:

  1. Reads only the sources you have in the notebook (no general web knowledge).
  2. Emits [n] citation markers tied to specific sources.
  3. Returns a Markdown answer.

The frontend (rednotebook/components/panels/knowledge-chat.tsx) turns each [n] into a clickable chip. Clicking scrolls the cited source card into view and pulses it with a ring border. A "Cited" footer at the bottom of each assistant reply lists every source used.

If you ask something the sources don't cover, the model says "Not in the provided sources." rather than inventing.


Studio — one-click structured briefings

Click Studio in the knowledge panel. The endpoint (POST /api/knowledge/studio) makes parallel calls for four sections:

Tab What it produces
Overview 2-3 paragraph executive summary of the notebook's subject.
FAQ 6-8 Q/A pairs a stakeholder might ask, with [n] citations.
Study guide Key terms, core open questions, "read this if you want to know" pointers.
Ask next 8 follow-up SQL-ish questions an analyst could run.

Each section is its own LLM call so a transient failure on one doesn't lose the rest. Citations are deduplicated across sections.


Provider routing

Studio + chat both route through the configured AI provider — see AI providers. The mock provider returns deterministic stubs (great for CI / demos), real providers do the actual work.


Architecture pointers

If you want to extend the knowledge layer:

  • rednotebook/knowledge/ — models, store, source builder, citations.
  • rednotebook/knowledge/store.pyInternalKnowledgeStore, per-user filesystem-backed JSON.
  • rednotebook/server/routers/knowledge.py — chat + studio endpoints.
  • rednotebook/notebook/publisher.py — the publish renderer reuses markdown-it for knowledge note cells too.

The third-party-provider experiment (notebooklm_enterprise_provider.py) is off by default. Internal store is the canonical implementation.

Clone this wiki locally