Open Notebook Main Features: Privacy-First Research Platform with Multi-Model AI
Open Notebook is a self-hosted, privacy-first research assistant that combines universal content ingestion, multi-model AI support, and LangGraph-based workflows to deliver intelligent search, context-aware chat, and automated content transformation without sending data to external clouds.
Open Notebook is an open-source research platform designed to keep your data under your control while leveraging powerful AI capabilities. According to the lfnovo/open-notebook source code, the application architecture splits into a Next.js frontend, FastAPI backend, and SurrealDB graph database, providing a complete toolkit for managing research materials across multiple formats.
Universal Content Ingestion and Storage
Open Notebook handles universal content ingestion through a pipeline that extracts text from PDFs, videos, audio files, web pages, and Office documents. The ingestion workflow, defined in open_notebook/graphs/source.py, processes raw files into searchable Source records stored in SurrealDB.
Each source maintains vector embeddings for semantic search alongside full-text indexes. The open_notebook/utils/embedding.py module handles the creation and storage of these vectors, enabling rapid retrieval of relevant context during chat sessions.
Multi-Model AI Architecture
The ModelManager class in open_notebook/ai/models.py (line 98) provides a unified interface to 18+ AI providers including OpenAI, Anthropic, and Ollama. This architecture supports language models, embedding models, speech-to-text (STT), and text-to-speech (TTS) services through the Esperanto library.
By abstracting provider-specific implementations, the system allows users to mix and match models for different tasks. You can use GPT-4 for chat, local Ollama embeddings for privacy, and specialized TTS models for podcast generation within the same notebook.
Intelligent Search and Context-Aware Chat
Open Notebook implements intelligent search combining full-text and vector search capabilities via SurrealDB. When you submit a query, the system retrieves the most relevant source excerpts before synthesis, significantly reducing token usage and improving response accuracy.
The chat functionality runs through a LangGraph workflow defined in open_notebook/graphs/chat.py (line 22). The ThreadState class manages conversation history while the graph orchestrates context retrieval, prompt building, and streaming responses from the selected LLM. This approach ensures that chat responses reference only the specific sources you have selected for context.
AI-Assisted Content Transformations
Beyond simple chat, Open Notebook supports customizable transformations that process content through LangGraph nodes. These transformations enable summarization, structured data extraction, citation formatting, and custom pipeline-style processing defined by the user.
Each transformation runs as an isolated workflow, allowing you to chain multiple operations together. The results are stored as new notes or source records, creating a documented audit trail of how each piece of information was derived.
Professional Podcast Generation
The podcast generation feature transforms notebook content into multi-speaker audio productions. The service builds scripts dynamically, runs them through TTS engines, and assembles final audio files supporting up to four distinct speaker profiles.
This functionality is exposed through the /api/podcasts endpoint defined in api/routers/podcasts.py, which launches asynchronous jobs handled by the underlying graph workflow. Users can customize speaker voices and personalities to match different content styles, from academic lectures to casual conversations.
Privacy-First Architecture and Self-Hosting
Data privacy is enforced architecturally: all content lives in your own SurrealDB instance, and the API never transmits data to external clouds unless you explicitly invoke an AI provider. The PasswordAuthMiddleware in api/main.py (line 15) optionally protects the entire UI behind a password for public deployments.
The domain models in open_notebook/domain/notebook.py define Pydantic records that ensure type safety while interacting with the graph database. This design allows you to deploy Open Notebook entirely on-premises or in a private cloud without vendor lock-in.
Working with the Open Notebook API
The FastAPI backend exposes comprehensive REST endpoints for every UI action. The router registration in api/main.py (line 89) aggregates endpoints for notebooks, sources, chat, and embeddings under the /api prefix.
Below are minimal Python examples demonstrating common API interactions against a local instance running at http://localhost:5055.
Create a Notebook
import requests
resp = requests.post(
"http://localhost:5055/api/notebooks",
json={"name": "My Research Notebook"},
)
notebook = resp.json()
print("Notebook ID:", notebook["id"])
Ingest a PDF Source
files = {"file": open("paper.pdf", "rb")}
data = {"notebook_id": notebook["id"], "title": "Important Paper"}
resp = requests.post(
"http://localhost:5055/api/sources",
data=data,
files=files,
)
source = resp.json()
print("Source ID:", source["id"])
Context-Aware Chat
payload = {
"notebook_id": notebook["id"],
"messages": [
{"role": "user", "content": "Summarize the main findings of the PDF."}
],
"model_override": None,
}
resp = requests.post(
"http://localhost:5055/api/chat",
json=payload,
)
answer = resp.json()
print("AI:", answer["messages"][-1]["content"])
Rebuild Embeddings
resp = requests.post(
"http://localhost:5055/api/embeddings/rebuild",
json={"notebook_id": notebook["id"]},
)
print("Rebuild status:", resp.json())
Generate a Podcast
payload = {
"notebook_id": notebook["id"],
"episode_title": "Research Highlights",
"speaker_profiles": ["speaker1", "speaker2"],
}
resp = requests.post(
"http://localhost:5055/api/podcasts",
json=payload,
)
podcast = resp.json()
print("Podcast job ID:", podcast["job_id"])
Key Source Files
Understanding the codebase structure helps when extending functionality or debugging workflows:
api/main.py– FastAPI entry point, router registration, CORS configuration, and database migrationsopen_notebook/ai/models.py– ModelManager class that provisions LLM, embedding, TTS, and STT modelsopen_notebook/graphs/chat.py– LangGraph workflow for context retrieval and LLM streamingopen_notebook/graphs/source.py– Ingestion pipeline logic: extract → embed → storeopen_notebook/database/repository.py– Async SurrealDB helper for CRUD operationsopen_notebook/domain/notebook.py– Pydantic models defining notebook and source schemasapi/routers/chat.py– HTTP endpoint forwarding chat requests to the LangGraphapi/routers/podcasts.py– Endpoint launching asynchronous podcast generationopen_notebook/utils/embedding.py– Vector creation and storage utilitiesopen_notebook/config.py– Global configuration and environment parsing
Summary
- Open Notebook provides a self-hosted, privacy-first alternative to cloud-based research tools by storing all data in SurrealDB and processing AI requests only through explicitly configured providers.
- The ModelManager in
open_notebook/ai/models.pysupports 18+ AI providers for flexible, multi-modal processing including chat, embeddings, and audio generation. - LangGraph workflows power the chat, source ingestion, and content transformation pipelines, enabling complex, stateful processing of research materials.
- The FastAPI backend exposes a complete REST API for notebooks, sources, chat, and podcast generation, with OpenAPI documentation for programmatic access.
- Fine-grained context control allows users to select specific sources for each AI interaction, optimizing token usage and maintaining privacy boundaries.
Frequently Asked Questions
How does Open Notebook ensure data privacy?
All data resides in your own SurrealDB instance, and the system architecture prevents implicit transmission to external services. The AI providers only receive data when you explicitly invoke them through the ModelManager, and the optional PasswordAuthMiddleware in api/main.py can lock the entire application behind authentication for public deployments.
What AI models can I use with Open Notebook?
The ModelManager class supports 18+ providers including OpenAI, Anthropic, Azure, Google, and local Ollama instances. You can configure different models for chat, embeddings, speech-to-text, and text-to-speech operations, allowing you to mix cloud APIs with local models to balance capability and privacy.
How does the podcast generation feature work?
The podcast service transforms notebook content into multi-speaker audio by generating scripts, running them through configured TTS models, and assembling the output. The api/routers/podcasts.py endpoint accepts speaker profile configurations and launches asynchronous jobs that support up to four distinct voices per episode.
Can I use Open Notebook without sending data to external AI providers?
Yes. You can configure local models via Ollama or similar self-hosted solutions for all AI operations including chat, embeddings, and audio processing. The open_notebook/ai/models.py abstraction layer allows you to route all inference to local infrastructure while maintaining the same API interface for the rest of the application.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →