Skip to main content

AI-Powered Coding

Alph integrates AI assistance directly into the notebook experience, helping you write code faster, debug issues, and learn new techniques.

Available AI Models

Choose from multiple leading AI providers:

Claude

Anthropic Claude
  • Claude 3.5 Sonnet
  • Claude 3 Opus
  • Best for complex reasoning

GPT

OpenAI GPT
  • GPT-4
  • GPT-3.5 Turbo
  • Fast and versatile

Gemini

Google Gemini
  • Gemini 1.5 Pro
  • Gemini 1.5 Flash
  • Great for code generation

Cell Generation

Generate entire code or markdown cells using natural language descriptions.

How to Generate Cells

1

Click the AI button

Between any two cells, click the + AI button
2

Describe what you want

Type a natural language description:
  • “Create a bar chart showing monthly sales”
  • “Load CSV file and clean missing values”
  • “Calculate correlation matrix for numeric columns”
3

Review the generated code

AI generates a complete cell based on your notebook’s context
4

Accept or refine

  • Accept: Click ✓ to insert the cell
  • Refine: Modify your description and regenerate
  • Cancel: Click ✗ to dismiss

Context Awareness

Alph’s AI understands your notebook context:
  • Previous Cells
  • Following Cells
  • Smart Truncation
AI reads cells above (up to 20 cells by default) to understand:
  • Imported libraries
  • Defined variables and functions
  • DataFrame structures
  • Previous computations
Add markdown cells describing your goals to help AI provide better suggestions!

Generation Examples

Prompt: “Load the sales.csv file from the data folder”Generated:
import pandas as pd

# Load sales data
df = pd.read_csv('data/sales.csv')
print(f"Loaded {len(df)} rows")
df.head()
Prompt: “Create a line plot of revenue over time with a trend line”Generated:
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats

# Create line plot with trend
plt.figure(figsize=(12, 6))
plt.plot(df['date'], df['revenue'], label='Revenue', marker='o')

# Add trend line
x = np.arange(len(df))
slope, intercept, r_value, p_value, std_err = stats.linregress(x, df['revenue'])
plt.plot(df['date'], slope * x + intercept, 'r--', label=f'Trend (R²={r_value**2:.3f})')

plt.xlabel('Date')
plt.ylabel('Revenue ($)')
plt.title('Revenue Over Time')
plt.legend()
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()
Prompt: “Remove duplicates and fill missing values with median”Generated:
# Remove duplicate rows
df_clean = df.drop_duplicates()
print(f"Removed {len(df) - len(df_clean)} duplicate rows")

# Fill missing values with median for numeric columns
numeric_cols = df_clean.select_dtypes(include=[np.number]).columns
for col in numeric_cols:
    if df_clean[col].isnull().any():
        median_val = df_clean[col].median()
        df_clean[col].fillna(median_val, inplace=True)
        print(f"Filled {col} missing values with median: {median_val}")

df_clean.info()
Prompt: “Train a random forest classifier to predict churn”Generated:
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report, confusion_matrix

# Prepare features and target
X = df[['age', 'tenure', 'monthly_charges', 'total_charges']]
y = df['churn']

# Split data
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.2, random_state=42
)

# Train model
rf = RandomForestClassifier(n_estimators=100, random_state=42)
rf.fit(X_train, y_train)

# Evaluate
y_pred = rf.predict(X_test)
print("Classification Report:")
print(classification_report(y_test, y_pred))
print("\nConfusion Matrix:")
print(confusion_matrix(y_test, y_pred))

AI Chat

Have a conversation with AI about your notebook, code, or data science questions.

Opening the Chat Panel

  1. Click the Chat button in the toolbar
  2. Or press Ctrl/Cmd + K to quick-open
  3. The chat panel appears on the right side

Chat Features

Ask Questions

  • “Why is my plot not showing?”
  • “How do I handle class imbalance?”
  • “Explain what this function does”

Get Explanations

  • Select code and ask for explanation
  • Understand error messages
  • Learn about libraries and functions

Debug Issues

  • Paste error messages for help
  • Ask for debugging suggestions
  • Get alternative approaches

Optimize Code

  • “How can I make this faster?”
  • “Is there a more efficient way?”
  • Get performance tips

Chat Context

The chat AI has access to:
  • Your current notebook content
  • Recent cell outputs
  • Selected code (if any)
  • Previous chat messages
Chat conversations are not persisted. They’re cleared when you close the chat panel or reload the page.

Code Completion

Get intelligent autocomplete suggestions as you type.

Using Completions

  1. Start typing in a code cell
  2. Press Tab to see suggestions
  3. Use arrow keys to navigate
  4. Press Enter to accept

Completion Types

  • Variable names: Recently defined variables
  • Function signatures: With parameter hints
  • Library imports: Common packages
  • Method chains: DataFrame operations, etc.
  • Code snippets: Common patterns

Specialized Generators

Alph provides specialized AI endpoints for specific content types:
  • Data Formats
  • Languages
  • Commands
CSV Generator: Create sample CSV data JSON Generator: Generate JSON structures HTML Generator: Create HTML templates SVG Generator: Design SVG graphics
These are automatically selected based on cell type and context.

AI Limits and Quotas

Different subscription tiers have different AI usage limits:
PlanCell GenerationChat MessagesModels
Hobby50/month100/monthAll models
ProUnlimitedUnlimitedAll models
ExpertUnlimitedUnlimitedPriority access

Upgrade your plan

Get unlimited AI usage with Pro or Expert plans

Best Practices

Better: “Create a histogram of age distribution with 20 bins” Worse: “Make a chart”Specific prompts yield better results.
Add markdown cells explaining:
  • What your data represents
  • What you’re trying to accomplish
  • Any constraints or requirements
This helps AI understand your goals.
Always review AI-generated code before running:
  • Check for correctness
  • Verify it matches your intent
  • Look for potential issues
  • Modify as needed
If the first generation isn’t perfect:
  • Modify your prompt
  • Add more context
  • Try a different AI model
  • Combine AI with manual edits
Before generating cells, use chat to:
  • Explore different approaches
  • Understand best practices
  • Get library recommendations
  • Plan your implementation

Model Selection

Choose the right AI model for your task:

Claude (Anthropic)

Best for: Complex reasoning, multi-step problems, detailed explanations Use when: You need sophisticated analysis or detailed code

GPT-4 (OpenAI)

Best for: Versatile coding, general questions, creative solutions Use when: You want reliable, well-rounded assistance

Gemini (Google)

Best for: Fast generation, code patterns, data transformation Use when: You need quick results for common tasks
Try different models to see which works best for your workflow. You can switch models in the AI panel settings.

Privacy and Security

  • AI requests include only notebook content, not your account data
  • Your notebooks are not used to train AI models
  • AI responses are not stored or logged
  • Private notebooks remain private

Next Steps