Hello World#

This section introduces a “Hello World” Colang example.

Flows#

A Colang script is a .co file and is composed of one or more flow definitions. A flow is a sequence of statements describing the desired interaction between the user and the bot.

The entry point for a Colang script is the main flow. In the example below, the main flow is waiting for the user to say “hi” and instructs the bot to respond with “Hello World!”.

1flow main
2  user said "hi"
3  bot say "Hello World!"

The achieve this, the main flow uses two pre-defined flows:

  • user said: this flow is triggered when the user said something.

  • bot say: this flow instructs the bot to say a specific message.

The two flows are located in the core module from the Colang Standard Library, which is imported in the config.yaml.

Note

For more details, check out the Colang Standard Library (CSL).

Testing#

To test the above script, you can use the NeMo Guardrails CLI:

$ nemoguardrails chat --config=<directory_with_colang_script_and_yaml_config>

> hi

Hello World!

Note

The above example does not use the LLM. To get a response from the bot, you have to send the exact “hi” text, otherwise no response is returned. Extending this with LLM support is covered in the next section.

Congratulations, you’ve just created your first Colang script.

The next example will teach you how to create dialog rails by adding additional flows and enabling the LLM integration.