Overview
HAI Build provides specialized commands for working with Jupyter notebooks in VS Code. Get AI assistance to generate, explain, and improve notebook cells while maintaining the context of your data science or analysis workflow.Features
Generate Cells
Explain Cells
Improve Cells
Setup
Ensure you have the necessary extensions:Install Required Extensions
- HAI Build Code Generator (this extension)
- Jupyter Extension for VS Code (by Microsoft)
Open a Jupyter Notebook
.ipynb file in VS Code. The notebook interface will activate with HAI Build commands available.Verify HAI Build is Active
- Notebook toolbar (top of notebook)
- Individual cell toolbars (when hovering over cells)
Generating Notebook Cells
Create new cells with AI-generated code based on your prompts.Access Generate Command
- Press
Cmd+Shift+P(Mac) orCtrl+Shift+P(Windows/Linux) - Type Generate Jupyter Cell with HAI
- Press Enter
Enter Your Prompt
Review Generated Cell
- Analyzes your notebook context (existing cells, variables, imports)
- Generates appropriate code
- Inserts a new cell above or below the current cell
- Populates it with the generated code
Execute and Refine
- Run the cell to test the generated code
- Request improvements if needed
- Iterate by generating additional cells
Generation Examples
- Data Loading
- Data Visualization
- Statistical Analysis
Explaining Notebook Cells
Get detailed explanations of what existing cells do.Select a Cell
Trigger Explain
- Press
Cmd+Shift+P/Ctrl+Shift+P - Type Explain Jupyter Cell with HAI
- Press Enter
View Explanation
- What the code does
- How it works step-by-step
- Purpose of key functions or methods
- Expected inputs and outputs
- Potential issues or considerations
Explanation Example
Cell Code:Improving Notebook Cells
Optimize, enhance, or fix existing cells with AI assistance.Select Cell to Improve
Trigger Improve Command
- Press
Cmd+Shift+P/Ctrl+Shift+P - Type Improve Jupyter Cell with HAI
- Press Enter
Describe Improvements
Review Improvements
- Review the suggested changes
- Ask for different approaches
- Accept and apply to your cell
Improvement Examples
- Add Error Handling
- Optimize Performance
- Enhance Visualization
Best Practices for Notebook AI Assistance
Provide Context in Prompts
Provide Context in Prompts
- ✅ “Create a function to preprocess the text column removing special characters”
- ✅ “Calculate correlation between features X1-X10 and the target variable”
- ✅ “Generate a confusion matrix for the classifier stored in ‘model’ variable”
- ❌ “Make a chart”
- ❌ “Process the data”
- ❌ “Add some analysis”
Maintain Cell Organization
Maintain Cell Organization
- Imports at top: Generate import cells first
- Data loading: Load data before processing
- Exploration: Analysis cells in logical order
- Modeling: Train/test/evaluate sequentially
- Visualization: Display results clearly
Run Cells to Establish Context
Run Cells to Establish Context
- Execute cells to define variables and imports
- HAI can reference executed variables in generations
- Kernel state helps determine what’s available
Iterate on Generated Code
Iterate on Generated Code
Combine with Regular HAI Chat
Combine with Regular HAI Chat
- Use Jupyter commands for quick cell operations
- Use HAI chat for multi-cell workflows or complex refactoring
- Select multiple cells and add to HAI chat for broader context
Common Notebook Workflows
Data Science Pipeline
Data Loading
Exploration
Visualization
Preprocessing
Modeling
Data Analysis Report
Import Libraries
Load Data
Calculate Metrics
Visualize Trends
Summary Statistics
Tips for Effective Jupyter AI Usage
Specify Libraries
Request Comments
Define Variables
Set Expectations
Troubleshooting
- Commands Not Visible
- Context Errors
- Import Issues
- Ensure HAI Build extension is installed and enabled
- Verify Jupyter extension is active
- Reload VS Code window:
Cmd+Shift+P→ “Reload Window” - Check notebook type is
jupyter-notebook