Skip to content

feat: add language and instructions support for mind maps#284

Open
MCR-GLOBAL wants to merge 2 commits intoteng-lin:mainfrom
MCR-GLOBAL:fix/mind-map-language-250
Open

feat: add language and instructions support for mind maps#284
MCR-GLOBAL wants to merge 2 commits intoteng-lin:mainfrom
MCR-GLOBAL:fix/mind-map-language-250

Conversation

@MCR-GLOBAL
Copy link
Copy Markdown

@MCR-GLOBAL MCR-GLOBAL commented Apr 15, 2026

Summary

  • Fixes Mind map generation ignores language and instructions parameters #250: generate_mind_map() now accepts language and instructions parameters
  • Passes language at params[5][2] and instructions at params[5][1][0][1] in the RPC payload, consistent with other generation methods
  • CLI generate mind-map now exposes --language/-l and --instructions/-i flags

Test plan

  • Lint, format, type check all pass
  • Full test suite: 2013 passed, 9 skipped
  • Manual: notebooklm generate mind-map --language ja --instructions "Focus on key concepts"

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Mind-map generation now supports language selection (English default).
    • Users can provide custom instructions to tailor mind-map generation.
    • Command-line generation includes new options to set language and pass instructions.

…eng-lin#250)

generate_mind_map() now accepts language and instructions parameters,
consistent with all other artifact generation methods. The CLI also
exposes --language and --instructions flags for the mind-map command.

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

coderabbitai bot commented Apr 15, 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: 8cfaa43d-85c5-4753-9d0f-25ac9720aaaa

📥 Commits

Reviewing files that changed from the base of the PR and between 6d0910a and e0631bd.

📒 Files selected for processing (1)
  • src/notebooklm/cli/generate.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/notebooklm/cli/generate.py

📝 Walkthrough

Walkthrough

Added language and instructions parameters to the mind-map generation API and exposed matching CLI options so the RPC payload includes the requested language and context instructions instead of fixed empty values.

Changes

Cohort / File(s) Summary
API
src/notebooklm/_artifacts.py
Updated ArtifactsAPI.generate_mind_map(...) signature to accept language: str = "en" and `instructions: str
CLI
src/notebooklm/cli/generate.py
Added CLI options --language/-l and --instructions/-i; updated generate_mind_map command signature and execution paths to resolve and forward language and instructions to client.artifacts.generate_mind_map.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nudge the code with careful paws,

Mind maps now heed clever laws.
Language chosen, notes in tow,
Instructions guide the branches' flow. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% 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 summarizes the main change: adding language and instructions support to mind map generation.
Linked Issues check ✅ Passed The pull request fully implements the requirements from issue #250: language and instructions parameters are added to the API method, passed to the RPC payload at correct positions, and exposed via CLI flags.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing language and instructions support for mind maps as specified in issue #250; no unrelated modifications detected.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/notebooklm/cli/generate.py`:
- Around line 998-999: The mind-map CLI currently reads the --language option
directly and bypasses the centralized validation/config in resolve_language();
update the mind-map command to call resolve_language(language) (the same helper
used by other generate commands) instead of using the raw/default "en" fallback,
and pass the resolved value into the downstream logic that builds the mind map
(replace local language handling around the click.option("--language", "-l",
...) and the blocks referenced near lines 1022-1025 and 1030-1033 with
resolve_language(language)); ensure resolve_language is imported or available in
this module so behavior and validation match other generate commands.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c456778b-7170-4588-a809-f6777c735ae3

📥 Commits

Reviewing files that changed from the base of the PR and between a997718 and 6d0910a.

📒 Files selected for processing (2)
  • src/notebooklm/_artifacts.py
  • src/notebooklm/cli/generate.py

Comment thread src/notebooklm/cli/generate.py Outdated
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 introduces the ability to specify a language and custom instructions when generating mind maps, updating both the core artifact generation logic and the CLI interface. The review feedback suggests defaulting the language option to null to facilitate resolution from user configuration, utilizing a helper function for validation, and ensuring the documentation accurately reflects these defaults.

Comment thread src/notebooklm/cli/generate.py Outdated
Comment on lines +998 to +999
@click.option("--language", "-l", default="en", help="Language code (default: en)")
@click.option("--instructions", "-i", default=None, help="Custom instructions for mind map")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The language option should default to None to allow the resolve_language helper to check for a configured language in the user's settings. To avoid a breaking API change, we should keep instructions as an optional flag rather than converting it to a positional argument. We should document the existing behavior in tests and flag this for future consideration.

Suggested change
@click.option("--language", "-l", default="en", help="Language code (default: en)")
@click.option("--instructions", "-i", default=None, help="Custom instructions for mind map")
@click.option("--language", "-l", default=None, help="Output language (default: from config or 'en')")
@click.option("--instructions", "-i", default="", help="Custom instructions")
References
  1. Avoid making breaking API changes. Instead, document the existing behavior in tests and flag it for future consideration.

Comment thread src/notebooklm/cli/generate.py Outdated
Comment on lines +1009 to +1010
Use --language to set the output language (default: en).
Use --instructions to provide custom instructions.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Update the docstring to reflect that the language defaults to the user's configuration and that instructions are provided via the --instructions flag.

Suggested change
Use --language to set the output language (default: en).
Use --instructions to provide custom instructions.
Use --language to set the output language (default: from config or 'en').
Use --instructions to provide custom instructions.

Comment thread src/notebooklm/cli/generate.py Outdated
Comment on lines +1024 to +1025
language=language,
instructions=instructions,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Use resolve_language(language) to ensure the language code is validated and respects the user's configuration. Also, pass the instructions flag value to the API and update tests to assert the state of these new return paths.

Suggested change
language=language,
instructions=instructions,
language=resolve_language(language),
instructions=instructions or None,
References
  1. When a function's signature is updated to return new values, update tests to assert the state of these new returns, including for error handling and early-return paths.

Comment thread src/notebooklm/cli/generate.py Outdated
Comment on lines +1032 to +1033
language=language,
instructions=instructions,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Apply the same language resolution and instructions mapping for the console output path.

Suggested change
language=language,
instructions=instructions,
language=resolve_language(language),
instructions=instructions or None,

Address review feedback: use the centralized resolve_language() helper
instead of hardcoded default, consistent with other generate commands.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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