NotebookLM Report Template Customization: How to Use Custom Prompts
NotebookLM report template customization allows you to override default formatting by setting report_format=ReportFormat.CUSTOM and supplying a custom_prompt containing your specific instructions, while the extra_instructions parameter is ignored.
The teng-lin/notebooklm-py library provides programmatic access to NotebookLM's report generation capabilities. By leveraging NotebookLM report template customization, you can direct the AI to produce outputs in specific styles, tones, and structures that standard templates like BRIEFING_DOC or BLOG_POST cannot accommodate.
Understanding the Custom Report Format Architecture
The system implements report customization through a specific enum value and dedicated prompt handling logic.
The ReportFormat Enum
In src/notebooklm/rpc/types.py, the ReportFormat enum defines four supported formats at line 237:
BRIEFING_DOCSTUDY_GUIDEBLOG_POSTCUSTOM
Selecting ReportFormat.CUSTOM triggers specialized prompt handling that bypasses the default template configurations.
API Implementation Details
The generate_report coroutine in src/notebooklm/_artifacts.py (lines 468-506) serves as the primary entry point. When processing a custom report request, the method constructs a configuration payload where the "prompt" field accepts your custom_prompt input. According to the source code at lines 525-530, if you do not provide a custom_prompt, the system falls back to a generic instruction: "Create a report based on the provided sources."
Critical constraint: As implemented at lines 86-88 in the same file, the extra_instructions argument has no effect when using the CUSTOM format. Any additional guidance must be embedded directly within your custom_prompt string.
How to Implement Custom Prompts
You can utilize custom prompts through either the Python API or the CLI interface, depending on your integration needs.
Python API Approach
When calling client.artifacts.generate_report, explicitly set report_format=ReportFormat.CUSTOM and provide your complete instructions via the custom_prompt parameter.
import asyncio
from notebooklm import NotebookLMClient, ReportFormat
async def create_custom_report():
async with await NotebookLMClient.from_storage() as client:
nb_id = "notebook_12345"
# Embed all structural and stylistic instructions here
prompt = (
"Write a concise technical briefing for senior engineers. "
"Include a high‑level summary, three key take‑aways, and a short "
"actionable checklist. Use bullet points and keep each section under "
"100 words."
)
status = await client.artifacts.generate_report(
notebook_id=nb_id,
report_format=ReportFormat.CUSTOM,
custom_prompt=prompt,
language="en",
)
print("Report generation started, task ID:", status.task_id)
asyncio.run(create_custom_report())
Key implementation details:
- Do not pass
extra_instructions—it will be discarded by the logic at lines 86-88. - The
custom_promptmust contain all formatting, tone, and structural requirements.
CLI Approach
The command-line interface in src/notebooklm/cli/generate.py (lines 49-64) provides two paths to custom reports:
- Automatic detection: Provide a description as a positional argument without specifying a format flag. The CLI automatically switches to CUSTOM format.
- Explicit declaration: Use
--format customalongside your description.
# Auto-detects CUSTOM format
notebooklm generate report "Create a 2‑page executive summary with visual data highlights."
# Explicit format declaration
notebooklm generate report --format custom "Produce a markdown guide for onboarding new hires."
CLI constraint: As coded at lines 59-64, the --append flag triggers a warning and is discarded when using the custom format, reinforcing that all instructions must reside in the main description.
Practical Implementation Examples
Combining Custom Prompts with Source Filtering
You can restrict which sources the AI considers while applying your custom template:
notebooklm generate report \
--format custom \
--language fr \
-s src_001 -s src_007 \
"Rédigez un rapport détaillé en français sur les tendances du marché, incluant une section FAQ."
This invocation sends:
language="fr"source_ids=["src_001", "src_007"]custom_promptcontaining the full French instruction set
Advanced Python Customization
For workflows requiring dynamic prompt construction:
async def generate_structured_analysis(client, notebook_id, topic):
custom_template = f"""
Generate a structured analysis report on {topic} with the following requirements:
1. Executive Summary (maximum 150 words)
2. Technical Deep Dive with code examples
3. Risk Assessment matrix
4. Conclusion with next steps
Tone: Professional but accessible to non-technical stakeholders.
Format: Markdown with clear H2 headers for each section.
"""
return await client.artifacts.generate_report(
notebook_id=notebook_id,
report_format=ReportFormat.CUSTOM,
custom_prompt=custom_template,
language="en"
)
Summary
- Use
ReportFormat.CUSTOMfromsrc/notebooklm/rpc/types.pyto enable template customization. - Provide all instructions via
custom_promptin thegenerate_reportmethod (lines 468-506 insrc/notebooklm/_artifacts.py). - Omit
extra_instructionswhen using custom format, as it is explicitly ignored (lines 86-88). - CLI users can pass descriptions as positional arguments for automatic custom format detection, but cannot use
--appendwith custom reports (lines 49-64 insrc/notebooklm/cli/generate.py). - Fallback behavior: Empty custom prompts default to
"Create a report based on the provided sources."
Frequently Asked Questions
Can I use extra_instructions with custom prompts?
No. According to the implementation in src/notebooklm/_artifacts.py at lines 86-88, the extra_instructions parameter is explicitly ignored when report_format is set to CUSTOM. You must embed all additional guidance directly within your custom_prompt string.
What happens if I don't provide a custom_prompt with CUSTOM format?
The system uses a generic fallback. As defined at lines 525-530 in src/notebooklm/_artifacts.py, when custom_prompt is None or empty, the API receives the default instruction: "Create a report based on the provided sources."
Can I combine custom prompts with specific source selection?
Yes. The custom_prompt parameter functions independently of source filtering. You can pass source_ids (Python API) or -s flags (CLI) alongside your custom prompt to limit which notebook sources the AI analyzes when generating your customized report.
Is there a difference between CLI positional arguments and --format custom?
Functionally, no. The CLI logic at lines 49-58 in src/notebooklm/cli/generate.py automatically converts a positional description argument to report_format=ReportFormat.CUSTOM. Explicitly using --format custom produces identical API calls but is required when you need to combine custom formatting with other flags like --language or -s.
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 →