AI chat without preview or tools¶
Note
The capture above and the live demo below both run against a stand-in model that streams one fixed answer: no language model is running and no request leaves your browser. LangChain cannot be installed under Pyodide (langchain-core needs uuid-utils and zstandard, native extensions with no pure-Python wheel), and provider credentials do not belong in a public page. Run the example locally with your own credentials to chat for real.
Source: examples/panels/ai/chat_no_preview_no_tools.py
Test: tests/panels/ai/examples/test_chat_media.py
AiChat(show_preview=False, show_tools=False) strips the chat down to just the conversation. With the preview pane disabled, the chat window fills the whole main area instead of sharing it with a markdown preview, and with tools disabled the “Basic Tools” card is dropped from the sidebar.
Use this when you want a focused, no-frills assistant: the sidebar still carries the provider, model, and temperature controls, but nothing else competes with the chat for space.
The code¶
import panel as pn
from dotenv import load_dotenv
from panelini import Panelini
from panelini.panels.ai import AiChat
load_dotenv()
chat = AiChat(
system_message="You are a helpful assistant.",
show_tools=False,
show_preview=False,
)
app = Panelini(title="AI Chat (no preview, no tools)", sidebar_enabled=True)
app.main_set(objects=[pn.Row(*chat.main_objects)])
app.sidebar_set(objects=chat.sidebar_objects)
if __name__ == "__main__":
pn.serve(app.servable(), title="AI Chat (no preview, no tools)", port=5008)
Run it live¶
This example runs entirely in your browser via Pyodide, with the stand-in model described above. The first load downloads packages, so give it a few seconds.