diff --git a/README.md b/README.md index 4e70f92..8f2bc20 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ # Overview | Developed by | SCB 10X | -| --- | --- | | Date of development | Feb 15, 2024 | | Validator type | Quality | -| Blog | - | +| Blog | | | License | Apache 2 | | Input/Output | Output | -# Description +## Description +### Intended use Validate that an LLM-generated text is in the expected language. If the text is not in the expected language, the validator will attempt to translate it to the expected language. Use `fast-langdetect` library to detect the language of the input text, @@ -17,30 +17,31 @@ and `iso-language-codes` library to get the language names from the ISO codes. Utilize Meta's `facebook/nllb-200-distilled-600M` translation model (available on Huggingface) to translate the text from the detected language to the expected language. -## Intended use - - Primary intended uses: This validator is useful when you’re using multiple languages in an LLM application. - Out-of-scope use cases: N/A -## Resources required +### Requirements -- Dependencies: +* Dependencies: + - guardrails-ai>=0.4.0 - fast_langdetect - iso_language_codes - transformers HuggingFace library - facebook/nllb-200-distilled-600M translation model -- Foundation model access keys: HuggingFace -# Installation +* Foundation model access keys: + - HuggingFace + +## Installation ```bash $ guardrails hub install hub://scb-10x/correct_language ``` +## Usage Examples -# Installation +### Validating string output via Python -## Validating string output via Python In this example, we apply the validator to a string output generated by an LLM. ```python @@ -70,7 +71,7 @@ Initializes a new instance of the ValidatorTemplate class.
-**`validate(self, value, metadata) → ValidationResult`** +**`validate(self, value, metadata) -> ValidationResult`**