NVIDIA / NeMo-Guardrails

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

Always return as off topics for all the queries #434

Open pradeepdev-1995 opened 3 months ago

pradeepdev-1995 commented 3 months ago

Here is a dummy config.yml file to handle off topics

define user ask off topic:
  "What are the main components of Refract?"
  "Can you provide a brief overview of Machine Learning in the context of Refract?"
  "What is Fosfor and how does it relate to Refract?"
  "How does Refract solve the challenge of organizations struggling to connect business value propositions to AI/ML models?"
  "How can Refract facilitate the transition from small-scale testing to enterprise-scale ML adoption?"
define bot explain cant off topic:
  "off topic"
define flow:
  user ask off topic
  bot explain cant off topic

And I prevent LLM calls from checking the off-topic by

rails:
  dialog:
    user_messages:
      embeddings_only: True

But now when I ask any questions related to the questions mentioned in the off topic section or not, it returns that this is off topic
Why this is so? How can I set some threshold for the semantic similarity match in the Annoy vectorindex? @drazvan

sciftlikci commented 3 months ago

Same problem here. Is there any available configuration to adjust this threshold? @drazvan

drazvan commented 3 months ago

Thanks @pradeepdev-1995 and @sciftlikci! Configuring the threshold is scheduled for 0.10.0. To improve this temporarily, you can add more examples to the on-topic messages.

maziyarpanahi commented 3 months ago

Hi @drazvan is this even possible today in NeMo-Guardrails by only using embeddings have ban topics? In the guardrails_only example(s), the subflow just checks whether the input contains a string, it doesn't go further to show how you can define user's flows to ALLOW or DENY certain topics/flows. Many thanks and looking forward to 0.10.0