Skip to main content

LLama Guard with AIConfig

LLama Guard is a 7b model released by Meta. This extension allows you to use it with AIConfig.

LLaMA Guard allows you to define your own “safety taxonomy” — custom policies to determine which interactions are safe vs. unsafe between humans (prompts) and AI models (responses). What makes this cool is that it allows you to enforce your own policies ON TOP of the standard guardrails that a model ships with (instead of merely overriding them).

[!NOTE] This extension also loads the entire model into memory.

Part 1: Installating, Importing, and using this extension

  1. Install this module: run pip3 install aiconfig_extension_llama_guard in terminal
  2. Add these lines to your code:
from aiconfig_extension_llama_guard import LLamageGuardParser
from aiconfig.registry import ModelParserRegistry
  1. In code, construct and load the model parser that to from this extension to the registry: ModelParserRegistry.register_model_parser(LLamageGuard()). You can read the docstrings under ModelParserRegistry class for more info o nwhat this does.
  2. Use the LLamageGuard model parser however you please. Check out our tutorial to get started (video walkthrough, Jupyter notebook) You can watch our video tutorial or check our Jupyter notebook tuto

Part 2: Updating & Developing this extension

If you are not developing this extension locally (just using the published extension), feel free to ignore this part

  1. Navigate to extensions/LLama-Guard/python and run this command: pip3 install -e . (this creates a local copy of the python module which is linked to this directory)
  2. Edit and test the extension as you please. Feel free to submit a push request on GitHub!
  3. After you're done testing, be sure to uninstall the local link to this directory if you ever want to use the published version: pip3 uninstall aiconfig_extension_llama_guard

Metadata

Release files for aiconfig-extension-llama-guard 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiconfig-extension-llama-guard 0.0.3
File Size Uploaded
aiconfig_extension_llama_guard-0.0.3.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiconfig-extension-llama-guard 0.0.3
File Interpreter ABI Platform
aiconfig_extension_llama_guard-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / aiconfig_extension_llama_guard-0.0.3.tar.gz

Download URL aiconfig_extension_llama_guard-0.0.3.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d2d3c29a4496ddb405eaa506aaba12602de87a6c7d89216d314e2779ccc56b21
BLAKE2b-256 checksum
How to use checksums
ba84f86b4f99f5d6bdfb82848f3cb047ab6ce2e2edcbb246d463ca1389b73887
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / aiconfig_extension_llama_guard-0.0.3-py3-none-any.whl

Download URL aiconfig_extension_llama_guard-0.0.3-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ffa31aa79c8b1ccfa72e7db1aeba24a0ebd83898f076e6c77c5863ba01e3d924
BLAKE2b-256 checksum
How to use checksums
0ec9ccd5d891afdda54c355d0817d7003472db90b253cb9c11d7728f47153319
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page