๐ง The Spell Book: CellMage Magic Commandsยถ
Welcome to the official spell book of CellMage! Here youโll find all the magical incantations (IPython magic commands) that allow you to summon the power of Large Language Models directly within your enchanted notebooks. Master these spells to become a true wizard of AI!
๐ Summoning the Magicยถ
Before casting any spells, you must first invite the magical presence into your notebook:
%load_ext cellmage
๐ช Your Magical Arsenalยถ
The CellMage grimoire contains these powerful core spells:
%llm_config- Configure your magical powers and manage your arcane resources%llm_config_persistent- Activate the ambient magic field (where all cells become magical)%disable_llm_config_persistent- Dispel the ambient magic field%%llm- Cast a directed spell to the LLM wizard%%py- Execute mundane Python code (when ambient magic is active)
And these integration enchantments:
%confluence- Summon knowledge from the Confluence realm%jira- Call upon the wisdom of Jira issue trackers%github- Channel the power of GitHub repositories%gitlab- Draw upon the essence of GitLab projects%webcontent- Extract magical insights from the web%gdocs- Commune with the scrolls of Google Docs%sqlite- Manage your spellbook archives%img- Process and display images
โจ The Complete Spell Compendiumยถ
1. %llm_config - The Configuration Spellยถ
This versatile spell allows you to adjust your magical settings and manage your resources.
%llm_config [magical_parameters]
๐ฎ Magical Parametersยถ
Arcane Parameter |
What It Does |
|---|---|
|
Transform the AI into a different magical identity |
|
Reveal the current personaโs true nature |
|
Summon a list of all available personas |
|
Apply a magical override to a parameter (e.g., |
|
Remove a specific magical override |
|
Dispel all magical overrides |
|
Reveal all active magical overrides |
|
Erase your conversation history from memory (but keep system prompt) |
|
Unfold the scroll of your conversation history |
|
Preserve your magical session in a scroll for later use |
|
Recall a previously preserved magical session |
|
Reveal all preserved magical sessions |
|
Enable automatic preservation of your magical conversations |
|
Disable automatic preservation |
|
Reveal all available magical text fragments |
|
Incorporate a magical text fragment into your next spell |
|
Add a system-level magical fragment to your next spell |
|
Reveal your current magical status and power levels |
|
Change which magical entity youโre communicating with |
|
Switch to a different magical communication method |
|
Show your magical name translations |
|
Create a new magical name shortcut |
|
Remove a magical name shortcut |
๐ Spell Examplesยถ
# Discover your magical name shortcuts
%llm_config --list-mappings
# Create a magical shortcut
%llm_config --add-mapping g4o gpt-4o
# Remove a magical shortcut
%llm_config --remove-mapping g4o
# Summon the Python expert persona
%llm_config --persona python_expert
# Communicate with a specific magical entity
%llm_config --model gpt-4o
# Adjust your spell's creativity
%llm_config --set-override temperature 0.7
# Include a magical scroll in your next communication
%llm_config --snippet code_context.py
# Check your magical status
%llm_config --status
# Switch to a different magical communication method
%llm_config --adapter langchain
2. %llm_config_persistent - The Ambient Magic Spellยถ
This powerful enchantment has the same abilities as %llm_config but also creates a magical field around your notebook, turning every cell into a direct communication with the AI wizard.
%llm_config_persistent [magical_parameters]
When the ambient magic field is active, any scroll (cell) you activate that doesnโt start with a magical rune (% or %%) or command rune (!) will be sent as a message to the AI wizard, and their response will appear below.
๐ฎ Magical Parametersยถ
All the same magical parameters as %llm_config except for --adapter.
๐ Spell Exampleยถ
# Create an ambient magic field with the coding assistant persona
%llm_config_persistent --persona coding_assistant --model gpt-4o
After casting this spell, you can simply write a question in any cell (no %%llm needed) and run it to receive wisdom from the AI wizard!
3. %disable_llm_config_persistent - The Dispel Magic Spellยถ
This counter-spell removes the ambient magic field, returning your notebook to its normal state.
%disable_llm_config_persistent
4. %%llm - The Direct Communication Spellยถ
This cell magic allows you to send a specific message directly to the AI wizard.
%%llm [magical_parameters]
Your message to the magical AI...
๐ฎ Magical Parametersยถ
Arcane Parameter |
What It Does |
|---|---|
|
Temporarily summon a different magical identity |
|
Temporarily communicate with a different magical entity |
|
Adjust the creativity of THIS spell only |
|
Limit the length of the magical response |
|
Cast a spell that leaves no trace in your history |
|
Receive the complete magical response at once (no gradual appearance) |
|
Prevent automatic spell recovery if something goes wrong |
|
Set any other magical parameter for this spell only |
|
Reveal all available magical fragments |
|
Include a magical fragment in this spell |
|
Include a system-level magical fragment in this spell |
๐ Spell Examplesยถ
%%llm --persona data_alchemist --model gpt-4o
Transform this dataset into golden insights about customer behavior.
%%llm -t 0.9 --param top_p 0.95
Craft a magical tale about a programmer who discovers an ancient spell book
containing Python code that can alter reality.
5. %%py - The Mundane Code Spellยถ
When the ambient magic field is active, this spell allows you to execute regular Python code without magical interpretation.
%%py
# This scroll contains regular Python incantations
fibonacci_spell = lambda n: n if n <= 1 else fibonacci_spell(n-1) + fibonacci_spell(n-2)
print(f"The 10th number in the sequence is {fibonacci_spell(10)}")
6. %confluence - The Confluence Crystal Ballยถ
This enchantment allows you to peer into the Confluence realm and retrieve knowledge stored there.
%confluence [identifier] [magical_parameters]
๐ฎ Magical Parametersยถ
Arcane Parameter |
What It Does |
|---|---|
|
Page identifier (SPACE:Title format or page ID) |
|
Confluence Query Language search query |
|
Maximum number of results for CQL queries (default: 5) |
|
Add content as a system message (rather than user) |
|
Display the content without adding to history |
|
Use plain text format instead of Markdown (Markdown is default) |
|
For CQL search, return only metadata without page content |
|
For CQL search, fetch full content of each page |
๐ Spell Examplesยถ
# Fetch a specific Confluence page
%confluence ENGINEERING:System Architecture
# Search Confluence with CQL
%confluence --cql "space = DEV AND title ~ 'API Documentation'"
7. %jira - The Issue Tracking Telescopeยถ
This spell allows you to inspect issues and tasks from the Jira realm.
%jira [issue_key] [magical_parameters]
๐ฎ Magical Parametersยถ
Arcane Parameter |
What It Does |
|---|---|
|
Jira issue key (e.g., PROJECT-123) |
|
JQL search query instead of a specific issue |
|
Maximum number of results for JQL search (default: 5) |
|
Comma-separated list of fields to include |
|
Include issue comments |
|
Add as system message instead of user message |
|
Display content without adding to history |
|
Use plain text instead of Markdown format |
๐ Spell Examplesยถ
# Fetch a specific Jira issue
%jira PROJ-123
# Search for issues with JQL
%jira --jql "project = BACKEND AND status = 'In Progress' AND assignee = currentUser()"
8. %github - The GitHub Repository Mirrorยถ
This enchantment allows you to peer into GitHub repositories and extract information.
%github [repo/path] [magical_parameters]
๐ฎ Magical Parametersยถ
Arcane Parameter |
What It Does |
|---|---|
|
Repository owner/name or file path within a repository |
|
Fetch a specific issue by number |
|
Fetch a specific pull request by number |
|
Search for issues with the given query |
|
Maximum number of search results (default: 5) |
|
Include comments on issues/PRs |
|
Add as system message instead of user message |
|
Display content without adding to history |
|
Branch to use when fetching files (default: main/master) |
๐ Spell Examplesยถ
# View a specific file from a GitHub repo
%github facebook/react/README.md
# Get information about an issue
%github facebook/react --issue 42 --comments
# Search for issues
%github facebook/react --search "state management" --max 10
9. %gitlab - The GitLab Project Portalยถ
This spell connects to GitLab projects and extracts information.
%gitlab [repo/path] [magical_parameters]
๐ฎ Magical Parametersยถ
Arcane Parameter |
What It Does |
|---|---|
|
Project path or file path within a project |
|
Fetch a specific issue by number |
|
Fetch a specific merge request by number |
|
Search for issues with the given query |
|
Maximum number of search results (default: 5) |
|
Include comments on issues/MRs |
|
Add as system message instead of user message |
|
Display content without adding to history |
|
Branch to use when fetching files (default: main/master) |
๐ Spell Examplesยถ
# View a specific file from a GitLab project
%gitlab group/project/README.md
# Get information about an issue
%gitlab group/project --issue 42 --comments
10. %webcontent - The Web Divination Spellยถ
This enchantment extracts content from webpages and prepares it for analysis.
%webcontent [url] [magical_parameters]
๐ฎ Magical Parametersยถ
Arcane Parameter |
What It Does |
|---|---|
|
URL of the webpage to fetch |
|
Clean and extract main content (default behavior) |
|
Get raw HTML content without cleaning |
|
Content extraction method: trafilatura (default), bs4, or simple |
|
Add as system message instead of user message |
|
Display content without adding to history |
|
Include image references in the output |
|
Remove hyperlinks from the output |
|
Request timeout in seconds (default: 30) |
๐ Spell Examplesยถ
# Get clean content from a webpage
%webcontent https://en.wikipedia.org/wiki/Artificial_intelligence
# Keep links and images in the output
%webcontent https://blog.example.com/tutorial --include-images
11. %gdocs - The Google Docs Summoning Spellยถ
This enchantment allows you to access content from Google Docs and use it as context.
%gdocs [document_id] [magical_parameters]
๐ฎ Magical Parametersยถ
Arcane Parameter |
What It Does |
|---|---|
|
Google Document ID or URL |
|
Add as system message instead of user message |
|
Display content without adding to history |
|
Search for Google Docs files containing the specified term |
|
Retrieve and display content for search results |
|
Maximum number of search results to return (default: 10) |
|
Maximum number of documents to retrieve content for (default: 3) |
|
Request timeout in seconds (default: 300) |
|
Filter documents by author/owner email (comma-separated for multiple) |
|
Filter by modification date (YYYY-MM-DD or natural language) |
|
How to order search results (relevance, modifiedTime, createdTime, name) |
|
Authentication type to use (oauth or service_account) |
๐ Spell Examplesยถ
# Fetch a specific Google Document
%gdocs 1aBcDeFgHiJkLmNoPqRsTuVwXyZ
# Search for documents and retrieve content
%gdocs --search "project proposal" --content --max-content 5
# Search with filters
%gdocs --search "meeting notes" --author john@example.com,jane@example.com --updated "2 weeks" --timeout 600
12. %sqlite - The Memory Archive Spellยถ
This enchantment manages your stored conversations with the magic realm.
%sqlite [magical_parameters]
๐ฎ Magical Parametersยถ
Arcane Parameter |
What It Does |
|---|---|
|
Show the current state of the SQLite storage |
|
Display statistics about stored conversations |
|
List all stored conversations |
|
Start a new conversation |
|
Load a specific conversation by ID |
|
Delete a conversation by ID |
|
Add a tag to a conversation |
|
Search for conversations with content matching the query |
|
Export a conversation to markdown file |
|
Import a conversation from markdown file |
๐ Spell Examplesยถ
# Show all stored conversations
%sqlite --list
# Start a new conversation
%sqlite --new
# Load a previous conversation
%sqlite --load conversation_20250508_123456
# Search for conversations about a topic
%sqlite --search "neural networks"
13. %img - The Image Processing Portalยถ
This spell allows you to process, display, and add images to your LLM conversations.
%img path/to/image.jpg [magical_parameters]
๐ฎ Magical Parametersยถ
Arcane Parameter |
What It Does |
|---|---|
|
Path to the image file to process |
|
Width to resize the image to while maintaining aspect ratio |
|
Quality for lossy image formats (0.0-1.0) |
|
Display the image inline after processing |
|
Display information about the image |
|
Add the image to the current chat session (default: always added) |
|
Force conversion to a compatible format |
|
Format to convert the image to (e.g., โjpgโ, โpngโ, โwebpโ) |
๐ Spell Examplesยถ
# Process an image and add it to conversation context (no display)
%img path/to/image.jpg
# Process, display, and show information about an image
%img path/to/image.jpg --show --info
# Resize an image to 800px width and display it
%img path/to/image.jpg --resize 800 --show
# Convert an image to a different format with quality adjustment
%img path/to/image.jpg --format webp --quality 0.85 --show
๐ The Ambient Magic Fieldยถ
The ambient magic field is a powerful enchantment that, when activated, allows any regular cell to be automatically processed as a communication with the AI wizard. This eliminates the need to mark each message with the %%llm rune.
To create the field:
%llm_config_persistentTo dispel the field:
%disable_llm_config_persistent
When the ambient magic field is active, cells that start with magical runes (%, %%) or command runes (!) still function normally, but all other cells become direct communications with the AI wizard.
If you need to cast regular Python spells while the ambient field is active, use the %%py magic rune.
โ ๏ธ Warning: The ambient magic field may sometimes intercept Jupyterโs internal background functions like
__jupyter_exec_background__()which are used for autocomplete and other IDE features. If your magical workspace begins acting strangely (such as code completion not working properly or internal Jupyter commands being sent to the AI wizard as messages), dispel the ambient magic using%disable_llm_config_persistentand use explicit%%llmrunes instead.
๐ Magical Status Indicatorsยถ
After each successful communication with the AI wizard (via %%llm or ambient magic), a status bar displays:
Success rune (โ )
Duration of the magical communication (โฑ๏ธ)
Token counts (magical energy consumed/received) (๐ฅ/๐ค)
Estimated cost in magical currency (๐ช)
Which magical entity responded
This information helps you track your magical energy usage and costs.
๐งช Example Magical Potionsยถ
Here are some example incantations to help you get started on your magical journey:
# Load the magical extension
%load_ext cellmage
# Set the default model and persona
%llm_config --model gpt-4o --persona python_expert
# Ask a question with a specific model for this call only
%%llm -m gpt-4o
Explain the visitor pattern in software design
# Enable ambient mode with specific settings
%llm_config_persistent --model gpt-4o-mini --temperature 0.7
# Execute Python code in ambient mode
%%py
import pandas as pd
print(pd.__version__)
# Disable ambient mode
%disable_llm_config_persistent
# Load integration extensions as needed
%load_ext cellmage.magic_commands.tools.confluence_magic
%load_ext cellmage.magic_commands.tools.github_magic
%load_ext cellmage.magic_commands.tools.webcontent_magic
# Fetch content from various sources
%confluence TEAM:Project Overview
%github myorg/myrepo --issue 42
%webcontent https://example.com/article