Development and Debugging
Currently, the Colang story designing and building environment is fairly limited but will be improved on in the future.
Integrated Development Environment (IDE)
We suggest using Visual Studio Code and the Colang highlighting extension (Github link) to help with highlighting Colang code.
You can use the Visual Studio Code launch setting to run a Colang story with nemoguardrails in a python environment by pressing F5 (launch.json)
You can show LLM requests by adding the
--verbose-llm-calls
flag when starting nemoguardrailsThere is a verbose mode when starting nemoguardrails
--verbose
to show internal run-time logs (use--debug-level
equal toINFO
orDEBUG
)
Log and Print Statements
To help debugging your Colang flows you can use the print statement print <expression>
to print something to the standard output.
flow main
user said something as $flow
print $flow.transcript
> Hi
Hi
Alternatively, use the log statement log <expression>
to append to the logging shown in the verbose mode, which will appear as “Colang debug info: <expression>”.
Useful Flows
In the Colang Standard Library there are a couple of helpful flows that help in the development process of a Colang story:
catching of undefined flows.
Sometimes it is easy to misspell a flow name. By default Colang will just generate a StartFlow(flow_id=<name_of_flow>)
internal event. But if no flow with that name exists, nothing will happen. This can be confusing and difficult to find. To get help with that you can activate the flow catch undefined flows
which will detect these cases and print a warning on the standard output.
catching of unexpected user utterance.
This flow helps you to detect if certain UtteranceUserAction.Finished()
events are not matched to and therefore will create no bot response, which is probably almost never the case.
catching of colang errors.
When running a Colang story there can be runtime errors due to invalid attribute access or LLM related parsing errors. This error will generate a ColangError(error_type: str, error: str)
event. Usually nothing will match to this event and the bot will remain silent. For debugging the experience this can be confusing and the flow catch colang errors
from the Standard Library will help make this more transparent by letting the bot respond with a default utterance.