Skip to main content

LangChain Widget

PyPI version Unit test codecov Docs status

Run a LangChain agent in Jupyter notebooks.

An anywidget + React chat UI for LangChain tool-calling chat models, built for notebooks and designed to compose with other Jupyter widgets.

  • Works in JupyterLab / Notebook (and VS Code notebooks)
  • Tool calling out of the box (your tools, your model)
  • Easy to embed alongside plots, tables, and domain widgets

Installation

pip install langchain-widget

Quick start

In a notebook, create a LangChainWidget with your chat model and tools:

from langchain_widget import LangChainWidget
from langchain_openai import ChatOpenAI
from langchain_core.tools import tool

chat_model = ChatOpenAI(model="gpt-4o-mini")

@tool
def add(a: int, b: int) -> int:
    "Add two integers."
    return a + b

w = LangChainWidget(
    chat_model=chat_model,
    tools=[add],
    system_prompt="You are a helpful scientific assistant.",
)
w

Here is how it looks in a Jupyter notebook:

Documentation

Full documentation at: https://langchain-widget.readthedocs.io/

Development

See langchain-widget/docs/source/development.rst.

Contact

License

MIT

Download files

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

Source Distribution

langchain_widget-0.0.1.tar.gz (72.9 kB view details)

Uploaded Source

Built Distribution

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

langchain_widget-0.0.1-py2.py3-none-any.whl (75.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file langchain_widget-0.0.1.tar.gz.

File metadata

  • Download URL: langchain_widget-0.0.1.tar.gz
  • Upload date:
  • Size: 72.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for langchain_widget-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1917dd99f9b912886a874d0ffb08ea0ef80017d9934fcbc3d0da4e380d14c8d1
MD5 9b2b2e8bf9cc765b2ebfd9f8e5758e65
BLAKE2b-256 c1cf4b22df831a236673b934a528e08fff6dc0dae37e12e7cb9370d8d0e98139

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_widget-0.0.1.tar.gz:

Publisher: python-publish.yml on superstar54/langchain-widget

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

File details

Details for the file langchain_widget-0.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_widget-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4b7ff1280898cfb31d541d71a77bd2482e025870c7413288f0a59ba3906daa60
MD5 53132376a3368e6fc12e21068d5f733b
BLAKE2b-256 e5ad0e1ff5ad8ee95e24706f55a09fb0993c6d0c90c007dbc8d5948a35f5291c

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_widget-0.0.1-py2.py3-none-any.whl:

Publisher: python-publish.yml on superstar54/langchain-widget

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

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 files

Supported by

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