Guardrails

https://github.com/NVIDIA/NeMo-Guardrails/blob/aa07d889e9437dc687cd1c0acf51678ad435516e/docs/architecture/README.md#the-guardrails-process

Guardrails Runtime

  1. Generate canonical user message

  2. Decide next step and execute

  3. Generate bot utterance

Each of the above stages can involve one or more calls to the LLM.

Generate canonical user message

  • generate canonical form for user utterance (captures 1. user intent 2. allows GR to trigger flows)

define flow generate user intent
  """Turn the raw user utterance into a canonical form."""

  event UtteranceUserActionFinished(final_transcript="...")
  execute generate_user_intent

Generate_user_intent action:

  1. vector search on all canonical form examples in GR configs

  2. Take top 5

  3. Include them in prompt

  4. Ask LLM to generate canonical form for current user utterance

  5. new UserIntent even created

Decide Next Steps

potential next paths:

  1. pre-defined flow already defined

  2. LLM used to decide next step

    1. vector search performed for most relevant flows from GR config

    2. take top 5 flows

    3. include in prompt

This will happen for either step:

bot should say something (BotIntent events)

Generate Bot Utterances

  1. vector search for most relevant bot utterance examples in GR configs

    • also vector search on knowledge base if provided to include in prompt (retrieve_relevant_chunks action)

  2. included in prompt

  3. ask LLM to generate utterance for current bot intent

Overall

Last updated

Was this helpful?