Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/colang2 library migration #592

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from

Conversation

Pouyanpi
Copy link
Collaborator

@Pouyanpi Pouyanpi commented Jul 2, 2024

PR Summary:

This PR introduces a migration script to transform Colang 1.0 syntax to Colang 2.x. The key features and fixes introduced are:

  1. Added a command to the CLI for translating Colang 1.0 to 2.x.
  2. Normalized action names and added a registration check to ensure compatibility with the Colang 2.x ActionName convention.
  3. Enabled context updates in Colang 2.x.
  4. Refactored Colang parsing and added a version detection heuristic.
  5. Added global context variables in guardrails.co.
  6. Implemented flow name validation for Colang 2.x.
  7. Migrated the library to support Colang 2.x.

The PR also includes the generation of a _rails.co file if rails are defined in the config.yml, and validates the translation using the Colang 2.x parser.

@Pouyanpi Pouyanpi requested a review from drazvan July 2, 2024 10:38
@Pouyanpi Pouyanpi force-pushed the feat/colang2-library-migration branch 2 times, most recently from 5c4891c to 23675da Compare July 3, 2024 12:05
Transforms the colang 1 syntax to colang 2
Add _rails.co file if the rails are defined in config.yml
Validates the translation using Colang 2.x parser

Fix indentation of globalize and avoid more than once migration
To make action names compatible with colang 2.x ActionName convention
It is already fixed in another PR
remove flow bot refuse to respond

Fix hallucination flows.co

re-run migration script
Allows use of name from action decorator after execute instead of function name
…or' default value to True and remove 'add_main'
This commit marks the
test as skipped. This test is currently not working as expected and
needs to be reviewed and fixed.
This commit refactors the variable names in the migration script for
better readability. The variable 'stripped_line' has
been renamed to 'line'.

The changes also include the addition of new syntax conversions like
'bot ...' to 'match UtteranceBotActionFinished()' and 'user ...' to
'match UtteranceUserActionFinished()'.
the regex used to extract the action name after "await" or "execute" has been updated. Now it correctly identifies the action name as the part before the first parenthesis.
This commit changes the behavior of the migration script. Instead of
removing the rails flows from the configuration file, it now comments
them out. This allows for easier rollback and preserves the original
file structure. The rails flows are written to a separate file named
_rails.co for reference. This approach is used as yaml.dump in PyYAML distorts the formating and key ordering.
@Pouyanpi Pouyanpi force-pushed the feat/colang2-library-migration branch from 274571e to d2d2e2c Compare July 5, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant