Skip to content

abdenlab/ipylangchat

Repository files navigation

ipylangchat 🤖💬

A minimal Chat UI Jupyter Widget for language models. Built with anywidget 💪.

Lets you talk to a LangChain runnable or agent, such as a conversational RAG, directly in a Jupyter environment (Notebook, Lab, Google Colab, VSCode). No need to serve a web application.

See the RAG example notebook.

Usage

Note

This is still a very basic implementation that demonstrates the power of the anywidget framework to bring custom UIs into Jupyter.

Right now, the widget accepts a chain using a prompt template that takes in human input and keeps track of chat history. See the langchain docs and our example of a conversational RAG on the anywidget documentation.

import ipylangchat

ipylangchat.ChatUIWidget(chain)

Installation

pip install ipylangchat

Development installation

Create a virtual environment and and install ipylangchat in editable mode with the optional development dependencies:

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Open example.ipynb in JupyterLab, VS Code, or your favorite editor to start developing. Changes made in src/ipylangchat/static/ will be reflected in the notebook.