Basic Concepts
Starters
Starters are suggestions to help your users get started with your assistant. You can declare up to 4 starters and optionally define an icon for each one.
starters.py
import chainlit as cl
@cl.set_starters
async def set_starters():
return [
cl.Starter(
label="Morning routine ideation",
message="Can you help me create a personalized morning routine that would help increase my productivity throughout the day? Start by asking me about my current habits and what activities energize me in the morning.",
icon="/public/idea.svg",
),
cl.Starter(
label="Explain superconductors",
message="Explain superconductors like I'm five years old.",
icon="/public/learn.svg",
),
cl.Starter(
label="Python script for daily email reports",
message="Write a script to automate sending daily email reports in Python, and walk me through how I would set it up.",
icon="/public/terminal.svg",
),
cl.Starter(
label="Text inviting friend to wedding",
message="Write a text asking a friend to be my plus-one at a wedding next month. I want to keep it super short and casual, and offer an out.",
icon="/public/write.svg",
)
]
# ...
Starters example
With Chat Profiles
Starters also work with Chat Profiles. You can define different starters for different chat profiles.
starters_with_chat_profiles.py
@cl.set_chat_profiles
async def chat_profile(current_user: cl.User):
if current_user.metadata["role"] != "ADMIN":
return None
return [
cl.ChatProfile(
name="My Chat Profile",
icon="https://picsum.photos/250",
markdown_description="The underlying LLM model is **GPT-3.5**, a *175B parameter model* trained on 410GB of text data.",
starters=[
cl.Starter(
label="Morning routine ideation",
message="Can you help me create a personalized morning routine that would help increase my productivity throughout the day? Start by asking me about my current habits and what activities energize me in the morning.",
icon="/public/idea.svg",
),
cl.Starter(
label="Explain superconductors",
message="Explain superconductors like I'm five years old.",
icon="/public/learn.svg",
),
],
)
]
Was this page helpful?