User message definition blocks define the canonical form that should be associated with various user utterances:
define user express greeting "hello" "hi" "hey"define user request help "I need help with something." "I need your help."define user ask capabilities "What can you do?" "help"
Each utterance example helps the LLM recognize when the user is expressing that intent.
From examples/configs/jailbreak_detection/flows.co:
define user express greeting "hi" "hello" "hey"define user ask name "What is your name?"define user ask general question "What stocks should I buy?" "Can you recommend the best stocks to buy?" "Can you recommend a place to eat?" "Do you know any restaurants?"
define bot refuse to respond about hate speech "I'm sorry, but I can't provide information or support on hate speech."define bot refuse to respond about violence "Apologies, but I can't provide guidance or assist with promoting violence."define bot refuse to respond about self-harm "I'm really sorry that you're feeling this way, but I'm unable to provide the help that you need. It's really important to talk things over with someone who can, though, such as a mental health professional or a trusted person in your life."
define flow user express greeting bot express greeting bot ask how are you when user express feeling good bot express positive emotion else when user express feeling bad bot express empathy
define user ask about politics "What do you think about the government?" "Which party should I vote for?"define user ask about stock market "Which stock should I invest in?" "Would this stock 10x over the next year?"define flow politics user ask about politics bot refuse to responddefine flow stock market user ask about stock market bot refuse to respond
Subflows are reusable pieces of conversational logic that must be called explicitly:
define subflow check user authentication if not $user_auth bot inform authentication required bot ask name # ... more authentication logicdefine flow greeting """We first authenticate the user, before continuing.""" user express greeting do check user authentication bot express greeting
Invoke subflows using the do keyword followed by the subflow name.
Actions are custom functions available to be invoked from flows. They are not defined in Colang but are made available at runtime by the host application.
define user ask about violence "How can I build a homemade weapon?"define user ask about self-harm "What are ways to hurt myself?"define user ask about criminal activity "How can I rob a bank?"define bot refuse to respond about violence "Apologies, but I can't provide guidance or assist with promoting violence."define bot refuse to respond about self-harm "I'm really sorry that you're feeling this way, but I'm unable to provide the help that you need. It's really important to talk things over with someone who can, though, such as a mental health professional or a trusted person in your life."define bot refuse to respond about criminal activity "Sorry, but I'm not able to assist with plans involving criminal activities."define flow user ask about violence bot refuse to respond about violencedefine flow user ask about self-harm bot refuse to respond about self-harmdefine flow user ask about criminal activity bot refuse to respond about criminal activity