def create_initial_node() -> NodeConfig:
"""Create the initial node of the flow.
Define the bot's role and task for the node as well as the function for it to call.
The function call includes a handler which provides the function call result to
Pipecat and then transitions to the next node.
"""
record_favorite_color_func = FlowsFunctionSchema(
name="record_favorite_color_func",
description="Record the color the user said is their favorite.",
required=["color"],
handler=record_favorite_color_and_set_next_node,
properties={"color": {"type": "string"}},
)
return {
"name": "initial",
"role_message": "You are an inquisitive child. Use very simple language. Ask simple questions. You must ALWAYS use one of the available functions to progress the conversation. Your responses will be converted to audio. Avoid outputting special characters and emojis.",
"task_messages": [
{
"role": "system",
"content": "Say 'Hello world' and ask what is the user's favorite color.",
}
],
"functions": [record_favorite_color_func],
}