Skip to content

ldu-nvidia/guardrails

Repository files navigation

Guardrails

XML Files

  • define what information you want in the repsonse. Like defining a schema.
  • Schema.from_aiml reads in the .aiml file and parses it to make sure it's consistent with the dialect (e.g. .aiml dialect), ensures that the validators are registered for valid formatters. If you pass in formatters that don't exist, then it will raise a warning, but won't create any validation for those formatters. This also creates a prompt that is passed to the LLM

Formatter

two-words is a formatter

Validator

Event Handlers

on:fail:two-words={action} is an event handler that takes a particular action when the two-words formatter fails.

<?xml version="1.0"?>
<prompt>
    <list name="fees" description="What fees and charges are associated with my account?">
        <object>
            <integer name="index" format="1-indexed" />
            <string name="name" format="lower-case; two-words" />
            <string name="explanation" format="one-line" />
            <float name="value" format="percentage" />
            <string name="description" format="length: 0 200" />
            <string name="example" required="True" format="tone-twitter explain-high-quality" />
            <string name="advertisement" format="tagline tv-ad" />
        </object>
    </list>
    <string name='interest_rates' description='What are the interest rates offered by the bank on savings and checking accounts, loans, and credit products?'/>
    <!-- <string name='fees' description='What fees and charges are associated with my account?' format="max-len: 5; explain-like-im-five; valid-choices: {[0,5,10]}"/> -->
</prompt>

About

Adding guardrails to large language models.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 69.2%
  • Jupyter Notebook 29.8%
  • JavaScript 0.8%
  • Makefile 0.1%
  • Dockerfile 0.1%
  • Batchfile 0.0%