nemoguardrails.colang.v1_0.lang.coyml_parser
nemoguardrails.colang.v1_0.lang.coyml_parser
Module for converting CoYML to the CIL.
Converts the Conversations YAML format to the Common Intermediate Language that is used by the coflows engine.
This also transpiles correctly to JS to be used on the client side.
Module Contents
Functions
Data
API
Helper to turn a short-hand dictionary into an event structure.
:param d: A dictionary in one of the supported formats :return:
Helper to convert a list of items data to flow elements
Helper to extract inline parameters
Helper to process the ”…” element.
The ”…” syntax is used as a syntactic sugar, to create more readable colang code.
There will be multiple use cases for ”…”. The first one is for generate_value action.
- Generate Value
When the value of a variable is assigned to ”…”, we use the comment right above as instructions to generate the value.
will be replaced with
Transforms all goto into simple jumps.
It does two things:
- all goto are converted to relative
jumpelements - all checkpoint elements are converted to
jumpelements to the next
Helper that converts a str/dict to another value.
It does the following:
- if the value is “None” it is converted to None
TODO: other useful value shorthands
Helper to convert a list of events data to ‘full events’
Parses the flow elements from CoYML format to CIL format.