NVIDIA / NeMo-Guardrails

NeMo Guardrails is an open-source toolkit for easily adding programmable guardrails to LLM-based conversational systems.
Other
4.21k stars 400 forks source link

How to get user input in colang v2 #716

Closed nhantran0506 closed 2 months ago

nhantran0506 commented 2 months ago

I wonder if there any ways so that I can get the user input in colang file?

Pouyanpi commented 2 months ago

Hi @nhantran0506, would you clarify what you intend to do?

Have you consulted the latest documentation? or maybe you are looking for sth like this?

drazvan commented 2 months ago

@nhantran0506 : one way is to use the global variable $last_user_message.

flow some name
  global $last_user_message

  # Do something with it

Note that there were some fixes related to this recently, so try on the develop branch. I'm not sure if it works in the latest published version (0.9.1.1 as of now).

Alternatively, the flow can call an action, and if the action declares a parameter with the name events, it will get the complete events history and can extract the information from there.

nhantran0506 commented 2 months ago

@nhantran0506 : one way is to use the global variable $last_user_message.

flow some name
  global $last_user_message

  # Do something with it

Note that there were some fixes related to this recently, so try on the develop branch. I'm not sure if it works in the latest published version (0.9.1.1 as of now).

Alternatively, the flow can call an action, and if the action declares a parameter with the name events, it will get the complete events history and can extract the information from there.

Thank @drazvan ,I will try on that now.