NVIDIA / NeMo-Guardrails

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

Trigger flow from generate_bot_message? #162

Open austinmw opened 11 months ago

austinmw commented 11 months ago

Hi, is it possible to trigger a flow from a generate_bot_message?

For example, if generate_bot_message is similar to "Thanks, let me create a recommendation for you.":

define bot create recommendation
  "Thanks, let me create a recommendation for you."

# Flow for generating recommendation
define flow
  bot create recommendation
  $summarization = execute summarize_preferences
  $answer = execute qa_chain(user_message=$summarization)
  bot $answer

So far I can only get this flow to work if bot create recommendation is also triggered from another defined flow rather than from generate_bot_message.


For more context, I'm trying to get the following to work:

  1. Give LLM a system prompt telling it to have a natural conversation, ask a list of questions, and gather responses. Avoid putting each of these in a rigid/linear flow so the conversation is more natural.
  2. Tell the LLM to respond with a specific cue message when it recognizes that it has collected all necessary information.
  3. Use bot cue message from generate_bot_message to create summarization of user preferences, then pass this summarization to RAG system to get relevant context and provide answer
drazvan commented 10 months ago

Hi @austinmw! No, this is not possible. I've marked this as a feature request. But this is an interesting angle, to interpret the LLM messages after it was generated.

austinmw commented 10 months ago

Thanks!