Skip to main content

Bring-your-own-LLM chat assistant for Jupyter notebooks — works with OpenAI, Anthropic, Gemini, AWS Bedrock, and any OpenAI-compatible endpoint.

Project description

notebook-assistant

PyPI version Python versions License: MIT CI

Bring-your-own-LLM chat assistant for Jupyter notebooks. Load a DataFrame or markdown file, ask questions in plain English, get markdown-rendered answers right in your cell — with the provider you already pay for.

Supports OpenAI, Anthropic, Google Gemini, AWS Bedrock, and any OpenAI-compatible endpoint (e.g. Euron), routed through LiteLLM.

Install

pip install notebook-assistant

For AWS Bedrock also install the bedrock extra (adds boto3):

pip install "notebook-assistant[bedrock]"

Quickstart

Pick a provider, pass your key, ask a question.

OpenAI

from notebook_assistant import NotebookAssistant

assistant = NotebookAssistant(
    model="openai/gpt-4o",
    api_key="sk-...",   # or set OPENAI_API_KEY env var
)
assistant.ask("Give me three exploratory questions for a sales dataset.")

Anthropic

assistant = NotebookAssistant(
    model="anthropic/claude-3-5-sonnet-20241022",
    api_key="sk-ant-...",   # or ANTHROPIC_API_KEY
)

Google Gemini

assistant = NotebookAssistant(
    model="gemini/gemini-1.5-pro",
    api_key="...",   # or GEMINI_API_KEY
)

AWS Bedrock

assistant = NotebookAssistant(
    model="bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0",
    aws_region="ap-south-1",
    # aws_access_key_id / aws_secret_access_key optional — falls back to
    # boto3's standard credential chain (env vars, IAM role, ~/.aws/credentials).
)

You can also pass an inference-profile ARN as the model id.

Euron (OpenAI-compatible)

assistant = NotebookAssistant(
    model="openai/gpt-5.3-instant",
    api_key="...",   # your Euron API key
    api_base="https://api.euron.one/api/v1/euri",
)

Any other OpenAI-compatible endpoint works the same way — pass model="openai/<name>" with a matching api_base.

Loading context

import pandas as pd
from notebook_assistant import NotebookAssistant

df = pd.read_csv("sales.csv")

assistant = NotebookAssistant(model="openai/gpt-4o", api_key="sk-...")
assistant.add_context(
    instructions="Focus on month-over-month trends.",
    dataframes={"sales": df},
    markdown_path="docs/glossary.md",   # optional
)

assistant.ask("Which product saw the steepest decline last quarter?")

add_context accepts any combination of instructions, dataframes, and markdown_path. The content becomes the first user message in the conversation so every follow-up question sees it.

Interactive chat

assistant.chat()   # type 'exit' to quit

Conversation management

assistant.history   # list of {"role", "content"} dicts
assistant.reset()   # clear context and history

Configuration reference

Argument Description
model LiteLLM-style string: <provider>/<model>. See the LiteLLM provider list.
api_key Provider API key. If omitted, LiteLLM reads the provider's standard env var.
api_base Override endpoint — for Euron or self-hosted OpenAI-compatible gateways.
aws_region, aws_access_key_id, aws_secret_access_key, aws_session_token Bedrock-specific credentials. Fall back to the boto3 credential chain.
system_prompt Custom system prompt. Defaults to a data-analysis-focused prompt.
temperature Sampling temperature (default 0.2).
max_tokens Max response tokens (default 2048).
read_timeout Per-request timeout in seconds (default 60).

Examples

Contributing

See CONTRIBUTING.md. Issues and PRs welcome.

License

MIT

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

notebook_assistant-0.2.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

notebook_assistant-0.2.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file notebook_assistant-0.2.0.tar.gz.

File metadata

  • Download URL: notebook_assistant-0.2.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for notebook_assistant-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b36166c05401c40200b6a96c430cc0082e8631a62e14372f6f9f81a70a7db1cd
MD5 deef2e159a9f0dd324dcb8b001f2f0fb
BLAKE2b-256 33e6747d2444b664c1625ff178ba1a817c08f0dcdaa76a574ff327fe163f8621

See more details on using hashes here.

Provenance

The following attestation bundles were made for notebook_assistant-0.2.0.tar.gz:

Publisher: publish.yml on BenRoshan100/NotebookAssistant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file notebook_assistant-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for notebook_assistant-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34c431d8ab6278e178368677f8ef6aa344c80b0f16ca00f40eb3e4bd4d7d7d9e
MD5 eb14e1ce9c2a2e27a691462cf323ad6a
BLAKE2b-256 7ba219629b1343d2b9d9f1b997ae0fa6575b99c3a209899b6641eca98306c6d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for notebook_assistant-0.2.0-py3-none-any.whl:

Publisher: publish.yml on BenRoshan100/NotebookAssistant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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