๐ Your First Magical Interaction: A Guided Tourยถ
Welcome to your first CellMage adventure! This guided tour will take you from installation to your first meaningful LLM interaction in just a few minutes.
๐งโโ๏ธ Step 1: Summoning CellMageยถ
First, letโs make sure CellMage is installed and ready to use:
# Install CellMage with all its magical capabilities
pip install "cellmage[all]"
# Or for a minimal installation
pip install cellmage
๐ Step 2: Preparing Your Magical Keyยถ
CellMage needs an API key to communicate with LLM services. Letโs set that up:
# Set your API key in your environment (recommended)
export CELLMAGE_API_KEY="your_openai_api_key"
# Alternatively, create a .env file in your working directory
echo "CELLMAGE_API_KEY=your_openai_api_key" > .env
๐งช Step 3: Starting a New Notebookยถ
Open a new Jupyter notebook and letโs get started. Youโll first need to load the CellMage extension:
# Load the CellMage magical extension
%load_ext cellmage
# Let's check that everything is working correctly
%llm_config --status
You should see a status message showing your current configuration, including the default model, whether any personas are active, and if there are any parameter overrides.
โจ Step 4: Your First Spellยถ
Letโs cast your first spell by sending a prompt to your LLM:
%%llm
Explain what large language models are in 3 simple sentences.
Within moments, you should see a response appear below the cell, along with some stats about the interaction:
โฑ๏ธ How long the response took
๐ Token usage (input and output)
๐ฐ Estimated cost of the request
๐ค Which model was used
๐๏ธ Step 5: Adjusting the Magicยถ
Letโs try tweaking some parameters to see how they affect the response:
%%llm --temperature 0.8 --model gpt-4o
Write a short, imaginative story about a wizard who uses AI to help with spellcasting.
The --temperature parameter increases creativity, and weโve also specified a different model for this request.
๐ญ Step 6: Using a Different Personaยถ
CellMage comes with several built-in personas that shape how the LLM responds:
# List available personas
%llm_config --list-personas
# Try using the Python expert persona
%llm_config --persona code_expert
%%llm
What's the best way to handle exceptions in Python?
Notice how the LLMโs response is now tailored toward coding expertise!
๐ง Step 7: Managing Contextยถ
CellMage maintains conversation history automatically. Letโs see it in action:
%%llm
In your previous response about Python exceptions, can you provide a specific example?
The LLM remembers the previous conversation about exceptions and builds on it.
If you want to start fresh:
# Clear the conversation history
%llm_config --clear-history
# Start a new topic
%%llm
What are the key principles of good data visualization?
๐ Step 8: Checking Your Statsยถ
Letโs see what weโve done in this session:
# Show your conversation history
%llm_config --show-history
This displays all the messages exchanged in your current session.
๐พ Step 9: Saving Your Workยถ
Before ending our tour, letโs save this conversation:
# Save the conversation with a meaningful name
%llm_config --save "my_first_cellmage_session"
You can reload this session later with:
# List saved sessions
%llm_config --list-sessions
# Load a specific session
%llm_config --load "my_first_cellmage_session_20250507_..."
๐ Congratulations!ยถ
Youโve completed your first magical tour with CellMage! You now know:
How to set up and configure CellMage
How to send basic prompts
How to adjust parameters like temperature and model
How to use personas
How to manage conversation history
How to save and load sessions
๐งโโ๏ธ Next Stepsยถ
Now that youโve mastered the basics, explore these next tutorials:
Managing Conversations - Learn more about saving, loading, and searching chats
Crafting Your Own Personas - Create custom personas
Using Snippets - Reuse content across your prompts
Happy magical journeying with CellMage! โจ