Skip to content

feat(artifacts): add language and instructions to generate_mind_map#252

Open
teng-lin wants to merge 1 commit intomainfrom
fix/mind-map-language-instructions
Open

feat(artifacts): add language and instructions to generate_mind_map#252
teng-lin wants to merge 1 commit intomainfrom
fix/mind-map-language-instructions

Conversation

@teng-lin
Copy link
Copy Markdown
Owner

@teng-lin teng-lin commented Apr 5, 2026

Summary

  • Add language and instructions parameters to generate_mind_map() API method, consistent with all other artifact generation methods
  • Add --language and --instructions CLI options to generate mind-map command
  • Refactor CLI to use _generate() closure pattern to deduplicate the json/non-json branches

Closes #250

Test plan

  • Added unit test verifying language and instructions are placed correctly in RPC payload
  • All 1967 existing tests pass
  • Linting (ruff format, ruff check), type checking (mypy) clean

🤖 Generated with Claude Code

Summary by CodeRabbit

New Features

  • Added --language option to the mind-map generation command, allowing you to specify the output language for your generated mind maps
  • Added --instructions option to the mind-map generation command, allowing you to provide custom instructions to guide and customize the mind-map generation process

…d_map

generate_mind_map() previously hardcoded empty strings for language and
instructions in the RPC payload, making mind maps always generate in
English with no custom instructions. This adds language and instructions
parameters consistent with every other artifact generation method.

Closes #250

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c13bd0b3-bc19-4bd4-bffc-64c2e5c08a8e

📥 Commits

Reviewing files that changed from the base of the PR and between abeae92 and afb13c1.

📒 Files selected for processing (3)
  • src/notebooklm/_artifacts.py
  • src/notebooklm/cli/generate.py
  • tests/unit/test_source_selection.py

📝 Walkthrough

Walkthrough

The PR extends mind map generation to accept language and instructions parameters at the API and CLI layers, enabling users to customize the output language and provide generation instructions, previously hardcoded or unavailable for this artifact type.

Changes

Cohort / File(s) Summary
Core API
src/notebooklm/_artifacts.py
Added optional language and instructions parameters to generate_mind_map() method; parameters are passed to the RPC payload as language at index 5[2] and instructions (or empty string) at index 5[1][0][1].
CLI Command
src/notebooklm/cli/generate.py
Added --language and --instructions CLI options to the generate mind-map command; refactored generation logic into a local async closure _generate() to unify parameter handling and avoid duplication across JSON and console output paths.
Test Coverage
tests/unit/test_source_selection.py
Added unit test test_generate_mind_map_passes_language_and_instructions to verify that both instructions and language values are correctly included in the RPC payload at their expected nested positions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A mind map now speaks many tongues,
With custom instructions, ready-strung!
Parameters passed through layers deep,
Language and context, promises to keep.
The test ensures all flows just right,
A polyglot mind map, shining bright! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding language and instructions parameters to the generate_mind_map method.
Linked Issues check ✅ Passed The PR fully implements the requirements from issue #250: adds language (default 'en') and instructions parameters to generate_mind_map, passes them correctly in the RPC payload at params[5][2] and params[5][1][0][1], and exposes CLI flags.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #250: API method signature updates, RPC payload modifications, CLI flag additions, and corresponding unit tests. No unrelated changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/mind-map-language-instructions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for specifying a language and custom instructions when generating mind maps. The generate_mind_map function in both the API and CLI has been updated to include these parameters, and a new unit test verifies that they are correctly included in the RPC payload. I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mind map generation ignores language and instructions parameters

1 participant