NVIDIA / NeMo-Guardrails

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

question: How to adapt Guardrails in a project #656

Open AadarshBhalerao opened 4 months ago

AadarshBhalerao commented 4 months ago

Hello!

I have a general question. With the documentation of nemoguardrails available online I understand the setup and working of guardrails. My question is I just want to use guardrails as input, output and dialague flow (.co file). But for the rest of the user queries, we have different projects and the query should flow there. How can I do that? How can I use Guardrails only to check input and output?

For example: If I setup input and output rails as self_check_input and self_check_output.

This is the summary

1. Task `self_check_input` took 0.51 seconds and used 178 tokens.
2. Task `generate_user_intent` took 1.51 seconds and used 553 tokens.
3. Task `generate_next_steps` took 0.85 seconds and used 449 tokens.
4. Task `generate_bot_message` took 0.84 seconds and used 610 tokens.
5. Task `self_check_output` took 0.19 seconds and used 195 tokens.

What If I just want 'self_check_input' to give me confirmation that the input is okay to proceed further and 'self_check_output' later to inform output is okay to be shared with user.

AadarshBhalerao commented 4 months ago

Hi @drazvan and @Pouyanpi Can you guys please check this

drazvan commented 3 months ago

@AadarshBhalerao have a look here: https://docs.nvidia.com/nemo/guardrails/user_guides/advanced/generation-options.html#input-rails-only

AadarshBhalerao commented 3 months ago

Thanks @drazvan but along with the input and output It doesnt allow me to just use generate_user_intent. Reason why I need that is, in a scenario where I have mentioned company policy in input rail. I still want to check if the question falls in the off_topic category. For That I defined another flow in '.co' file. Name: define flow off topic

Here I have two points:

  1. In cases where the user intent does not match it will give me generate_next_steps and generate_bot_message regardless which I dont want.
  2. If I enter prompt exactly the way one of my off topic is written in .co file, the user intent is still not same to what I had anticipated and mentioned in .co file to catch off topics.