-
Notifications
You must be signed in to change notification settings - Fork 0
Knowledge layer
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.
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.
Open the knowledge drawer's chat. Ask a question. The model:
- Reads only the sources you have in the notebook (no general web knowledge).
- Emits
[n]citation markers tied to specific sources. - 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.
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.
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.
If you want to extend the knowledge layer:
-
rednotebook/knowledge/— models, store, source builder, citations. -
rednotebook/knowledge/store.py—InternalKnowledgeStore, 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.