Demo: Onboard.bot
demo.mov
Forms suck. LLMs are good at conversational-izing data operations. So, we can use LLMs like Mixtral or GPT-4 to get our users (and ourselves, even) into an "onboarded" state.
More interesting, we can use LLMs to provide a continuous interface for managing our relational data. Examples coming soon.
For now OnboardBot is a simple starter project for a Chainlit-based data-collecting Chatbot.
git clone [email protected]:kvnn/OnboardBot.git
cd OnboardBoat/src/server
- (optional)
python3 -m venv .venv && source .venv/bin/activate
) pip install -r requirements.txt
(TODO: clean this up .. sorry about that ... useful stuff in there tho)- Create an
.env
file in the server directory:
CHAINLIT_AUTH_SECRET="YOUR SECRET KEY"
OPENROUTER_API_KEY="YOUR OPENROUTER_API_KEY"
chainlit run app.py
- modify
models.py
for your use-case - modify
prompt.py
as you wish - add branding assets to the
public
folder as you wish (some of which can be pointed to in theconfig.yml
) - modify
config.yml
as you wish (this is a Chainlit construct) - you may need to
Ctrl+C
the local server and then re-runchainlit run app.py
The OnboardBot server is a simple, opinionated and flexible Chainlit project.
So you run it like chainlit run app.py
from OnboardBot/src/server
.
This will open a browser tab running the chatbot interface.
The real meaning of OnboardBot is found in the default models.py
.
You'll be modifying this file heavily.
Here is an example for beginning to onboard Landscaping candidates:
Employee:
- employee_name
- employee_age
- phone_number
- email_address
Preferences:
- preferred_working_hours
- notification_preference_sms_email_whatsapp_or_combination
enabled_models = [
Employee,
Preferences
]
OnboardBot (via prompts.py
) will use the data models above to collect data from the user in a conversational, helpful manner. Note that to enable a Model, it must be added to the enabled_models
list in models.py
.
Notice that conditional logic, in the case of notification_preference_sms_email_whatsapp_or_combination
, is handled in the field name itself. The LLMs (including
Mixtral-8x7B-Instruct
which is 100x cheaper than gpt-4) handle this exactly how we'd wish. The aim is to push the simplicity as far as possible before implementing logic chains in the models.
OnboardBot does not use a custom client. It uses the default chainlit
UI.
Everything OnboardBot wishes to achieve is done via chat.
create an issue or email [email protected]
- Support OpenAI (you'll need to modify
llm.py
to do this for now. Just remove thebase_url
property fromllm_chat_client_async
and change the default models to an OpenAI model. - Support duplicate key names in data classes (the LLM needs to understand they are unique, even with same key)
- Decide: should
User
andGoal
may need to be first-class models, and should prompt be different for definitions of data models versus class that inherit from them? there is a tricky truth here that we are defining pydantic models for LLM's understanding, when we are conditioned to write data models to make our code more meaningful. So, we may need utility classes (or first-class classes?) that support enabled_models that are intended for the LLMs understanding.