diff --git a/extensions/LLama-Guard/python/python/LICENSE b/extensions/LLama-Guard/LICENSE similarity index 100% rename from extensions/LLama-Guard/python/python/LICENSE rename to extensions/LLama-Guard/LICENSE diff --git a/extensions/LLama-Guard/README.md b/extensions/LLama-Guard/README.md new file mode 100644 index 000000000..274fddccd --- /dev/null +++ b/extensions/LLama-Guard/README.md @@ -0,0 +1,2 @@ +Please see our [`LLama-Guard/python` +dir](https://github.com/lastmile-ai/aiconfig/tree/main/extensions/LLama-Guard/python) for the README file. diff --git a/extensions/LLama-Guard/python/README.md b/extensions/LLama-Guard/python/README.md index a0a7ede5f..c1896b8fb 100644 --- a/extensions/LLama-Guard/python/README.md +++ b/extensions/LLama-Guard/python/README.md @@ -1,20 +1,28 @@ # LLama Guard with AIConfig LLama Guard is a 7b model released by Meta. This extension allows you to use it with AIConfig. -Note: This extension also loads the entire model into memory. -## Usage +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). -### Installation, Importing, and using this extension +> [!NOTE] This extension also loads the entire model into memory. -1. run `pip install aiconfig_extension_llama_guard` in your shell -2. `from aiconfig_extension_llama_guard import LLamageGuardParser` -3. 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 +## 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: -## Local Testing -### Update and test this extention +```python +from aiconfig_extension_llama_guard import LLamageGuardParser +from aiconfig.registry import ModelParserRegistry +``` -1. Navigate to `extensions/LLama-Guard/python`, run this command: `pip install build && cd python && python -m build && pip install dist/*.whl` -2. After you're done testing, be sure to delete the generated `dist` folder(s) in the same dir. It'll probalby look something like `python/dist` and `python/.egg-info` +3. 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. +4. Use the `LLamageGuard` model parser however you please. Check out our tutorial to get started ([video walkthrough](https://www.youtube.com/watch?v=XxggqoqIVdg), [Jupyter notebook](https://github.com/lastmile-ai/aiconfig/tree/v1.1.8/cookbooks/LLaMA-Guard)) 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` diff --git a/extensions/LLama-Guard/python/python/pyproject.toml b/extensions/LLama-Guard/python/pyproject.toml similarity index 86% rename from extensions/LLama-Guard/python/python/pyproject.toml rename to extensions/LLama-Guard/python/pyproject.toml index 94ee95453..78967d049 100644 --- a/extensions/LLama-Guard/python/python/pyproject.toml +++ b/extensions/LLama-Guard/python/pyproject.toml @@ -3,12 +3,13 @@ requires = ["setuptools", "wheel"] [project] name = "aiconfig_extension_llama_guard" -version = "0.0.2" +version = "0.0.3" authors = [ { name="LastMile AI" }, { name="Ankush Pala", email="ankush@lastmileai.dev" }, + { name="Rossdan Craig", email="rossdan@lastmileai.dev" }, ] -description = "An extension for using llama-guard with aiconfig" +description = "An extension for using LLama Guard with aiconfig" readme = "README.md" requires-python = ">=3.10" classifiers = [ diff --git a/extensions/LLama-Guard/python/python/README.md b/extensions/LLama-Guard/python/python/README.md deleted file mode 100644 index 1e9a8bb01..000000000 --- a/extensions/LLama-Guard/python/python/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Using LLama-Guarde for model parsing with AIConfig - -We are prioritizing the Python library Usage - -### Part 1: Update and test this extention - -If you are not testing locally (just using the published extension), ignore this and go to Part 2 - -1. From the `aiconfig/HuggingFaceTransformers`, run this command: `pip install build && cd python && python -m build && pip install dist/*.whl` -2. After you're done testing, be sure to delete the generated folder(s) in the `aiconfig/HuggingFaceTransformers` dir. It'll probalby look something like `python/dist` and `python/.egg-info` - -### Part 2: Importing and using this extension - -1. Import whatever outputs pip gives from last command. For now it's `import text-generation` but this may change in the future -2. In code, add all the relevant model parsers that you want to use from this extension to the registry: `ModelParserRegistry.register_model_parser(HuggingFaceTextGenerationTransformer())`. You can read the docstrings under `ModelParserRegistry` class for more info diff --git a/extensions/LLama-Guard/python/python/requirements.txt b/extensions/LLama-Guard/python/requirements.txt similarity index 100% rename from extensions/LLama-Guard/python/python/requirements.txt rename to extensions/LLama-Guard/python/requirements.txt diff --git a/extensions/LLama-Guard/python/python/src/aiconfig_extension_llama_guard/LLamaGuard.py b/extensions/LLama-Guard/python/src/aiconfig_extension_llama_guard/LLamaGuard.py similarity index 100% rename from extensions/LLama-Guard/python/python/src/aiconfig_extension_llama_guard/LLamaGuard.py rename to extensions/LLama-Guard/python/src/aiconfig_extension_llama_guard/LLamaGuard.py diff --git a/extensions/LLama-Guard/python/python/src/aiconfig_extension_llama_guard/__init__.py b/extensions/LLama-Guard/python/src/aiconfig_extension_llama_guard/__init__.py similarity index 100% rename from extensions/LLama-Guard/python/python/src/aiconfig_extension_llama_guard/__init__.py rename to extensions/LLama-Guard/python/src/aiconfig_extension_llama_guard/__init__.py