Skip to main content

Ask OpenAI-compatible models about a Python object with runtime metadata and optional help() snippets.

Project description

helpit

PyPI License: MIT

Python's help() is great… until it isn’t.

helpit lets you ask questions about help() output and get answers tailored to the exact object in front of you.


Install

pip install helpit

Quickstart

from openai import OpenAI
from helpit import helpit, set_default_client

set_default_client(OpenAI())  

import torch

x = torch.randn(1, 32, 1)
helpit(
    x.squeeze,
    "How do I remove the last dimension and keep the leading dim?",
)

Examples

import pandas as pd
from helpit import helpit

df = pd.DataFrame({"city": [None, "ZRH", None], "sales": [3, 10, 2]})

helpit(df, "Group by city, keep NaNs, and sum sales—what's the right dropna setting?")
from helpit import helpit

def stream():
    for i in range(1_000_000):
        yield i

it = stream()
helpit(it, "How do I safely consume only the first 10 items without exhausting the iterator?")
from sklearn.ensemble import RandomForestClassifier
from helpit import helpit

rf = RandomForestClassifier(
    n_estimators=300,
    max_depth=None,
    min_samples_split=2,
    min_samples_leaf=1,
    max_features="sqrt",
    random_state=0,
)

helpit(rf, "Which hyperparameters matter most for overfitting here? Show how to adjust them.")

When docs matter 📚 (grounded answers)

helpit can attach the most relevant help() snippets when add_documentation=True, keeping answers grounded without dumping full docs.

from transformers import pipeline
from helpit import helpit

pipe = pipeline("sentiment-analysis")

helpit(pipe, "How does this pipeline work?", add_documentation=True)

Run locally 🏠 (fast + private)

helpit talks to the OpenAI Responses API. Any compatible local server works.

from openai import OpenAI
from helpit import helpit

client = OpenAI(
    base_url="http://localhost:11434/v1",
    api_key="ollama",   # any token works
)

helpit(
    len,
    "How does len behave on nested lists?",
    model="llama3.2",
    openai_client=client,
)

Tests

python3 -m unittest discover -s tests -v

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

helpit-1.0.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

helpit-1.0.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file helpit-1.0.0.tar.gz.

File metadata

  • Download URL: helpit-1.0.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for helpit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fcbb2a0b3b4c61158dbb94498157ef02f17685fbad624c6e3d79ff6ec1cc1787
MD5 738be9d3070879af30e79f9a7511578e
BLAKE2b-256 cf8611a54d9d1b9e774a8168430eb36ee1aefd58f90eb640858e0ff52517a32b

See more details on using hashes here.

File details

Details for the file helpit-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: helpit-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for helpit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d5fb4a76b097b3752ec38fa5c5a2043de1a5fd1ab19b3f42de2e75bdf8ae455
MD5 3d0bdf5218db6b8cf9c568886be3ab00
BLAKE2b-256 f68049a4af0ac7e29eedcc492377904d2a81e7349f3ce4b1b80be672283c804a

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