Chatbot Case Study - Notebook#

Open In Colab

VueGen is a tool that automates the creation of reports from bioinformatics outputs, allowing researchers with minimal coding experience to communicate their results effectively. An overview of the VueGen workflow is shown below:

Vuegen graphical abstarct

This case study focuses on two the Chatbot component, which allows users to interact with a large language model (LLM) endpoint and display the results in a chat interface. It supports two API interaction modes:

  • Standard prompt-response API: sends a prompt and expects a structured JSON response.

  • Ollama-style streaming chat completion: Uses Ollama’s /api/chat endpoint to stream responses from models like llama3, deepsek, or mistral.

For general VueGen usage examples, see the predefined directory and earth microbiome case study notebooks.

Notebook structure#

First, we will set up the work environment by installing the necessary packages and importing the required libraries. Next, we will create APICall components with different HTTP methods. We will then create a Chatbot component using the Ollama-style streaming mode. Finally, we will create a Streamlit report with sections for the APICall and Chatbot components.

  1. Work environment setup

  2. Chatbot component

  3. Streamlit report generation

Credits and Contributors#

0. Work environment setup#

0.1. Installing libraries and creating global variables for platform and working directory#

To run this notebook locally, you should create a virtual environment with the required libraries. If you are running this notebook on Google Colab, everything should be set.

# Vuegen library
%pip install vuegen

Hide code cell output

Requirement already satisfied: vuegen in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (0.6.0.post1.dev0+1a42fa3)
Requirement already satisfied: altair[save] in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (6.0.0)
Requirement already satisfied: dataframe-image<0.3.0,>=0.2.6 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (0.2.7)
Requirement already satisfied: itables<3.0.0,>=2.2.2 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (2.7.0)
Requirement already satisfied: kaleido<0.3.0,>=0.2.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (0.2.1)
Requirement already satisfied: matplotlib<4.0.0,>=3.9.2 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (3.10.8)
Requirement already satisfied: nbclient<0.11.0,>=0.10.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (0.10.4)
Requirement already satisfied: nbformat<6.0.0,>=5.10.4 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (5.10.4)
Requirement already satisfied: openpyxl<4.0.0,>=3.1.5 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (3.1.5)
Requirement already satisfied: pandas<3.0.0,>=2.2.2 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from pandas[parquet]<3.0.0,>=2.2.2->vuegen) (2.3.3)
Requirement already satisfied: plotly<6.0.0,>=5.15.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (5.24.1)
Requirement already satisfied: pyvis<0.4.0,>=0.3.2 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (0.3.2)
Requirement already satisfied: pyyaml<7.0.0,>=6.0.2 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (6.0.3)
Requirement already satisfied: quarto-cli in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (1.8.27)
Requirement already satisfied: streamlit<2.0.0,>=1.39.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (1.54.0)
Requirement already satisfied: streamlit-aggrid in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (1.2.1.post2)
Requirement already satisfied: vl-convert-python<2.0.0,>=1.7.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (1.9.0.post1)
Requirement already satisfied: xlrd<3.0.0,>=2.0.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from vuegen) (2.0.2)
Requirement already satisfied: nbconvert>=5 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from dataframe-image<0.3.0,>=0.2.6->vuegen) (7.17.0)
Requirement already satisfied: aiohttp>=3.10.2 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from dataframe-image<0.3.0,>=0.2.6->vuegen) (3.13.3)
Requirement already satisfied: requests in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from dataframe-image<0.3.0,>=0.2.6->vuegen) (2.32.5)
Requirement already satisfied: pillow in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from dataframe-image<0.3.0,>=0.2.6->vuegen) (12.1.0)
Requirement already satisfied: packaging in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from dataframe-image<0.3.0,>=0.2.6->vuegen) (26.0)
Requirement already satisfied: mistune in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from dataframe-image<0.3.0,>=0.2.6->vuegen) (3.2.0)
Requirement already satisfied: lxml in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from dataframe-image<0.3.0,>=0.2.6->vuegen) (6.0.2)
Requirement already satisfied: beautifulsoup4 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from dataframe-image<0.3.0,>=0.2.6->vuegen) (4.14.3)
Requirement already satisfied: cssutils in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from dataframe-image<0.3.0,>=0.2.6->vuegen) (2.11.1)
Requirement already satisfied: playwright in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from dataframe-image<0.3.0,>=0.2.6->vuegen) (1.58.0)
Requirement already satisfied: cssselect in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from dataframe-image<0.3.0,>=0.2.6->vuegen) (1.4.0)
Requirement already satisfied: contourpy>=1.0.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from matplotlib<4.0.0,>=3.9.2->vuegen) (1.3.3)
Requirement already satisfied: cycler>=0.10 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from matplotlib<4.0.0,>=3.9.2->vuegen) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from matplotlib<4.0.0,>=3.9.2->vuegen) (4.61.1)
Requirement already satisfied: kiwisolver>=1.3.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from matplotlib<4.0.0,>=3.9.2->vuegen) (1.4.9)
Requirement already satisfied: numpy>=1.23 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from matplotlib<4.0.0,>=3.9.2->vuegen) (2.4.2)
Requirement already satisfied: pyparsing>=3 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from matplotlib<4.0.0,>=3.9.2->vuegen) (3.3.2)
Requirement already satisfied: python-dateutil>=2.7 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from matplotlib<4.0.0,>=3.9.2->vuegen) (2.9.0.post0)
Requirement already satisfied: jupyter-client>=6.1.12 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from nbclient<0.11.0,>=0.10.0->vuegen) (8.8.0)
Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from nbclient<0.11.0,>=0.10.0->vuegen) (5.9.1)
Requirement already satisfied: traitlets>=5.4 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from nbclient<0.11.0,>=0.10.0->vuegen) (5.14.3)
Requirement already satisfied: fastjsonschema>=2.15 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from nbformat<6.0.0,>=5.10.4->vuegen) (2.21.2)
Requirement already satisfied: jsonschema>=2.6 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from nbformat<6.0.0,>=5.10.4->vuegen) (4.26.0)
Requirement already satisfied: et-xmlfile in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from openpyxl<4.0.0,>=3.1.5->vuegen) (2.0.0)
Requirement already satisfied: pytz>=2020.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from pandas<3.0.0,>=2.2.2->pandas[parquet]<3.0.0,>=2.2.2->vuegen) (2025.2)
Requirement already satisfied: tzdata>=2022.7 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from pandas<3.0.0,>=2.2.2->pandas[parquet]<3.0.0,>=2.2.2->vuegen) (2025.3)
Requirement already satisfied: pyarrow>=10.0.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from pandas[parquet]<3.0.0,>=2.2.2->vuegen) (23.0.0)
Requirement already satisfied: tenacity>=6.2.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from plotly<6.0.0,>=5.15.0->vuegen) (9.1.4)
Requirement already satisfied: ipython>=5.3.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from pyvis<0.4.0,>=0.3.2->vuegen) (9.10.0)
Requirement already satisfied: jinja2>=2.9.6 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from pyvis<0.4.0,>=0.3.2->vuegen) (3.1.6)
Requirement already satisfied: jsonpickle>=1.4.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from pyvis<0.4.0,>=0.3.2->vuegen) (4.1.1)
Requirement already satisfied: networkx>=1.11 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from pyvis<0.4.0,>=0.3.2->vuegen) (3.6.1)
Requirement already satisfied: blinker<2,>=1.5.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from streamlit<2.0.0,>=1.39.0->vuegen) (1.9.0)
Requirement already satisfied: cachetools<7,>=5.5 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from streamlit<2.0.0,>=1.39.0->vuegen) (6.2.6)
Requirement already satisfied: click<9,>=7.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from streamlit<2.0.0,>=1.39.0->vuegen) (8.3.1)
Requirement already satisfied: gitpython!=3.1.19,<4,>=3.0.7 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from streamlit<2.0.0,>=1.39.0->vuegen) (3.1.46)
Requirement already satisfied: pydeck<1,>=0.8.0b4 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from streamlit<2.0.0,>=1.39.0->vuegen) (0.9.1)
Requirement already satisfied: protobuf<7,>=3.20 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from streamlit<2.0.0,>=1.39.0->vuegen) (6.33.5)
Requirement already satisfied: toml<2,>=0.10.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from streamlit<2.0.0,>=1.39.0->vuegen) (0.10.2)
Requirement already satisfied: tornado!=6.5.0,<7,>=6.0.3 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from streamlit<2.0.0,>=1.39.0->vuegen) (6.5.4)
Requirement already satisfied: typing-extensions<5,>=4.10.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from streamlit<2.0.0,>=1.39.0->vuegen) (4.15.0)
Requirement already satisfied: watchdog<7,>=2.1.5 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from streamlit<2.0.0,>=1.39.0->vuegen) (6.0.0)
Requirement already satisfied: narwhals>=1.27.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from altair[save]->vuegen) (2.16.0)
Requirement already satisfied: gitdb<5,>=4.0.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from gitpython!=3.1.19,<4,>=3.0.7->streamlit<2.0.0,>=1.39.0->vuegen) (4.0.12)
Requirement already satisfied: smmap<6,>=3.0.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from gitdb<5,>=4.0.1->gitpython!=3.1.19,<4,>=3.0.7->streamlit<2.0.0,>=1.39.0->vuegen) (5.0.2)
Requirement already satisfied: charset_normalizer<4,>=2 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from requests->dataframe-image<0.3.0,>=0.2.6->vuegen) (3.4.4)
Requirement already satisfied: idna<4,>=2.5 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from requests->dataframe-image<0.3.0,>=0.2.6->vuegen) (3.11)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from requests->dataframe-image<0.3.0,>=0.2.6->vuegen) (2.6.3)
Requirement already satisfied: certifi>=2017.4.17 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from requests->dataframe-image<0.3.0,>=0.2.6->vuegen) (2026.1.4)
Requirement already satisfied: aiohappyeyeballs>=2.5.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from aiohttp>=3.10.2->dataframe-image<0.3.0,>=0.2.6->vuegen) (2.6.1)
Requirement already satisfied: aiosignal>=1.4.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from aiohttp>=3.10.2->dataframe-image<0.3.0,>=0.2.6->vuegen) (1.4.0)
Requirement already satisfied: attrs>=17.3.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from aiohttp>=3.10.2->dataframe-image<0.3.0,>=0.2.6->vuegen) (25.4.0)
Requirement already satisfied: frozenlist>=1.1.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from aiohttp>=3.10.2->dataframe-image<0.3.0,>=0.2.6->vuegen) (1.8.0)
Requirement already satisfied: multidict<7.0,>=4.5 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from aiohttp>=3.10.2->dataframe-image<0.3.0,>=0.2.6->vuegen) (6.7.1)
Requirement already satisfied: propcache>=0.2.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from aiohttp>=3.10.2->dataframe-image<0.3.0,>=0.2.6->vuegen) (0.4.1)
Requirement already satisfied: yarl<2.0,>=1.17.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from aiohttp>=3.10.2->dataframe-image<0.3.0,>=0.2.6->vuegen) (1.22.0)
Requirement already satisfied: decorator>=4.3.2 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (5.2.1)
Requirement already satisfied: ipython-pygments-lexers>=1.0.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (1.1.1)
Requirement already satisfied: jedi>=0.18.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (0.19.2)
Requirement already satisfied: matplotlib-inline>=0.1.5 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (0.2.1)
Requirement already satisfied: pexpect>4.3 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (4.9.0)
Requirement already satisfied: prompt_toolkit<3.1.0,>=3.0.41 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (3.0.52)
Requirement already satisfied: pygments>=2.11.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (2.19.2)
Requirement already satisfied: stack_data>=0.6.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (0.6.3)
Requirement already satisfied: wcwidth in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from prompt_toolkit<3.1.0,>=3.0.41->ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (0.6.0)
Requirement already satisfied: parso<0.9.0,>=0.8.4 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jedi>=0.18.1->ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (0.8.6)
Requirement already satisfied: MarkupSafe>=2.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jinja2>=2.9.6->pyvis<0.4.0,>=0.3.2->vuegen) (3.0.3)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jsonschema>=2.6->nbformat<6.0.0,>=5.10.4->vuegen) (2025.9.1)
Requirement already satisfied: referencing>=0.28.4 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jsonschema>=2.6->nbformat<6.0.0,>=5.10.4->vuegen) (0.37.0)
Requirement already satisfied: rpds-py>=0.25.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jsonschema>=2.6->nbformat<6.0.0,>=5.10.4->vuegen) (0.30.0)
Requirement already satisfied: pyzmq>=25.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-client>=6.1.12->nbclient<0.11.0,>=0.10.0->vuegen) (27.1.0)
Requirement already satisfied: platformdirs>=2.5 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-core!=5.0.*,>=4.12->nbclient<0.11.0,>=0.10.0->vuegen) (4.5.1)
Requirement already satisfied: bleach!=5.0.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from bleach[css]!=5.0.0->nbconvert>=5->dataframe-image<0.3.0,>=0.2.6->vuegen) (6.3.0)
Requirement already satisfied: defusedxml in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from nbconvert>=5->dataframe-image<0.3.0,>=0.2.6->vuegen) (0.7.1)
Requirement already satisfied: jupyterlab-pygments in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from nbconvert>=5->dataframe-image<0.3.0,>=0.2.6->vuegen) (0.3.0)
Requirement already satisfied: pandocfilters>=1.4.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from nbconvert>=5->dataframe-image<0.3.0,>=0.2.6->vuegen) (1.5.1)
Requirement already satisfied: webencodings in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from bleach!=5.0.0->bleach[css]!=5.0.0->nbconvert>=5->dataframe-image<0.3.0,>=0.2.6->vuegen) (0.5.1)
Requirement already satisfied: tinycss2<1.5,>=1.1.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from bleach[css]!=5.0.0->nbconvert>=5->dataframe-image<0.3.0,>=0.2.6->vuegen) (1.4.0)
Requirement already satisfied: ptyprocess>=0.5 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from pexpect>4.3->ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (0.7.0)
Requirement already satisfied: six>=1.5 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from python-dateutil>=2.7->matplotlib<4.0.0,>=3.9.2->vuegen) (1.17.0)
Requirement already satisfied: executing>=1.2.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from stack_data>=0.6.0->ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (2.2.1)
Requirement already satisfied: asttokens>=2.1.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from stack_data>=0.6.0->ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (3.0.1)
Requirement already satisfied: pure-eval in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from stack_data>=0.6.0->ipython>=5.3.0->pyvis<0.4.0,>=0.3.2->vuegen) (0.2.3)
Requirement already satisfied: soupsieve>=1.6.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from beautifulsoup4->dataframe-image<0.3.0,>=0.2.6->vuegen) (2.8.3)
Requirement already satisfied: more-itertools in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from cssutils->dataframe-image<0.3.0,>=0.2.6->vuegen) (10.8.0)
Requirement already satisfied: pyee<14,>=13 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from playwright->dataframe-image<0.3.0,>=0.2.6->vuegen) (13.0.0)
Requirement already satisfied: greenlet<4.0.0,>=3.1.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from playwright->dataframe-image<0.3.0,>=0.2.6->vuegen) (3.3.1)
Requirement already satisfied: jupyter in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from quarto-cli->vuegen) (1.1.1)
Requirement already satisfied: wheel in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from quarto-cli->vuegen) (0.40.0)
Requirement already satisfied: notebook in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter->quarto-cli->vuegen) (7.5.3)
Requirement already satisfied: jupyter-console in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter->quarto-cli->vuegen) (6.6.3)
Requirement already satisfied: ipykernel in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter->quarto-cli->vuegen) (7.2.0)
Requirement already satisfied: ipywidgets in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter->quarto-cli->vuegen) (8.1.8)
Requirement already satisfied: jupyterlab in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter->quarto-cli->vuegen) (4.5.3)
Requirement already satisfied: comm>=0.1.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipykernel->jupyter->quarto-cli->vuegen) (0.2.3)
Requirement already satisfied: debugpy>=1.6.5 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipykernel->jupyter->quarto-cli->vuegen) (1.8.20)
Requirement already satisfied: nest-asyncio>=1.4 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipykernel->jupyter->quarto-cli->vuegen) (1.6.0)
Requirement already satisfied: psutil>=5.7 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipykernel->jupyter->quarto-cli->vuegen) (7.2.2)
Requirement already satisfied: widgetsnbextension~=4.0.14 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipywidgets->jupyter->quarto-cli->vuegen) (4.0.15)
Requirement already satisfied: jupyterlab_widgets~=3.0.15 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from ipywidgets->jupyter->quarto-cli->vuegen) (3.0.16)
Requirement already satisfied: async-lru>=1.0.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyterlab->jupyter->quarto-cli->vuegen) (2.1.0)
Requirement already satisfied: httpx<1,>=0.25.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyterlab->jupyter->quarto-cli->vuegen) (0.28.1)
Requirement already satisfied: jupyter-lsp>=2.0.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyterlab->jupyter->quarto-cli->vuegen) (2.3.0)
Requirement already satisfied: jupyter-server<3,>=2.4.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyterlab->jupyter->quarto-cli->vuegen) (2.17.0)
Requirement already satisfied: jupyterlab-server<3,>=2.28.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyterlab->jupyter->quarto-cli->vuegen) (2.28.0)
Requirement already satisfied: notebook-shim>=0.2 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyterlab->jupyter->quarto-cli->vuegen) (0.2.4)
Requirement already satisfied: setuptools>=41.1.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyterlab->jupyter->quarto-cli->vuegen) (82.0.0)
Requirement already satisfied: anyio in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from httpx<1,>=0.25.0->jupyterlab->jupyter->quarto-cli->vuegen) (4.12.1)
Requirement already satisfied: httpcore==1.* in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from httpx<1,>=0.25.0->jupyterlab->jupyter->quarto-cli->vuegen) (1.0.9)
Requirement already satisfied: h11>=0.16 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from httpcore==1.*->httpx<1,>=0.25.0->jupyterlab->jupyter->quarto-cli->vuegen) (0.16.0)
Requirement already satisfied: argon2-cffi>=21.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (25.1.0)
Requirement already satisfied: jupyter-events>=0.11.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (0.12.0)
Requirement already satisfied: jupyter-server-terminals>=0.4.4 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (0.5.4)
Requirement already satisfied: overrides>=5.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (7.7.0)
Requirement already satisfied: prometheus-client>=0.9 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (0.24.1)
Requirement already satisfied: send2trash>=1.8.2 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (2.1.0)
Requirement already satisfied: terminado>=0.8.3 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (0.18.1)
Requirement already satisfied: websocket-client>=1.7 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (1.9.0)
Requirement already satisfied: babel>=2.10 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyterlab-server<3,>=2.28.0->jupyterlab->jupyter->quarto-cli->vuegen) (2.18.0)
Requirement already satisfied: json5>=0.9.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyterlab-server<3,>=2.28.0->jupyterlab->jupyter->quarto-cli->vuegen) (0.13.0)
Requirement already satisfied: argon2-cffi-bindings in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from argon2-cffi>=21.1->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (25.1.0)
Requirement already satisfied: python-json-logger>=2.0.4 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-events>=0.11.0->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (4.0.0)
Requirement already satisfied: rfc3339-validator in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-events>=0.11.0->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (0.1.4)
Requirement already satisfied: rfc3986-validator>=0.1.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jupyter-events>=0.11.0->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (0.1.1)
Requirement already satisfied: fqdn in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.11.0->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (1.5.1)
Requirement already satisfied: isoduration in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.11.0->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (20.11.0)
Requirement already satisfied: jsonpointer>1.13 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.11.0->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (3.0.0)
Requirement already satisfied: rfc3987-syntax>=1.1.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.11.0->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (1.1.0)
Requirement already satisfied: uri-template in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.11.0->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (1.3.0)
Requirement already satisfied: webcolors>=24.6.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.11.0->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (25.10.0)
Requirement already satisfied: lark>=1.2.2 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from rfc3987-syntax>=1.1.0->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.11.0->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (1.3.1)
Requirement already satisfied: cffi>=1.0.1 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from argon2-cffi-bindings->argon2-cffi>=21.1->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (2.0.0)
Requirement already satisfied: pycparser in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi>=21.1->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (3.0)
Requirement already satisfied: arrow>=0.15.0 in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.11.0->jupyter-server<3,>=2.4.0->jupyterlab->jupyter->quarto-cli->vuegen) (1.4.0)
Requirement already satisfied: python-decouple in /home/docs/checkouts/readthedocs.org/user_builds/vuegen/envs/latest/lib/python3.11/site-packages (from streamlit-aggrid->vuegen) (3.8)
Note: you may need to restart the kernel to use updated packages.

Hide code cell content

import os

IN_COLAB = "COLAB_GPU" in os.environ

Hide code cell content

# Optional library to launch a streamlit app from colab
if IN_COLAB:
    !npm install localtunnel

0.2. Importing libraries#

Hide code cell content

# Imports
import yaml
from vuegen import report_generator

if IN_COLAB:
    import urllib

0.3. Helper functions#

Hide code cell content

def save_yaml_config(config, path):
    with open(path, "w") as f:
        yaml.dump(config, f, sort_keys=False, default_flow_style=False)

1. Chatbot component#

Before creating the configuration file for the ChatBot component, there should be a working API endpoint that can be used to test the component. In this case, we will use the Ollama-style streaming chat completion API.

1.1. Setting up the API endpoint#

You should have the Ollama server running locally or on a remote server. If you have not installed this software, you can download it from the Ollama website and follow the installation instructions.

You can check the available models here. After selecting a model, you can use the run command to start the Ollama server with the desired model. For example, to run the llama3 model, you can use:

ollama run llama3

And now the API endpoint will be available at http://localhost:11434/api/chat.

1.2. Creating the configuration file for the ChatBot component#

First, we create a basic configuration file for the report with general information like the title and description. Then, we create a ChatBot component that uses API endpoint we set up in the previous step. This component will allow us to interact with a large language model (LLM) endpoint and display the results in a chat interface.

# Let's create a dictionary with a minimal config
config = {
    "report": {
        "title": "VueGen Chatbot Case Study",
        "description": "This report demonstrates how to use the chatbot component in VueGen",
    },
    "sections": [
        {
            "title": "Chatbot Example",
            "subsections": [
                {"title": "Ollama-style streaming chatbot", "components": []}
            ],
        }
    ],
}
chatbot_component = {
    "title": "ChatBot Component",
    "component_type": "chatbot",
    "api_url": "http://localhost:11434/api/chat",
    "model": "llama3.2",
}

config["sections"][0]["subsections"][0]["components"].append(chatbot_component)
print("✅ ChatBot component added.")
✅ ChatBot component added.

1.3. Save the report config file#

# Save the report config file
config_path = "chatbot_config.yaml"
save_yaml_config(config, config_path)

2. Streamlit report generation#

You now have a complete configuration file for the chatbot. You can run VueGen with this config to see it in action.

Note: To launch the Streamlit web application from Colab, open the generated URL and copy the localtunnel entry point IP into the corresponding field on the opened page. Once submited, you will be redirected to your Streamlit web application.

# Generate the report
report_type = "streamlit"
_ = report_generator.get_report(
    config_path=config_path, report_type=report_type, logger=None
)

Hide code cell output

[2026-02-10 13:05:54,573] vuegen: INFO - Path to log file: logs/2026-02-10_13-05-54_report.log
[2026-02-10 13:05:54,577] vuegen: INFO - Report 'VueGen Chatbot Case Study' initialized with 1 sections.
[2026-02-10 13:05:54,579] vuegen: INFO - running in a normal Python process
[2026-02-10 13:05:54,580] vuegen: DEBUG - Generating 'streamlit' report in directory: 'streamlit_report/sections'
[2026-02-10 13:05:54,582] vuegen: INFO - Output directory already existed: 'streamlit_report/sections'
[2026-02-10 13:05:54,583] vuegen: INFO - Output directory for static content already existed: 'streamlit_report/static'
[2026-02-10 13:05:54,584] vuegen: DEBUG - Processing app navigation code.
[2026-02-10 13:05:54,585] vuegen: DEBUG - Processing home section.
[2026-02-10 13:05:54,587] vuegen: DEBUG - Home directory already existed: streamlit_report/sections/Home
[2026-02-10 13:05:54,588] vuegen: INFO - Home page content written to 'streamlit_report/sections/Home/Homepage.py'.
[2026-02-10 13:05:54,589] vuegen: INFO - Home page added to the report manager content.
[2026-02-10 13:05:54,591] vuegen: DEBUG - Created section directory: streamlit_report/sections/Chatbot_Example
[2026-02-10 13:05:54,592] vuegen: INFO - Created app navigation script: report_manager.py
[2026-02-10 13:05:54,593] vuegen: INFO - Starting to generate sections for the report.
[2026-02-10 13:05:54,595] vuegen: DEBUG - Processing section '1': 'Chatbot Example' - 1 subsection(s)
[2026-02-10 13:05:54,596] vuegen: DEBUG - Processing subsection '1': 'Ollama-style streaming chatbot' - 1 component(s)
[2026-02-10 13:05:54,597] vuegen: INFO - Generated content and imports for subsection: 'Ollama-style streaming chatbot'
[2026-02-10 13:05:54,600] vuegen: INFO - Subsection file created: 'streamlit_report/sections/Chatbot_Example/Ollama_style_streaming_chatbot.py'
[2026-02-10 13:05:54,600] vuegen: INFO - All the scripts to build the Streamlit app are available at streamlit_report/sections
[2026-02-10 13:05:54,602] vuegen: INFO - To run the Streamlit app, use the following command:
[2026-02-10 13:05:54,603] vuegen: INFO - streamlit run streamlit_report/sections/report_manager.py

All the scripts to build the Streamlit app are available at: streamlit_report/sections

To run the Streamlit app, use the following command:

	streamlit run streamlit_report/sections/report_manager.py
run_streamlit = False
# run_streamlit = True  # uncomment line to run the streamlit report
# Launch the Streamlit report depneding on the platform
if not IN_COLAB and run_streamlit:
    !streamlit run streamlit_report/sections/report_manager.py
elif run_streamlit:
    # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399
    print(
        "Password/Enpoint IP for localtunnel is:",
        urllib.request.urlopen("https://ipv4.icanhazip.com")
        .read()
        .decode("utf8")
        .strip("\n"),
    )
    # Run the Streamlit app in the background
    !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &
    # Expose the Streamlit app on port 8501
    !npx localtunnel --port 8501 --subdomain vuegen-demo
else:
    print("Streamlit report not executed, set run_streamlit to True to run the report")

Hide code cell output

Streamlit report not executed, set run_streamlit to True to run the report