Examples using Panel and its Chat Components; Panels chat components are multi modal and supports LangChain, OpenAI, Mistral, Llama, etc.
Documentation: holoviz-topics.github.io/panel-chat-examples/
Panels Chat Components are available with pip install "panel>=1.3.0"
; most examples require pip install "panel>=1.4.0"
.
More unmaintained examples can be found in GitHub issues and HoloViz Discourse
It's super easy to get started with Panel chat components.
callback=response_callback
# 1.)
import panel as pn
pn.extension()
# 2.)
def response_callback(input_message: str, input_user: str, instance: pn.chat.ChatInterface):
# choose your favorite LLM API to respond to the input_message
...
response_message = f"Echoing your input: {input_message}"
return response_message
# 3.)
pn.widgets.ChatInterface(callback=response_callback).servable()
To install and serve all examples:
git clone https://github.com/holoviz-topics/panel-chat-examples
cd panel-chat-examples
pip install -e ".[all]" # or instead of `all`, just `openai`, `mistralai`, `langchain`, `llamaindex`, `llamacpp`
# Optionally set the OPENAI_API_KEY environment variable
panel serve docs/examples/**/*.py --static-dirs thumbnails=docs/assets/thumbnails --autoreload
Then open http://localhost:5006 in your browser.
We would ❤️ to collaborate with you. Check out the DEVELOPER GUIDE for to get started.
This project is licensed under the terms of the MIT license.