Skip to main content

AI-Powered Chat Interface for Jupyter Notebooks

Project description

JupyterWhisper - AI-Powered Chat Interface for Jupyter Notebooks

JupyterWhisper transforms your Jupyter notebook environment by seamlessly integrating Claude AI capabilities. This extension enables natural chat interactions, intelligent code execution, and voice command features to enhance your notebook workflow.

✨ Key Features

  • 🤖 Native integration with Claude 3.5 Sonnet
  • 🎯 Intelligent code execution and cell management
  • 🔍 Advanced search capabilities powered by Perplexity AI
  • 🎙️ Voice command support using OpenAI Whisper
  • 📝 Context-aware text processing and formatting
  • 💬 Comprehensive chat history management
  • ⚡ Real-time streaming responses

🚀 Installation

pip install jupyter_whisper

📋 Requirements

  • Python 3.7+
  • JupyterLab 4.0+ (important: this extension is designed for JupyterLab, not classic Notebook)
  • Jupyter Notebook 7.0+ (if using Notebook instead of Lab)
  • Required API keys:
    • Anthropic API key (for Claude integration)
    • OpenAI API key (optional, for voice features)
    • Perplexity API key (for advanced search capabilities)

Installation Steps

  1. Install JupyterLab if you haven't already:
pip install jupyterlab>=4.0.0
  1. Install Jupyter Whisper:
pip install jupyter_whisper
  1. Start JupyterLab:
jupyter lab

Important Note About Server Management

Jupyter Whisper runs a local FastAPI server (on port 5000) to handle features like audio transcription and text processing. The server is shared between notebooks for efficiency.

Important Notes:

  • The server persists between notebook sessions
  • Configuration changes (like API keys) only take effect when the server restarts
  • You'll be notified if you're using an older server version

To manually refresh the server and apply new configurations:

from jupyter_whisper import refresh_jupyter_whisper
refresh_jupyter_whisper()  # Warning: affects all active notebooks

When to refresh:

  • After updating API keys
  • After upgrading the package
  • If you encounter configuration issues

Note: Refreshing the server will impact all notebooks currently using it. You may need to restart kernels in affected notebooks.

JupyterLab Compatibility

JupyterWhisper is specifically designed and tested for JupyterLab 4.0+. While it may work in classic Jupyter Notebook (7.0+), we recommend using JupyterLab for the best experience and full feature support.

Key compatibility notes:

  • Voice features require a modern browser
  • WebSocket support is required for real-time streaming
  • Some features may require JupyterLab extensions to be enabled
  • Port 5000 must be available for the local server

🔧 Configuration

Interactive Setup

The easiest way to configure Jupyter Whisper is through the interactive setup interface:

import jupyter_whisper

This will open an interactive UI with tabs for:

  • API Keys configuration
  • Model selection
  • System prompt customization

Manual Configuration

You can also configure settings programmatically:

from jupyter_whisper.config import get_config_manager
config = get_config_manager()

# Set API keys
config.set_api_key('ANTHROPIC_API_KEY', 'your-key-here')
config.set_api_key('OPENAI_API_KEY', 'your-key-here')      # Optional for voice
config.set_api_key('PERPLEXITY_API_KEY', 'your-key-here')  # For search

# Change the model
config.set_model('claude-3-5-sonnet-20241022')

# Update system prompt
config.set_system_prompt("Your custom system prompt here")

# Set other preferences
config.set_config_value('SKIP_SETUP_POPUP', True)

Available models:

  • claude-3-5-sonnet-20241022
  • claude-3-5-haiku-20241022
  • claude-3-opus-20240229
  • claude-3-sonnet-20240229
  • claude-3-haiku-20240307

💡 Usage

Basic Chat

Interact with the AI using the %%user magic command:

%%user
How do I read a CSV file using pandas?

Online Search

Access web information directly within your notebook:

from jupyter_whisper import search_online
style = "Be precise and concise"
question = "What's new in Python 3.12?"
search_online(style, question)

Voice Commands

Leverage voice input capabilities:

  • Control recording with keyboard shortcuts
  • Automatic speech-to-text conversion
  • Seamless chat interface integration

🛠️ Advanced Features

Magic Commands

  • %%user [index] - Initiate a user message
  • %%user [index]:set - Replace user message at given index
  • %%assistant [index] - Include assistant response
  • %%assistant [index]:set - Replace assistant message at given index
  • %%assistant [index]:add - Concatenate content to existing assistant message

Example usage:

%%user 3:set
How do I read a CSV file?

%%assistant 3:set
Here's how to read a CSV file using pandas:
import pandas as pd
df = pd.read_csv('file.csv')

%%assistant 3:add
You can also specify additional parameters:
df = pd.read_csv('file.csv', encoding='utf-8')

🔧 Development

Setup Development Environment

git clone https://github.com/yourusername/jupyter_whisper.git
cd jupyter_whisper
pip install -e ".[dev]"

🤝 Contributing

We welcome contributions! Please submit your Pull Requests.

📄 License

MIT License - see LICENSE for details

🙏 Credits

Powered by:


Made with ❤️ by Maxime

Note: This project is independent and not affiliated with Anthropic, OpenAI, or Perplexity AI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyter_whisper-0.3.0.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jupyter_whisper-0.3.0-py3-none-any.whl (45.7 kB view details)

Uploaded Python 3

File details

Details for the file jupyter_whisper-0.3.0.tar.gz.

File metadata

  • Download URL: jupyter_whisper-0.3.0.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for jupyter_whisper-0.3.0.tar.gz
Algorithm Hash digest
SHA256 18b31b7aae01ffaf670d32b1cdf3e3625029da57b24a72affb5f73b3c9c9b410
MD5 595fba10eebf7155cd5da45e1da29cc6
BLAKE2b-256 76e276fdecdee0c054de6ea1e93905a2f6e0feaf01aa1d5569ad6c471aa2246f

See more details on using hashes here.

File details

Details for the file jupyter_whisper-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyter_whisper-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f18bc4c5629761868bdf48bdcc775a046c3dae02b9c82fefff92458b08c95387
MD5 0b8b994681415b4999debd6cc1ac523d
BLAKE2b-256 9ac1e1fe8937fd934534346219f70b0629f702d3d8668e1eb9c1fe04e64e1bc1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page