NVIDIA-NeMo / NVIDIA-NeMo/Guardrails

Flow problems in Colang 1 and 2

Open
#755 2 comments 0 reactions 1 assignee View on GitHub

@Pouyanpi is already working on this.

Since Sep 17, 2024.

question
Dominant language
Python
Stars
7.2k
Forks
843
Avg merge
3d 1h
Merged PRs (30d)
25

Description

Hi,

I have been playing around with the Colang flow control in version 1 and 2. I do not get it to work the way I hoped.

First I tried the Colang 1 example from the documentation:

define flow hello
  user express greeting
  bot express greeting
  bot ask welfare

  when user express happiness
    bot express happiness
  else when user express sadness
    bot express empathy

(I left the definition of what the user and bot say out for clarity)

When I express a greeting, the bot, as expected from the flow definition, also responds with a greeting. However, when I want to continue the flow by expressing happiness, I just get a generic answer that does not match what was defined in the 'bot express happiness' definition. Only when I define a separate flow outside the flow hello, where a user express happiness statement is followed by a bot express happiness statement, it works.

It looks as if the 'when' statements are not really taken into account and when the user expresses happiness it looks for a flow associated to it outside of the flow hello statements. It just skips the whole 'when' block.

Is there error in the syntax here or something I missed?

Then I tried the Colang 2 flow example to see if it works better:

import core

flow main
    bot say "How are you?"
    bot react to user wellbeing

flow bot react to user wellbeing
    when user said "Good" or user said "Great"
        bot say "Great"
    or when user said "Bad" or user said "Terrible"
        bot say "Sorry to hear"

When I run the code the bot would ask 'How are you?' as expected. However, When I type 'Good' or 'Bad', the only response I get is 'How are you' again and again without following the flow defined in 'react to user wellbeing' at all.

Is there something I missed ? Do I need to add more code?

Thanks for your help !

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.